Shadertoy to babylonjs

Hello Babylonians,

I am trying to re-create a shader from Shadertoy Shader - Shadertoy BETA
to a Babylon shader using the c
but I don’t have a starter point for complex shaders, I did convert a simple one.
so my question is,
is there any starting point resource or any tutorial I can follow to use the shader toy shader in my babylonjs scene ?
and I am searching for a diamond shader if anyone can suggest a good one that was done in babylonjs.

@roland has a very cool one :slight_smile: Diamonds part 6 - Getting serious - Diamond Sphere Demo - Demos and projects - Babylon.js (babylonjs.com)

2 Likes

Yes it’s very cool shader he did, but I am looking for a more realistic one like the one in shader toy, and i was trying to open the node material editor in the demo he did It couldn’t open i think it’s freezing or something

This is raymarching so you would have to understand how sample the surrounding scene to get the reflection data and then do the diamond in a depth sorted post pass or as a custom shader on a inverted box.

1 Like

Sorry if this is terribly naive but should it not suffice to implement the shader inputs (see on Shadertoy at the top above the text editor; expand it) and then copy and paste the shadertoy shader?

I did this once, albeit with a much simpler shader, and just thought that is all. So idk, see if this can help in any way: https://playground.babylonjs.com/#AGZ10W#16

Note: I am almost certain that I took the general idea from another post; so credits to them.

1 Like

I’ve seen this example and tried what he did to create the diamond shader from shader toy but it didn’t work maybe I didn’t do it right or missed something I will be glad if you give it a try with the shader from my shadertoy link :grin: