Jump to content
  • Advertisement
Sign in to follow this  
hbuel

Half Vector Calculation

This topic is 4322 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

Hi, I've been using the half-vector for blinn/phong lighting like this: H = (L+V) / (|L+V|) But I've read about an optimization using H = (L+V) / 2 Both my L, V vector have the length 1 - but correct me if I'm wrong: that doesn't necessary mean |L+V|=2. For example L = (0 0 1), V = (0 0 -1)? What am I missing or why should this work? thanks

Share this post


Link to post
Share on other sites
Advertisement
I've always seen the half-angle as normalize(L+V) (in shader language). (L+V)/2 is probably an optimization for when the vectors are more parallel than not (small angle approximation for cosine), but you would get increasingly incorrect results for larger angles. In all honesty it isn't much of an optimization since GPUs are designed for intensive math and vector operations. Your time would be better spent trying to eliminate texture reads.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!