You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Common cross-product expansions: cross(vec3(1,0,0),a) -> vec3(0,-a.z,a.y) cross(vec3(0,1,0),a) -> vec3(a.z,0,-a.x) cross(vec3(0,0,1),a) -> vec3(-a.y,a.x,0)
( perhaps generalized to cross(vec3(d,0,0),a) -> d*vec3(0,-a.z,a.y) etc. (when d is known to be scalar type), though this doesn't seem common )
Expected impact on precision: none, driver shader compilers typically perform similar transformations anyway.
The text was updated successfully, but these errors were encountered:
Generally an improvement:
cross(-a,b)
orcross(a,-b)
or-cross(a,b)
->cross(b,a)
(related issue: sign cancellation)transpose(mat)*vec
->vec*mat
vec*transpose(mat)
->mat*vec
transpose(a)*transpose(b)
->transpose(b*a)
distance(a,b)
->length(a-b)
(completed in 40dae3c)Only if there's a flag to turn it off (otherwise could hurt compression):
sqrt(dot(a,a))
->length(a)
min(-a,-b)
->-max(a,b)
-max(a,-b)
->min(-a,b)
and so-forth.
cross(vec3(1,0,0),a)
->vec3(0,-a.z,a.y)
cross(vec3(0,1,0),a)
->vec3(a.z,0,-a.x)
cross(vec3(0,0,1),a)
->vec3(-a.y,a.x,0)
( perhaps generalized to
cross(vec3(d,0,0),a)
->d*vec3(0,-a.z,a.y)
etc. (whend
is known to be scalar type), though this doesn't seem common )Expected impact on precision: none, driver shader compilers typically perform similar transformations anyway.
The text was updated successfully, but these errors were encountered: