Welcome, Guest! Login | Register
Scripting Help request
Info
Report
114 Posts

Hi all 3d rad users

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.

thanks
Created on: 4 months ago
Info
Report
71 Posts

The simplest method is to use an darkened, lighter and normal character meshes.
Created on: 4 months ago
Info
Report
114 Posts

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.
Created on: 3 months ago
Info
Report
31 Posts

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.
Created on: 2 months ago
Edited on: 2 months ago
Info
Report
114 Posts

scripting.............my arch nemesis........
Created on: 2 months ago
Info
Report
31 Posts

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.
Created on: 1 month ago
Reply
Preview
Post
Or use the advanced reply form here...
Sponsored