1
\$\begingroup\$

I'm using a texture atlas and a light atlas to tile a mesh. I have the texture atlas working fine. I can apply textures and create a sort of tile map on my coded mesh. At the moment I'm using the built-in Self-Illum Diffuse shader.

The problem with this shader (and all others I've tried) is that it uses the same UV map for both the texture and the illumination, the result is, ie, that all grass tiles appear with the same level of light.

What I would like to do is apply two different UV maps: UV to tile the textures, and UV2 to tile the lighting. This would allow me to tell Unity which tiles should be lit up and which should not. The end result I'm looking for is that I will be able to display cubes that are close to a light source texture bright, and those further away darker.

I've attached a very ugly drawing of what I hope to achieve (I've drawn a 2D map but I'm actually working with a 3D mesh, IE: a deformed plain, and the Light Atlas of course has a Alpha layer).

enter image description here

I've got the UV maps nailed down and applied to the mesh. What I'm looking for is a way to tell a shader to read the two UV maps separately.

I would expect what I'm doing to be quite common and am really surprised that Unity doesn't have this built-in somewhere.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.