Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
139 stars 2 forks source link

Fog Volume doesn't interact well with transparency and UIX #791

Open jae1911 opened 11 months ago

jae1911 commented 11 months ago

Describe the bug?

Fog volumes will appear normally, even when behind any kind of UIX (video players / inspectors).
Modifying the render queue will resolve the issue but will render the fog volume completely transparent agains transparent materials and UIX.

To Reproduce

  1. Developer tooltip
  2. Create new -> Object -> Fog Volume -> Additive
  3. Spawn a video player / inspector / any kind of UIX
  4. Place the fog volume behind the video player / inspector / UIX
  5. Fog volume will be visible at all times
  6. Inspect fog volume
  7. Set RenderQueue to 0
  8. Fog volume is now hidden by UIX but also by transparent materials

Expected behavior

The fog volume should be hidden by those objects, but not by transparent materials.

Screenshots

Fog volume halfway through transparent material and behind UIX.

i_view64_arnYYjxREz

Same setup, with RenderQueue set to 0.

i_view64_qZkQ9QUBJk

Resonite Version Number

2023.11.25.49

What Platforms does this occur on?

Windows

What headset if any do you use?

Valve Index; Desktop

Log Files

J4 - 2023.11.25.49 - 2023-11-25 08_25_33.log

Additional Context

No response

Reporters

j4 | j4.lc (Discord)

lxw404 commented 11 months ago

I run into this issue all of the time which causes a lot of strife building environments where you want the right kind of light falloff and atmosphere. In addition, fog just sometimes renders through absolutely everything.

What might be a small improvement is for all types of volume materials to have the ZTest property exposed with a specific condition so that it doesn't just bleed through objects at a distance if you really don't want that behavior.

Geenz commented 11 months ago

This is something I wanna figure out at some point.

Frooxius commented 11 months ago

I think this one might be a bit tricky or nearly impossible with how the fog volumes work, I wouldn't classify this as a bug, it's just more of a consequence of how they work.

They are using the depth buffer to determine how much fog there should be. But generally only opaque items render into the depth buffer.

This means that the fog volume has no information about anything transparent in the scene - you can either render it fully in front of transparent things or behind them.

One approach would be to use something like depth peeling - depth buffers that store multiple values in a way. But that would significantly increase performance requirements across the board.