Quantcast
Viewing all articles
Browse latest Browse all 56

Shader that uses UV1 to map texture and UV2 to map light

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). 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. ![alt text][1] [1]: http://i.stack.imgur.com/TFp5z.png

Viewing all articles
Browse latest Browse all 56

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>