Toon Shader and lighting

Posted By: Metal_Man

Toon Shader and lighting - 06/02/07 21:45

I;m using the toon shader from the Wiki, but I am having a problem in that the shader doesn't respond to level lighting, only the sun. The model is fully lit in the dark.

How can I get the shader to respond to lights in the level?
Posted By: lostclimate

Re: Toon Shader and lighting - 06/02/07 21:47

well it will take a bit of work as that shader doesnt support level level lighting at all
Posted By: Metal_Man

Re: Toon Shader and lighting - 06/02/07 22:01

how do other shaders do it?

Is there any way to make it base its shading off of how the model is lit when no shader is used?
Posted By: lostclimate

Re: Toon Shader and lighting - 06/02/07 23:06

well there is a couple of ways it can be done, one way is to make a toon shader that can be fed the brightness of the lightmap (well technically that has to be done either way) and the other step is a decision between quality and ease, the easiest version is to do a trace down,to the closest block, find its lighting and input that into the shader every frame the hard way is to read it from the wmp file itself, find the distance and angle from the light and then use that to decide which direction and if that light should light the models.
Posted By: Metal_Man

Re: Toon Shader and lighting - 06/02/07 23:23

For now, I think I'll try the easier way.

How do I do that?
Posted By: xXxGuitar511

Re: Toon Shader and lighting - 06/02/07 23:41

in the shader you can use float3 vecLight;

This will tell the shader the brightness of the block (same way as using a trace, but without doing it twice as the engine already does this
Posted By: Metal_Man

Re: Toon Shader and lighting - 06/03/07 20:24

thanks
© 2024 lite-C Forums