Real-time preview of your CAD deliveries. Drop a .glb below to see how it renders. Adjust metal, lighting environment, and diamond material to test the model in different conditions.
three-mesh-bvh. Wrap the mesh in a ShaderMaterial whose fragment shader is given the BVH as a uniform texture. Per pixel, cast the view ray, refract at the first facet (Snell's law with ior=2.42), then trace up to N bounces against the BVH. Any bounce that fails Snell's condition becomes internal reflection. The final direction samples the HDRI equirect map. Chromatic aberration is faked by tracing red/green/blue with slightly offset IORs. This is the same technique as drei's MeshRefractionMaterial — I've inlined a working shader version rather than trying to consume the drei source directly.