nvpro-samples / gl_ssao

optimized screen-space ambient occlusion, cache-aware hbao
Apache License 2.0
355 stars 37 forks source link

Projection scale wrong for perspective projection? #2

Open Erellu opened 1 year ago

Erellu commented 1 year ago

Currently, scale factor of the projection (used to compute radius to screen), is computed as float(height) / (tanf(projection.fov * 0.5f) * 2.0f);.

projection.fov is 45, so these are presumably degrees . However, tanf expects radians, both in C and in C++.

Shouldn't it be float(height) / (tanf(projection.fov * M_PI * 0.5f / 180.f) * 2.0f);? If not, what is the meaning of the current value?

mp3guy commented 1 year ago

You're correct, I noticed this too.