[Bug 91114] ES3-CTS.gtf.GL3Tests.shadow.shadow_execution_vert fails

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Aug 14 01:23:25 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=91114

--- Comment #19 from Kevin Rogovin <kevin.rogovin at intel.com> ---
Hi,

 At Tapani's request, I've done some digging into this and the code to lower
textureGrad for cube maps is much wronger than just adjusting rho by a
constant.

Lets do the case where the face used is the Z_MAX face, i.e. r>0 and has
largest absolute value. The then texel coordinates are:


 u = L * 0.5 * ( s/r + 1)
 v = L * 0.5 * ( t/r + 1) 

where L is the dimension of the cube-map. The gradient of u is then given by:

grad(u) = 0.5 * L * (  grad(s)/r -  (s/(r*r))*grad(r) )

then rho is given by:

rho = abs(grad(u)) + abs(grad(v))
    = 0.5 * L * ( |grad(s)/r -  (s/(r*r))*grad(r)| + |grad(t)/r - 
(t/(r*r))*grad(r)| )

The current code has (after the -1 is taken into account on the log2)

rho = 0.5 * L * ( |grad s| + |grad t| + |grad r|)

which is only correct (in this case) when grad(r) is zero and r=1.


To fix the rho computation (or the LOD) requires first finding which face the
thing is on, and from there develop grad(u), grad(v) correctly. There will be,
sadly six cases. This can be reduces to 3 cases. Indeed, lets say the face was
from Z-negative, then we have:

u = L * 0.5 * s/(-r)

thus grad(u) = - 0.5 * L * (  grad(s)/r -  (s/(r*r))*grad(r) )

which is the same as the Z_MAX but negated. The magnitude is unaffected though.
Thus to compute the correct jazz, one has really just 3 cases: X-FACE, Y-FACE,
Z-FACE.

Tapani told me this little nugget (found on the map page for texureGrad
(https://www.opengl.org/sdk/docs/man/) :

"For the cube version, the partial derivatives of P are assumed to be in the
coordinate system used before texture coordinates are projected onto the
appropriate cube face."

That sentence confirms the requirement to use the calculus quotient rule.

-Kevin

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/intel-3d-bugs/attachments/20150814/c7e8e21e/attachment.html>


More information about the intel-3d-bugs mailing list