Monday, September 25, 2023

Pipeline Tips: Naming Conventions and Exporting from Substance Painter

Naming Conventions! So Important! Are your files a mess? Cluttered? Do they not make sense from software to software? 

With the amount of software and engines out there, there is no True Way to name things, but if you're in games (mainly Unreal Engine), then there is a common way that you should get used to. Start using it now - start getting your peers to use it - and single and group projects should go smoother.

In this post, I will talk to you about naming something in your modeling software for Substance Painter, exporting tips for Painter to UE, and naming conventions for Unreal. I'll be conforming to Unreal Engine's naming conventions, but if there's another system you want to use, then it should be easy to replace the corresponding conventions with what I cover.

The conventions usually used are prefixes as follows:
  • T_  for Textures
  • SM_ for Static Meshes
  • M_ for Materials
  • MI_ for Material Instances
There are others, but these are the ones I will talk about.


In The Modeling Software

Okay. You've modeled something in Maya/3DS Max/Blender. In these programs, the model will have a default material. In Maya -> 'lambert', in 3DS Max -> 'Default,' and in Blender -> 'Material.' If you don't change this in the modeling software, the model will be imported with that name into Substance Painter.



This is important because the 'texture set' name influences the name of the exports from Painter. Then you're pulling these textures into Unreal, and at that point, it could get very convoluted. Suddenly you have lambert5_basecolor, lambert6_basecolor, lamber7_basecolor, etc. 

You can rename the texture set name in Painter, but if the model needs some tweaking and is reimported into Painter, the texturing progress is hidden. 



It's best to rename the material in your chosen modeling software while you're modeling so that it is already established when you move on to the next phase of the pipeline. This rename should also include the prefix 'T_' to indicate that it is a texture slot name!

*Remember, you should export your fbx with the SM_ prefix! It's a static mesh! Correct naming early in the process prevents you from having to rename things later!

In Substance Painter

When exporting from Painter, we usually go for the Unreal Engine 4 (Packed) template.

*Real quick. What's this Unreal Engine 4 SSS template? Do we use it?? No. Not unless you need to use subsurface scattering and have been using subsurface techniques while you texture. 99% of stuff will not use the SSS template.*

While the UE4 (Packed) template is good, it's a bit much. 


Looking under Output Templates > Unreal Engine 4 (Packed), you can see how the export names are generated and what channels are used for which maps. When I say 'a bit much,' I am specifically referring to the name slots. 

'$mesh_$textureSet_BaseColor(_$colorSpace)(.$udim)', as an example, is the name generator for the base color map. 

  • '$mesh' points to your mesh name
  • '$texture_set' points to the texture_set name
  • 'Basecolor' is the map type
  • '$colorspace' refers to the color space you're using. (If you've read my color management post and my Painter to Unreal post, this one is familiar.)
  • '$udim' refers to the UV tile used. In usual workflows, this will just be 0001, but if you're using udims, the four digits will point to the UV tile for that export.
For my cube, this export name would be SM_Cube_T_Cube_BaseColor_Ulitity - sRGB - Texture.png

WHY would this name need to be so long? It doesn't! We don't need the mesh name because if we're working right, the texture set should have the same name! Or it should be similar! Also, at this point, we don't need to know what color space we're in. If we've set up our project right (see color management post), then the color space of Painter should be close to the color space of Unreal. Too long and it's gross. 

Next Step!! Duplicate(x2)the Unreal Engine 4 (Packed) template and rename it. One duplicate should be called UE TextureName and the other UE TextureName UDIMS. (Or name it to whatever is best identifiable to you. Just make sure one is clearly labeled for UDIMS.)

Then change the name generator - be sure to NOT touch the map channel stuff. 

How it should look


How it should look for UDIMS

For ease of use:
(Non Udim)
$textureSet_BaseColor
$textureSet_OcclusionRoughnessMetallic
$textureSet_Normal
$textureSet_Emissive

