Page 1 of 1

3 UV set doesn't work when baking Lightmaps?

PostPosted: Sun Oct 08, 2017 2:07 am
by dink
Hey all,

I hope someone here can help me. So I've been trying to utilize 3 UV maps on objects in my scene (Amplify shader editor seems to allow us to use up to 4 channels). This is the techniques I'm trying to utilize:

1. I'm using UV CH0 for tiling textures in my materials.
2. I'm leaving UV CH1 for lightmapping, as this the channel Unity will go to by default.
3. I'm trying to use UV CH2 for specific normal map trimmed details. I've UV'ing specific polygons on the mesh to utilize different parts of a sheet of normal map details. And I'm blending that over the tiled normal maps which are mapped using UV CH0.

Problem? When I work in my 3D program (modo) and add some trim sheet UVs on UV CH2, leaving UV CH1 and CH0 alone, then exporting the model to Unity, it all seems to work. My amplify shader settings are made so that my tiling textures are on UV set 1 (which is technically 0) and my normal map trim sheet details are set to 3 (technically 2).

And this appears to work as expected.

But then when I generate my lightmaps, this is when it all goes to hell.

If I'm using a Texture Coordinates node to apply UV CH3 (again, technically 2) then my shader actually goes pink and has an error. So if I remove the Texture Coordinates node and instead use the Texture Sample for the Normal map and set it to CH3 instead of using a Texture Coordinate node, this corrects the shader error. But now the UV channel I made specifically for the trim sheet doesn't seem to be functioning correctly.

This is very baffling to me. My guess at what is happening is that when Unity bakes out the lightmapping, it annihilates any UV Channel that is on the model after UV CH2 (technically CH1). As in, when I bake my lightmaps in Unity onto UV CH1, it does SOMETHING to UV channels 2 and 3.

Does anyone have any ideas of how to help me on this? I would greatly appreciate it!!

Re: 3 UV set doesn't work when baking Lightmaps?

PostPosted: Mon Oct 09, 2017 10:54 am
by Ricardo Teixeira
dink wrote:Hey all,

I hope someone here can help me. So I've been trying to utilize 3 UV maps on objects in my scene (Amplify shader editor seems to allow us to use up to 4 channels). This is the techniques I'm trying to utilize:

1. I'm using UV CH0 for tiling textures in my materials.
2. I'm leaving UV CH1 for lightmapping, as this the channel Unity will go to by default.
3. I'm trying to use UV CH2 for specific normal map trimmed details. I've UV'ing specific polygons on the mesh to utilize different parts of a sheet of normal map details. And I'm blending that over the tiled normal maps which are mapped using UV CH0.

Problem? When I work in my 3D program (modo) and add some trim sheet UVs on UV CH2, leaving UV CH1 and CH0 alone, then exporting the model to Unity, it all seems to work. My amplify shader settings are made so that my tiling textures are on UV set 1 (which is technically 0) and my normal map trim sheet details are set to 3 (technically 2).

And this appears to work as expected.

But then when I generate my lightmaps, this is when it all goes to hell.

If I'm using a Texture Coordinates node to apply UV CH3 (again, technically 2) then my shader actually goes pink and has an error. So if I remove the Texture Coordinates node and instead use the Texture Sample for the Normal map and set it to CH3 instead of using a Texture Coordinate node, this corrects the shader error. But now the UV channel I made specifically for the trim sheet doesn't seem to be functioning correctly.

This is very baffling to me. My guess at what is happening is that when Unity bakes out the lightmapping, it annihilates any UV Channel that is on the model after UV CH2 (technically CH1). As in, when I bake my lightmaps in Unity onto UV CH1, it does SOMETHING to UV channels 2 and 3.

Does anyone have any ideas of how to help me on this? I would greatly appreciate it!!



Hello,

Thank you for getting in touch, we really appreciate it. Unfortunately, this is an inherit Unity limitation regarding Lightmap UV generation and use. UV Set 3 is used by Realtime GI Data, since you are likely using the "Generate Lightmap UV's" checkbox on your model, you will have to use channel 4 instead.

Image

Be sure to let us know if the information above helps you resolve the problem.