Jump to content
  • Advertisement
Sign in to follow this  
CarlML

Can this calculaton be simplified?

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

Is it possible to simplify this calculation so that one can get rid of the division? These are all float numbers:

float depthLinear = projMatrix_43 / (depthNonLinear - projMatrix_33);

Share this post


Link to post
Share on other sites
Advertisement

The denominator depends on depthNonLinear, and you are using it only once. No way to precompute it.

 

You can construct a crude approximation of function projMatrix_43 / (depthNonLinear - projMatrix_33) given a range of depthNonLinear and constant projMatrix_43 and projMatrix_33 values, but I wouldn't bet on making it both faster than the exact computation (one subtraction and one division) and accurate enough.

Edited by LorenzoGatti

Share this post


Link to post
Share on other sites

The denominator depends on depthNonLinear, and you are using it only once. No way to precompute it.

 

You can construct a crude approximation of function projMatrix_43 / (depthNonLinear - projMatrix_33) given a range of depthNonLinear and constant projMatrix_43 and projMatrix_33 values, but I wouldn't bet on making it both faster than the exact computation (one subtraction and one division) and accurate enough.

That's what I suspected. Thanks for the input!

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!