- Home /
Get colour of pixel on a surface (including dynamic light)
I have a few spot lights of different colours in a room and would like to access the colour they project on a point x,y,z on the floor for example. Is this a value that I can read from the shader to a C# script?
I can't use lightmaps because my spot lights are dynamic and they need to be dynamic for the sake of the game. The end goal is that different effects may apply to the player depending on the lighting of the surface he/she is standing on.
I'm using Unity 2018.
Answer by fffMalzbier · May 13, 2020 at 09:29 AM
You can have a camera pointed at the spot yo are trying to measure , Render into a rendertexture , copy the part that interest you or the whole texture to a normal texture and read its value.
Your answer
![](https://koobas.hobune.stream/wayback/20220612234126im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Overwrite directional light locally with a pointlight 0 Answers
2d lighting effect 1 Answer
How to fake light reflections on wet ground? 0 Answers