Undersea caustic

Hi all,

I am trying to mount a underwater scene and an effect I did not found in samples or docs are caustic! Somebody knows how to do it or can point a way?

Thanks

I’m not sure if the engine currently has a caustic implementation

I’d start with using a spotlight & caustic reflection projection texture to try and mimic the effect, but that may only work with simple geometry, due to deformation due to the projection…

@Deltakosh, can you think of a better way to do this?

Maybe relying on the emissive texture to highlight a bit some of the area ?

1 Like

@Drigax
I did go for this way, using an “fireProceduralTexture” for projection texture and it work, but like you said we are limited by the projection limits!

@sebavan
I will try to do it with the procedural texture too!

Thanks

I am not sure if something like this can help you.

https://playground.babylonjs.com/#H0QHVK#1

It’s basically and image of caustic with some properties “animated”. It has issues (after a while it get’s too stretched, so you probably have to setup some constraints, something like if it goes over some value, start reversing animation or something like that) Or you can animate some other property, maybe even change coordinates mode of the texture or something like that.

With some proper lighting (and volumetric light like on image) it probably can look nice.

image

1 Like

@nogalo
Thanks I will consider this too!

https://www.babylonjs-playground.com/#LFYUSY#23

I can’t give you the fully finished one because its not really mine to give away… but I’m sure you can work this one out.

We ended up getting it implemented with instances and animations, but this was kinda early in my webgl career so it might not be as good as it could be.

I kinda used a mash-up of a bunch of references from shadertoy, but it was quite a bit of customization as well so if you use it please be so kind as to shout me out in the code. @NRA

6 Likes

@Pryme8

OMG this is amazing!
Sure you deserve credits for it!
And I believe that can help many others too!
Thanks so much, this will save me too much time!

No problem, come across any other problems you are stumped on and I’d be glad to help.