Implementing Caustics
Asked Answered
K

2

0

Hello, I'm working on a underwater simulator for ROVs (or that least that is the excuse I'm using to learn Godot). Right now I'm trying to implement a caustics shader.

I have it mostly working. I generate voronoi noise, modify it a little, and apply it as a light shader. The issue with this approach is that the shader affects all the lights. I put a mix in there to try to balance caustics and regular lightning, but that didn't solve the issue properly.

The caustics look ok:

But when I turn the ROV lights on, they are also affected by the shaders. In this area the ship wreck casts a shadow, so the only lightning present should be from the ROV (and yes, my shadows need tuning): https://gfycat.com/braveellipticalfugu

I have three main questions:

  1. Is this even the right approach?
  2. Is there a way to tell which light is currently running so I can run only the directional light through the caustics shader?
  3. Will I have to apply this light shader independently to each material for each object underwater?

Thank you in advance!

Kirven answered 10/5, 2020 at 20:52 Comment(0)
K
0

I ended up filtering the light by checking if the light vector has the same direction as I have set for the directional light.

My plan now is to turn the light part into a custom visual shader node and use it in all my underwater materials.

Kirven answered 13/5, 2020 at 18:26 Comment(0)
L
0

Hi, would you mind posting the source code or share how your caustics work? I've been working on my own water shader and they are probably the last missing piece

Lupercalia answered 5/2, 2022 at 17:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.