0
\$\begingroup\$

I am trying to add ssao effect to a visualization application but there are errors in resulting image. I am using code from https://github.com/nvpro-samples/gl_ssao . Errors occur in rapidly changing lighting near the edges of screen.

enter image description here

Only change to code was to remove basic shading and passing only white from scene.frag shader so the error could be seen more pronounced. I also added obj input to import sponza scene but the error is visible with the included sample scene as well if camera is moved close to object. As is this implementation only enables viewing objects in relative distance. Moving closer to objects brings up this errors.

What causes this error and is there fix.

\$\endgroup\$
  • \$\begingroup\$ @Little Helper Actually it is not my code. it is by nvidia(link above) and these parameters (radius 6.0 , intensity 3.0) are within reasonable limits \$\endgroup\$ – Mycz Dec 8 '18 at 15:03
  • 2
    \$\begingroup\$ I think it's just the nature of the screen space effect. It will never ever be able to capture details that are outside of the screen, so screen borders will appear glitchy, unless you actually render outside the screen borders. It should be less apparent if you have a scene with proper lighting and textures. \$\endgroup\$ – János Turánszki Dec 9 '18 at 0:25
  • \$\begingroup\$ @LittleHelper I don't think this comment helps lead the user to a particular solution path. Presumably, they're asking here because they don't know how to identify probable causes from the code they have, and have not been able to get better results through their tinkering so far, so they're looking to us to help suggest specific solution strategies. \$\endgroup\$ – DMGregory Dec 12 '18 at 13:53
1
\$\begingroup\$

Since this is a screen-space technique, all the data we have about scene is limited to the G-Buffer, and effect that you are very unhappy about is supposed to be happening due to huge information loss around fragments near the edges of the screen. Usually SSAO has smaller sampling radius so artifacts are not very noticeable.

Also note that in case of screen-space effects, texture wrapping set to GL_CLAMP_TO_EDGE could help to hide some of the artifacts a little.

\$\endgroup\$
  • \$\begingroup\$ thank you for answer. i managed to get very good results for orthographic views and much better for perspective. Are there other techniques to hide these artifacts in first person views. There was a post where it was advised to use world space normals but i cant find it anymore. Maybe some other camera movement tricks etc? \$\endgroup\$ – Mycz Dec 16 '18 at 18:40
  • \$\begingroup\$ @Mycz, yes one of the tricks is reprojection, when you render additional information G-Buffers and project it to the screen for information loss compensation. Or, you can draw just wider G-Buffer with different projection matrix that uses larger FOV than your actual matrix and then reproject it, so information that is normally lost will be slightly extended by FOV overdraw (though overall quality might be lost due to buffer stretch, so you might need to increase G-Buffer resolution). \$\endgroup\$ – Ocelot Dec 17 '18 at 0:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.