(Udim)
$textureSet_BaseColor(.$udim)
$textureSet_OcclusionRoughnessMetallic(.$udim)
$textureSet_Normal(.$udim)
$textureSet_Emissive(.$udim)

Now, these will look concise and correct when you're exporting your textures to your ArtSource. T_Cube_basecolor is better than that monstrosity we saw earlier.

You could even condense the OcclusionRoughtnessMetallic to ORM (I would encourage this), but this is fine for now. Once you get used to knowing that:
  • Red = Occlusion
  • Green = Roughness
  • Blue = Metallic
then you can use $textureSet_ORM and $textureSet_ORM(.$udim)
(I didn't memorize that for way too long. Know it now so your texture names can be short!)

File Type

Small note I want to put here. What file types should we be using? Which file type is the best? 

Short answer: PNG for anything real-time. Games, demos, prototypes. PNGs all the way. Larger projects (capstones, gamelabs) should also have a smaller resolution. Most things like props could be 512 or 1K at most. Larger pieces and characters are afforded more resolution: 1K-2K. It really depends on the load your project can handle. 

Longer answer: Portfolio pieces and other things that don't need to be real-time (renders of assets) can have higher resolution: 4K - 8K if needed. You could also use the Targa file type. Targa is an uncompressed file type. The color info is nice and fresh, but it's a larger file and takes longer to load. If you have virtual textures enabled in UE, UE might also think targas are virtual textures (even when they're not used like that.) 

Using a 1K png for in-game and a 4K targa in the portfolio render is totally okay and is probably the way to go.

---

Look at how neat:


Shortest names possible while still being descriptive of what each item is!


In Unreal Engine!


This is more straightforward. There's just a few things to remember here.

1.) Import Settings

You can combine your mesh into one static mesh. If you've separated your texture sets correctly, they'll all come in on separate material element slots. You don't have to, but just know that you have the option to have all the pieces come in as one or separately. 



Also! Do Not Create Material upon import! You should be either using a master material that your group has made or making a new material yourself. It's easier to use things when you know how to edit and control them.


Uncheck sRGB on the ORM Maps!


ORM maps import in with the sRGB box checked. WE DO NOT WANT THE BLUE CHECK! NO CHECK! We want each of the RGB channels to be read independently so that they can be used as our Ambient Occlusion, Roughness, and Metallic maps. If an asset's texture looks too shiny or just a bit off, this is the #1 culprit. It's annoying, but it's gotta be done.

Mapping textures in materials

First of all. NAMING CONVENTIONS! All materials should start with 'M_' and all material instances (materials that use the foundation from their parent materials and can be edited with parameters) use 'MI_' as their prefixes.

Here, I am mapping my cube textures in M_Master. 
  • BaseColor RBG -> base color
  • Normal RBG -> Normal
  • ORM Red - > Ambient Occlusion
  • ORM Green -> Roughness
  • ORM Blue -> Metallic



If this were a larger project, I could use stand-in textures here and convert the Texture Sample nodes to parameters. Then, I could create material instances of the master material and just plug in my cube texture into the drop-down in the instance.






Above you can see that I have MI_Cube as an instance of M_Master. Having a master setup allows you to make materials for your assets quickly.


Last thing! Put materials on the meshes!

Assign your material to your static mesh in the static mesh.



Now, when you pull that mesh into your scene, it already has its material!


ooh so clean!




Thanks for reading to the bottom of this post. I do hope that this has helped someone out there! If you already knew this, then great! No reason to not be doing it, then!



Kidding! ha.




Thursday, August 3, 2023

Research Project: Painting Over 3D

    For this project, I decided to create a painter for my scene of my CocaCola Machine. Most of everything I've ever made has been displayed in Unreal Engine for the final product, but I rarely do any type of post-processing on my renders. 

I was inspired by the art of Makoto Shinkai, an animator, filmmaker, and manga artist. I love his work - so beautiful! The illustrations and films are just at another level, and I would like to experiment with trying to bring my own work into that style.

This post will mostly be a step-by-step on how I attempted to integrate that style into my CocaCola Machine:



Firstly, in hindsight, this is actually a difficult scene to convert to Shinkai's style. My scene is very grungy, dank, and dark, while his works stay closer to picturesque and clean. No matter, this is all about experimenting right? Maybe in the future I can create a better scene to try this. 

First, I took this render into photoshop as an EXR image. I like to render using the Movie Render Queue (I have a post on that) because there are more options for anti-aliasing and console variables.

In photoshop I brightened the image's exposure, just to brighten the dark areas. For this, I was okay with loosing some of the grunge and darkness for the sake of the style.

I then converted the image from an EXR (32 bit) to an 8bit image so that I could peruse the filter gallery. Initially, in the tutorials I found, they edited the color values and luminance to achieve a paniterly look. The grunge in my scene could not be smoothed out like that though, I would have to smooth it out manually or use a strong filter. After duplicating the image layer and hiding the original layer, I explored the FIlter Gallery.



I used the Dry Brush filter (at above settings) but the image didn't completely smooth out. I did like the results, so I went through with the smudge tool and smoothed out areas like the signs, the ground, and the sides of the vending machine.



After locking that layer, I created a new one for 'patch smudging.' This is where I chose a section on the wall and with the color picker, I brushed on patched of color to smudge out. Iused Kyle's Paintbox - Wet Blender 50.






Since I was smudging the color around, it is not 100% opaqe, so some detail from the image is coming through. I went over the walls and ground like this, and created a separate layer for the bike shadows, because I wanted to keep the shape of that shadow withough loosing it into the wall.

Patched Walls and Ground


After, since I now knew what brushed out looked like on a larger scale, I went into the smaller pieces - piped, bicycle, signs again - on the bottom filtered layer (not the OG layer, the one above it.)

The signature look for anime and manga is the black outlines, of course. In my references (Not all Shinkai's work) there are thin black line work around foreground elements (if not all elements) and almost no line work in the background plate.



I elected to outline all of the elements, because I don't think I'm al the level to be able to have a whole background plate that has elements that wont blend into each other. It was also a great guide more me to tell where everything is since my image is so dark.

Linework

The linework is a bit messy and too much, but this was my first time working like this, so I didn't feel too bad about it. I should have used a smaller soft round brush to outline, rather than a harder edged brush. 

In my final render, I did a mix of blur and sharpen to smooth out the linework, and I turned down the opacity to 40%, which helped the whole image.

Next I added soft highlights. This step helped give the image more life and shape. It really popped some elements that faded into the background in the original render.

Soft Highlights


While in some of my research and references the soft highlights are more consistent, I still wanted to keep the feel of grunge. Smooth highlights would have conveyed a clean smooth surface, which describes nothing in my scene. Just a Solid Color layer (white) with overlay enabled allowed for these highlights. 

Lastly, I put in harder edge highlights. In the reference of the dining table, there are softer highlights on everything and harder, smaller spots of highlights are on the objects directly in the light. With another white Solid Color layer with overlay, I put in smaller spots of edge highlights on objects that could convey those types of reflections.

Harder Edge Highlighs

I feel like this step, if done correctly, really helps put the image from painterly to painterly anime. It's not quite there, I might need to work on it more and get more practice. 

Above is my final image (for now). I had a lot of fun doing this project because I rarely use post processing or photoshop on my renders after they come out of Unreal Engine. I think I might try this technique on some of my other projects, or maybe create projects with this technique and SKinkai's art style in mind. 

Some links to tutorials I looked at for this project - I used then kinda, but they were good starting points: 




By the way, I was whining to Kayleigh Sims about my woes with working with photoshop post-process (Me - a proclaimed 'can't draw' 3D artist and Kei - illustrator extraordinaire) and she just patted me on the shoulder and said it was a Skill Issue. ಠ_ಠ Like. I know, but she didn't have to say it like that!



Final of Project 3

 







Tuesday, July 25, 2023