I’m trying to obtain the color of the vertices in a mesh once a directional light makes its action on the mesh. However all the values for all the vertices that I’m obtaining are exactly the same: RGBA(255, 255, 255, 255), and this is not correct since my mesh is grey and it has parts of shadows.
if you have unity pro… render your camera to a render texture, then you can sample any of the pixel’s rgb color that you want from the render texture.
You’ll just need to convert your screen space co-ordinate, into a texture space co-ordinate.
alternatively… use vectors. compute facing angle or brightness yourself.
vec1 = polygon . normal
vec2 = light.position - poly.position //for a spot or point light
Easy, I’ve solved the problem placing the main camera on the normal vector of each facet of the mesh, and making the camera point to that facet and rendering the color of that facet (using a very low value of the field of view of the camera to constraint the camera pointing). Consequently, I can obtain a rendered image of each facet in the mesh, thus allowing me to compute the final brightness of each one ;).