Can this calculaton be simplified?

Started by
1 comment, last by CarlML 7 years, 4 months ago

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);
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.

Omae Wa Mou Shindeiru

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!

This topic is closed to new replies.

Advertisement