Diamond shader from unity to Three.Js

Hi! I’m trying to turn this Diamond shader from Unity into a Three.js implementation. In the first step I need to bake the objects face orientation of the model into a cubemap but I can’t find a way to do so. Any help with this would be greatly appreciated! Thanks a lot.

i have one example based on jesper vos’es work. i tried to refactor it a little, you find the source in the /diamonds folder. it’s a tripple render with a refraction and a backface shader. the materials you can use as-is, inspect the useFrame function in the diamonds component, this tells you what you have to do in the render loop. all that it would need to get you to the unity result is bloom/glow.

fullscreen: https://f1ixt.csb.app/
sandbox: Moksha - CodeSandbox

1 Like

Looks good! Unfortunately that’s not exactly what I’m looking for, I’d like to emulate the multiple (like 5) bounces inside the diamond