- Home /
Can I modify light position data before it gets sent to the shader?
I'd like to alter the light position data before it gets sent to the shader on every frame. Is there a way I can accomplish this? I'm currently using Unity 5.0 if that matters.
Answer by Tepei · Mar 15, 2015 at 07:29 PM
You could use the shader Albedo Color. And Specular Color.. (for the standard(specular setup) shader)
That would not really affect the light before the shader.. But The light will multiply with your texture and the color.
So you could decrease or colorise the light.
I'm particularly interested in modifying the light position data more so than the color or reflections.
I must better read the question !
If it's only one modification of light for some object. I would maybe render with 2 différent camera. Object are on different layer. But you have to deactivate/activate each light OnPreRender ..
$$anonymous$$ore easy way could be to use a normal maps. This will affect the direction of the geometry for the light. (But also the reflection of the skybox) . For example a texture with (128,0,128) color marked as normal maps in the inspector, create with grayscale off.. Used as the secondary normal map in the shader, i could make the light go up or down with the influence parameter.. And green affect right and left..
Thank you. OnPreRender seems to be function I was looking for. =)
Seams that OnPreRender is firing before any camera start to render.. I just had some problem with it trying to deactivate my light for some custom pass.. But each light have a culling mask that make possible to only illu$$anonymous$$ate custom Layer of objects ..