|
I've been trying to figure out this problem for some time now with no success. If you try to use a replaced shader in a scene that is currently using lightmaps, the lightmap variables are never set in the shader. This causes unpredictable texture problems since the shader attemps to calculate lightmaps based on garbage values. To show what exactly is happening, I have included a link to a web player build of the project HERE In this project, all materials are using the same default shader shown below. This is the same shader that is passed in to the replacement shader: } The script below is what is currently setting up the replacement shader: } Because the lightmap data is not being initialized in the shader, the shader variable "unity_LightmapST" is garbage, which is used in all the calculations for determining the correct lightmap offset and scaling. Is there a way to ensure that this variable still gets set? or pass in my own variable to replace it without iterating through every object and calling Material.SetVector()?
(comments are locked)
|
