godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.34k stars 21.06k forks source link

SSAO doesn't play well with smooth shading #8237

Closed Zylann closed 7 years ago

Zylann commented 7 years ago

Tested on Godot 3.0 af282b56feb8d84049f911dd1d91d82bd2211727 Windows 10 64 bits nVidia GeForce 940M

I generated a smooth mesh out of voxels, it looks smooth, but SSAO makes its edges appears anyway:

image

I understand it's based on depth, in which case it will indeed make "edges" stand out. But what's the point of having a smooth mesh then? Is there any way of using the normals to improve this?

Also, borders of the screen got affected by SSAO too, it doesn't looks right.

Could be related to https://github.com/godotengine/godot/issues/8120

reduz commented 7 years ago

This is a known limitation of SSAO, unfortunately there is not much it can be done. You can even see this happen in blockbuster titles like Zelda BOTW. Best you can do is create geometry that is not affected by this, make the SSAO radius bigger or not use SSAO.

Zylann commented 7 years ago

I had a look at Unity terrains which are a soup of triangles like the one I shown, but somehow I don't see such artefacts.

reduz commented 7 years ago

It is most likely related to the SSAO radius, did you try changing it?

On Tue, Jun 13, 2017 at 3:13 PM, Marc notifications@github.com wrote:

I had a look at Unity terrains which are a soup of triangles like the one I shown, but somehow I don't see such artefacts.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/8237#issuecomment-308202463, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-Z26S32rhhSN7bz8icSrXUiR-Im9haks5sDtFCgaJpZM4MxB2u .

Zylann commented 7 years ago

Hmm after more testing with a very similar mesh, Unity does have the same issue, though it looks slightly different (this is an Obscurance image effect with a radius of 0.3, in case it matters):

Enabled: image

Disabled: image

I would even say it looks better even though there are visible edges, not sure how to explain why^^" Maybe that's the gradients...

reduz commented 7 years ago

looks like the same thing you have on Godot with less intensity..