Author Topic: Workflow for baking PBR results into base texture?  (Read 16447 times)

I'm working on a computer game and trying to simplify my 3D modeller's workflow to take all the pain out of his process and let him concentrate on creating models. Right now he's producing models, merging them into a single mesh and manually unwrapping and packing the UVs. He previously then textured in photoshop, but we've decided to try to replace this with Substance Painter.

In the game, these models are always lit from the same angle by the same light and they're always viewed from the same angle. What we want to do is bake everything right into the base texture. The game is built in a custom engine, so I can easily disable the in-game lighting and just display the pre-baked texture. This works with our current workflow since photoshop just works on the diffuse texture, but doesn't jive with Substance Painter. The process we're trying to implement is:
  • Create model, merge to a single mesh in 3DS Max
  • Automatically unwrap and pack UVs
  • Export as OBJ/FBX
  • Texture exported model in Substance painter
  • Bake AO, lighting and shadows into texture
  • Import finished model into game
Ideally, we'd like to bake the results from Substance Painter's PBR based shader directly onto the diffuse texture. I know Substance Painter/Designer can bake AO, but the problem we're running into is that as far as I am aware, it has no lighting setup so can't bake lighting or shadows. We can import the textured model back into 3DS Max and use render-to-texture to bake in lighting and shadows, but I'm told 3DS Max doesn't have support for PBR shaders and won't render the same as Substance Painter, so the results will look very different.

I guess my questions are:
1) Is there a way to bake lighting and shadows in the Substance toolset that I just haven't found?
2) Is there a way to get 3DS Max to render a model the same as Substance toolset apart from lighting?
3) Can we make the Substance Painter display and output textures in a standard Diffuse/Normal/Specular setup so that it can be imported easily into software like 3DS Max and will look the same?

Thanks in advance for any help anyone can give. I'm not a 3D modeller by trade and my 3D modeller is still learning, but I'm hoping we can resolve this issue and start baking some of the visually impressive results of the Substance Painter onto the base texture.

Hi Brendan,

I guess my questions are:
1) Is there a way to bake lighting and shadows in the Substance toolset that I just haven't found?
2) Is there a way to get 3DS Max to render a model the same as Substance toolset apart from lighting?
3) Can we make the Substance Painter display and output textures in a standard Diffuse/Normal/Specular setup so that it can be imported easily into software like 3DS Max and will look the same?


Unfortunately, Painter doesn't have a method for baking the lighting and shadows.

With 3ds Max, you will need a PBR shader. In Maya 2016, there is a new PBS shader called "stingray PBS" which is a shader fx file. I'm not sure if this is included with 3ds Max 2016, but since they both have shader FX, I would imagine 3ds max 2016 would have it as well. They may not be helpful depending on your upgrade path. The singray pbs shader does work well with Substance.

With this workflow, you could export the maps to max and then bake the lighting and shadows to the textures. Here is a link for a PBR shader for max as well. http://www.mophogames.com/pbr-3ds-max-shader-preview/

At this time, Painter doesn't have a shader to support diffuse and specular (non-PBR). This is on the road map, but at this time there is not a way to export non-pbr map types.

I'm sorry, this sounds like a lot of "you can't" for your particular workflow. I'll do my best to help come up with a solution for your needs. Here is an idea of a possible workaround. 

So one thing you could do is to screen capture the 2D view which contains lighting and reflection. Then in Max, bake the directional lighting and then multiply this over your base color map. This will definitely break the maps for PBR use, but that sounds like that is ok for your custom setup. From there, you have the normal from Painter so that should work. Since you are baking the lighting and reflection, you should only need the base color and normal map for your shader in-engine.

Cheers,

Wes

Head of Substance Demo Art Team
the3dninja@adobe.com
Twitter: The3DNinja

Thanks a ton for your help, Wes!
With 3ds Max, you will need a PBR shader. In Maya 2016, there is a new PBS shader called "stingray PBS" which is a shader fx file. I'm not sure if this is included with 3ds Max 2016, but since they both have shader FX, I would imagine 3ds max 2016 would have it as well. They may not be helpful depending on your upgrade path. The singray pbs shader does work well with Substance.

