Jump to content


Advanced light-based shading


Recommended Posts

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?

Link to comment
Share on other sites

If you search on JK3Files for 'specularity' in the description, I had a tendency to specifically mention when a mod had it. I don't claim to know a ton about JO, but the shader systems should be the same between the two games. If not you'll need to go track yourself down a seasoned JO modder.

Link to comment
Share on other sites

Okay, one other question; what is the best way to do bump-mapping on a character? I think I investigated before attempting to get a normal-mapping style effect on a skin and didn't have much luck; is there any recommended way to make a surface on a skin look "bumpy" even when light is applied to it?


I don't require proper bump-mapping; as I understand it this is only really possible on map surfaces and even then isn't perfect; however, I'd like to create an effect as close as possible.

Link to comment
Share on other sites

Hmm, in that case; is there at least a way to make parts of a texture always appear dark? E.g - so that colour appears as texture_colour * light, so black areas that are fully lit will remain black?


Or is this something shaders can't control and will need some trickery with a layer that ignores lighting (in the same way you would do a "full-bright" glow effect)? I'd rather avoid an extra layer as a rule, since I prefer not to have more than four stages in a shader, especially on a player model.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...