I have been thinking for a while that it would be nice if I could change the brightness of a character skinmesh or any skinmesh according to the brightness of its surroundings. I know there is a way to sample the pixels on screen and use that info for other calculations.
Could anyone please help me with this. basically i want to darken and brighten the character when they are in the sun and in the shadows. and since ive moved to shadow mapping and away from raytraced shadows , mimicing when a character is in shadow and not in shadow is very difficult.
I figured out an alternative solution, using event on location with a custom volume mesh. Simply put, when the character inside the volume their texture is darkened via a script. And when outside the volume the character texture is lightened.
The script is a basic script that I got from Shadmar or Giles shader posts.
The custom volume mesh was made using the shadow map texture as an outline.
It adds a subtle element of emerssion so the character doesnt stick out so much when they are in complete shadow.
I know this is an old thread, and you've already found a pretty good solution, one other idea I was thinking about was to encode whether each coordinate in a space is in shadow or not, into a texture.
For example: the point x: 1, y:2 is in shadow, so you can set the pixel 1 (x) on row 2 (y) of the texture to black, and others to white. Then in the pixel shader you take the position of the player character, and read the pixel at the coordinate in the texture.
You can extend this to 3d as well, but you'd need to use either the alpha channel of the color or something to save that z axis information.
Haha, do try tho. 3drad doesn't make it easy to debug and angelscript feels alien from time to time, but it does truly make a lot more things possible. I'm still learning new things about the language even today.