With this workflow, you could export the maps to max and then bake the lighting and shadows to the textures. Here is a link for a PBR shader for max as well. http://www.mophogames.com/pbr-3ds-max-shader-preview/
I think my modeller has tried and failed to get that shader to work, but I will ask him to give it another shot as it sounds like the ideal solution for simplifying this workflow.

At this time, Painter doesn't have a shader to support diffuse and specular (non-PBR). This is on the road map, but at this time there is not a way to export non-pbr map types.
Thanks, I expected as much. PBR is the industry standard now for game engines, so I understand why supporting it is a priority.

I'm sorry, this sounds like a lot of "you can't" for your particular workflow. I'll do my best to help come up with a solution for your needs. Here is an idea of a possible workaround. 

So one thing you could do is to screen capture the 2D view which contains lighting and reflection. Then in Max, bake the directional lighting and then multiply this over your base color map. This will definitely break the maps for PBR use, but that sounds like that is ok for your custom setup. From there, you have the normal from Painter so that should work. Since you are baking the lighting and reflection, you should only need the base color and normal map for your shader in-engine.
Good idea! This sounds similar to something we did before where we rendered the shadows and AO to textures and then multiplied them with the diffuse map. The results did look good for our purposes, and since the models are small enough on screen we actually didn't need to include a normal map, just use a normal map in the shadow bake. Something similar to that should work here, I'll give it a go.

So it looks like I have three options to try:

1) Export the PBR maps from Painter, then import the Color and Normal maps into Max. Maybe import the metallic map or inverse of the as roughness map as Specular? Then bake the shadows to a texture in Max, and multiply together the Shadow texture, Painter AO, and Color textures to produce the final diffuse texture. It should be close enough to how it looks in painter for our purposes.

2) Use a simple color + normal shader in Painter so that the results match up exactly with what's seen in MAX, and then do the shadow and AO baking in Max using vray.

3) Try some of the different Painter export options and see if they're close enough to be used. The CryEngine 3 export seems to have Diffuse, Specular, and what looks like Direct X Normal? I haven't tried to import that into Max, but could give it a go.

Looks like I have some experimenting to do. Thanks so much for the suggestions and help, the support for Substance is a lot better than any other tool I've used so far.

EDIT: Looks like the CryEngine export's DDNA is Normal in rgb and glossiness in the alpha channel. Haven't got a chance to test it in Max, but it should be usable.
Last Edit: April 10, 2015, 10:29:56 pm

As a follow-up to this, I've explored each of these options and decided that the most viable solution for my current engine would be to write a simple shader for substance painter that uses only the Color and Normal maps and a basic specular, then write a shader that looks the same in my engine.

I've already got the SimpleColor.glsl shader one of the Substance crew posted before to use as a starting point and added the Normal map to it, so I just have to add a basic specular and then write a HLSL shader that does the same for my engine.

After that, my process should be:
  • Bake AO map in Substance Designer
  • Bake scene shadows in 3DS Max
  • Add AO and shadows as fill map layers in Substance Painter and set to multiply with base color only
  • Export Color and Normal maps for use in my engine.

As long as we stick to using the new shader in Substance Painter and experiment with materials to get a good look, it should all be good. Will update when we've run a model through this workflow!

As a follow-up to this, I've explored each of these options and decided that the most viable solution for my current engine would be to write a simple shader for substance painter that uses only the Color and Normal maps and a basic specular, then write a shader that looks the same in my engine.

I've already got the SimpleColor.glsl shader one of the Substance crew posted before to use as a starting point and added the Normal map to it, so I just have to add a basic specular and then write a HLSL shader that does the same for my engine.

After that, my process should be:
  • Bake AO map in Substance Designer
  • Bake scene shadows in 3DS Max
  • Add AO and shadows as fill map layers in Substance Painter and set to multiply with base color only
  • Export Color and Normal maps for use in my engine.

As long as we stick to using the new shader in Substance Painter and experiment with materials to get a good look, it should all be good. Will update when we've run a model through this workflow!

Great! Please let me know if you have any issues with the shader. Also, I'd love to see an example of how you are extending Painter with a custom shader workflow.

Cheers,

Wes
Head of Substance Demo Art Team
the3dninja@adobe.com
Twitter: The3DNinja