Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions filament/src/materials/ssao/saoImpl.fs
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ void computeAmbientOcclusionSAO(inout float occlusion, inout vec3 bentNormal,

// now we have the sample, compute AO
highp vec3 v = p - origin; // sample vector
float vv = dot(v, v); // squared distance
float vn = dot(v, normal); // distance * cos(v, normal)
highp float vv = dot(v, v); // squared distance
highp float vn = dot(v, normal); // distance * cos(v, normal)

// discard samples that are outside of the radius, preventing distant geometry to
// cast shadows -- there are many functions that work and choosing one is an artistic
// decision.
float w = sq(max(0.0, 1.0 - vv * materialParams.invRadiusSquared));
// Need to be highp to avoid imprecision on certain hardware (e.g. PowerVR)
highp float w = sq(max(0.0, 1.0 - vv * materialParams.invRadiusSquared));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

w should be between [0, 1] so I think it can stay mediump

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it, but the artifact is present without the highp.


// discard samples that are too close to the horizon to reduce shadows cast by geometry
// not sufficently tessellated. The goal is to discard samples that form an angle 'beta'
Expand Down
Loading