Funky bubbles and standard fragment shaders

I’d like to create a “bubble of gas” and already have a vertex shader that looks pretty good: https://playground.babylonjs.com/#7P2U64#6

I was hoping to reuse a standard material fragment shader to give the bubble its 3D shading and not have to define it or do any special update calls on the shader material, like to set the camera and light positions. Is there any way to do this?

Alternatively as I know nothing (yet) about writing funky fragment shaders, then any help with that would be great! :grin: Thanks everyone!

1 Like

I’ve played around with the fragment shader a bit and have a kind of vertical gradient working though it has artifacts (I assume from the IcoSphere) and doesn’t really feel very curved yet: https://playground.babylonjs.com/#7P2U64#7

Still would prefer to use the standard material’s fragement shader if possible to not have to reinvent the wheel.

You might find the CustomMaterial class useful for this (API doc, examples). Maybe something like below for example. :slight_smile:

4 Likes