Try / OpenGothic

Reimplementation of Gothic 2 Notr
MIT License
1.16k stars 84 forks source link

Water shader issues #388

Closed Nindaleth closed 1 year ago

Nindaleth commented 1 year ago

I'm not sure if this is related to #261 or to #380 or it stands on its own, hence creating a separate issue. There are several cosmetic issues that only appear when water is involved, all of which were reproduced as of 588f099119e6b8ed30ff3f18328de81df887af24 in or near the harbor:

Try commented 1 year ago

Hi, @Nindaleth !

Those issue can be separated into 2 categories:

  1. Reflections: those are expected artifacts of SSR shader
  2. Underwater(diving) effects - those are unimplemented yet
dreimer1986 commented 1 year ago

dbg Another one I ran into recently and was quite easy to separate from the "how it should look" state. Should be the close-ish objects aka number three of the list of @Nindaleth

Try commented 1 year ago

Some thoughts about water in general:

  1. Need to decouple absolution and reflectance into 2 different shaders.
  2. Reflectance should have 2-3 variants;
    • Sky only
    • SSR
    • RayQuery (ray-tracing will fix this issue, right? :) )
  3. Need a decent way to synthesize water displacement After checking bunch of sources - exp(sin(x)) seem to be good at small frequencies and Gerstner at high
  4. Need to throw tessellation away: tessellation is unsupportable mess. Mesh shader would be more convenient
Try commented 1 year ago

Current progress on waves: изображение

dreimer1986 commented 1 year ago

Looks so realistic that looing at the pic makes the brain think it's moving. I like em.

Btw, be careful with waves getting too massive if water gets the same shader everywhere in the game. https://github.com/Try/OpenGothic/commit/9d365273ccf6e67e7551e49a8912aa1e9452db12 made lil rivers look like a hell of a storm is moving along over them. Just found out yesterday and did not have time to report yet.

Try commented 1 year ago

Water surface: изображение

Underwater: изображение

Offended view, in pirate camp: изображение

Offended view in harbor: изображение изображение

For underwater case, there is clear lack of scattering component, since it's too tricky to estimate water depth. Also, just realize that I don't want to do ray-tracing version :D