View Single Post
Old 06-20-2008, 10:59 AM   #1
Join Date: Nov 2002
Posts: 11
Advanced light-based shading

Right, so far I've made a skin, and have applied a shader to one of it's textures. However, what I'd now like to do is apply an additional layer which is blended with the lighting on the skin.

It's a difficult one to explain, so let's suppose:
- My player model is a cube (not really!)
- I have a texture which is a simple gradient, applied to the whole cube.

What I want therefore is:
- The darker the side of the cube is, the MORE the texture is visible
- The lighter the side of the cube is, the more faded the texture is

Thus, if the texture is being applied to a 100% dark area of the cube, then that area of the cube will have the full texture applied to it.
If the texture is being applied to a 100% light side on the cube, then the texture should be completely washed-out/white.
If the texture is being applied to a 50% light side of the cube then the texture will appear partly washed out (50% white, 50% texture).

Is this even possible? The concept behind this is that shaded areas of the texture should appear darker when in shadow, but should disappear completely when in the light. Is there any way to gain access to the lighting being applied to a texture at any given point when it is applied to a player-model, or is this completely impossible?

Another way to think of it is that what I want is for the texture to have more contrast the darker it is, and less contrast the lighter it is. Can I do this with a shader?

Also, a slight aside but not really deserving it's own topic; is it possible to apply a texture such that it is dependent on the user's view-point? E.g so I can apply a texture more to an area the user is looking directly at?
haravikk is offline   you may: quote & reply,