OpenGothic icon indicating copy to clipboard operation
OpenGothic copied to clipboard

Screen space reflections look bad on swamp water

Open hwnde opened this issue 1 year ago • 4 comments

Swamp water seem to use the same SSR shader as regular water which doesn't look good with Jarkendar swamp. First, there are lots of trees there which means severe pop-in and pop-out when you turn the camera. Second, the shader assumes that there is a clear sky above which is not true for swamp since thick vegetation obstructs the sky.

I think SSR should be disabled for swamp. Realistically swamp water shouldn't be able to reflect much because of dirt. Screenshot 2024-03-01 213735

hwnde avatar Mar 02 '24 05:03 hwnde

Hi, @hwnde !

I think SSR should be disabled for swamp.

Sure, but how? Only useful information engine has is the Material::group - so we know that it's a water. From semi-useful data there is a texture (green'ish on swamp, blue on ocean) - this is not in use as not applicable for ocean and rivers.

Try avatar Mar 02 '24 15:03 Try

So texture is something that we could potentially use to branch the logic, correct? Another approach is to implement ray traced reflections.

hwnde avatar Mar 02 '24 23:03 hwnde

He are examples of textures: ocean: 0x000002047f7699b0 swamp: 0x000001ce22f71610

Naturally there are problems. This is a single texture, that does not represent any of material properties. Using them as specular - works for swamp, probably, but not for ocean. Using them for transmittance - OK, but doesn't solve anything for SSR

Another approach is to implement ray traced reflections

Ray-tracing, in current gen of api's, is very awkward to use. It give us a 'hit', but then engine would have to evaluate(expensive) color at the hit-point. Animation is also something what doesn't just works. And even if we solve RT - this is only small subsets of GPU's.

Try avatar Mar 03 '24 18:03 Try

Did some experiments - I tried overriding alphaFunc for specific materials. The best results seem to be produced with Multiply - looks very close / identical to the original.

Screenshot 2024-03-04 214811

hwnde avatar Mar 05 '24 06:03 hwnde

The best results seem to be produced with Multiply - looks very close / identical to the original.

Multiply, while maybe works for swamp case, but completely ruins effect in open areas, such as harbor
изображение

Main issue is still stands - engine need to be aware, if sky is reachable, similar to sky-occlusion maps in modern engines

Try avatar Apr 01 '24 13:04 Try