Compute shading_view will full precision (#6611)
This commit is contained in:
@@ -10,3 +10,4 @@ appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md).
|
||||
|
||||
fog: fixed fog height falloff and computation precision on mobile [⚠️ **Recompile Materials**]
|
||||
materials: new alphaToCoverage property can be used to control alpha to coverage behavior
|
||||
engine: fix precision issue with `shading_view` in large scenes
|
||||
|
||||
@@ -36,10 +36,10 @@ void computeShadingParams() {
|
||||
|
||||
// With perspective camera, the view vector is cast from the fragment pos to the eye position,
|
||||
// With ortho camera, however, the view vector is the same for all fragments:
|
||||
shading_view = isPerspectiveProjection() ?
|
||||
highp vec3 sv = isPerspectiveProjection() ?
|
||||
(frameUniforms.cameraPosition - shading_position) :
|
||||
frameUniforms.worldFromViewMatrix[2].xyz; // ortho camera backward dir
|
||||
shading_view = normalize(shading_view);
|
||||
shading_view = normalize(sv);
|
||||
|
||||
// we do this so we avoid doing (matrix multiply), but we burn 4 varyings:
|
||||
// p = clipFromWorldMatrix * shading_position;
|
||||
|
||||
Reference in New Issue
Block a user