Jump to content
  • Advertisement

Archived

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

MENTAL

Spotlight theory

This topic is 5714 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Right then. i think i've got it sorted. The big red thing is the light, the big red arrow is the light direction, and the dark red lines are the cut-off angle. The blue thing is the vertex position and normal. Random Scribble right then. make a vector from the light position to the vertex and normalize. dot it with the light direction. if it's outside cos(cutoff) then don't light it. if not, dot the light angle with the normal. the result is the luminance of the vertex. clamp to 0,1. i don't need anything past that (oh the joys of cel-shading). of course, it's probably miles off - i've just been combining directional and positional lighting theories plus a little (and i do mean little) trig. thanks in advance EDIT: wrong url [edited by - MENTAL on April 20, 2003 6:30:26 PM]

Share this post


Link to post
Share on other sites
Advertisement
Hey, great art you have there...

But your algo sounds OK, if I got it right. You might want to add some fadeout towards the spot cutoff ? Here''s the typical pseudo code for spotlights:

s = light_to_vertex_normalized DOT spot_light_direction_normalized

if( s < cos(cutoff) ) return

spot_factor = pow(s, spot_light_exponent)

final_intensity = (N dot vertex_to_light_normalized) * spot_factor

Share this post


Link to post
Share on other sites
yeah, beats the crap out of your puny screenshots don''t it

anyway, i was thinking about adding some fadeout (both for the cutoff and radius) but it looks a bit rubbishy when cel-shading (i tried it for positional lights, and imo it would look even worse for spotlights).

i just wanted to make sure the light angle dot normal bit was correct (the rest of it kinda made sense)

cheers

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!