This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

Implementing Caustics

williangalvaniwilliangalvani Posts: 2Member

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!

Comments

  • williangalvaniwilliangalvani Posts: 2Member

    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.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.