How to render a diamond properly with three js

I am trying a render a diamond with three js. I tried using refraction envMap but the result is not so good. I tried using the texture of the diamond itself. But it looks more like a glass in diamond shape. i also tried the fresnel shader but the result is not even near what i expect

Can anyone suggest me way do it correctly?

Reminded me about this showcase: Real Time Diamond Rendering


Unfortunately, the code is not open source.


Maybe this official example is a good starting point:

1 Like

I tried it but it’s more like the glass efect and i’m trying with refraction :

Sorry for the absense,
I got the perfect effect of diamond on a three js example with TorusKnotBufferGeometry.
when i put the refraction envMap and a map with same texture of diamond…
i uploaded it to a github repo -

Can anyone check it please?
if i set the color to white, envMap to refraction, map and alpha map to the texture, it shows a excellent result
but when i tried to load the diamond.obj with OBJLoader.js from models folder, it does show the refraction but not the map. map texture is actually necessary to give it the look of a diamond. i’m not a advanced user of three js.

Can anyone help please?

diamond.obj does not have any texture coordinates so using it with textures does not work. diamond2.obj defines texture coordinates but all uv pairs have the same value 0.000000 1.000000. Texture mapping won’t work with these vertex data, too.

1 Like

Then how can i construct a model with the properties it needed to put texture map corrcetyly?

You should author the 3D model in a tool like Blender and ensure that the texture is correctly projected onto the geometry. There are many existing tutorials that explain the process of uv-editing. Just give Google a try :wink:

1 Like

I will try it now, diamond2.obj i took from another site but diamond.obj i made in blender. i just took a cylinder then sub part it. The problem might occur when i added glass bswf material on it. then i exported it. i don’t have idea on uv editing, but i’ll search that.
Thank you

1 Like