- Home /
Replacing lightmap shader pass
Since I want to have more control over how the lightmap gets applied in the shader I would like to know where I can find the lightmap calculations in the CGIncludes files and if its possible to replace them.
Atm I am mainly interested in the non directional lightmaps.
I found the two files "Internal-DeferredShading" and "Internal-PrePassLighting" which seem to be responsible for the lighting. I put them into the Resources folder. To see any differences I changed the "CalculateLight" return value to "return half4(0,0,1,1);" in both files but it does not seem to change anything.
I am not sure if the files are not used at all or if the standard shader is just not using those passes.
I think it's juste beside your scene file in the project view, in a folder with the same name. Not sure if it's what your looking for ^^
$$anonymous$$aybe it wasn't clear enough. I am not looking for the Texture but for the shader part where the Lightmap gets multiplied with the other colors.
http://docs.unity3d.com/$$anonymous$$anual/SL-SurfaceShaderLighting.html Does this work with Unity 5?
Thanks. This solves at least a part of my problem.
Now I know how to write my own lighting function and I even found the file "Lighting.cginc" where the standard lighting methods are defined. Now I still have the problem that I want to replace those methods ins$$anonymous$$d of adding another one. I want the unity shaders, espacially the standard shader to use my new lighting method without the need to rewrite/replace every single shader. I know that its possible to override the terrain shader like here: http://forum.unity3d.com/threads/replacing-terrain-shader.59299/ But is it also possible to replace cginc files? I tried to put it into my Resources folder but it does not seem to work.
I think that deferred renderer only uses one lighting mode for everything. Otherwise i can't help you
Your answer
Follow this Question
Related Questions
Directional lightmap in custom shader. 1 Answer
Lightmap options in a custom shader 0 Answers
Random lightmap switching 0 Answers
where is Unity's shader handeling lightmapping? 1 Answer
Lightmapping on a custom shader 0 Answers