# Shader material from threejs drei

**URL:** <https://forum.babylonjs.com/t/shader-material-from-threejs-drei/43723>\
**Category:** Questions\
**Tags:** material, shader\
**Created:** [August 31, 2023, 1:31pm UTC](https://forum.babylonjs.com/t/shader-material-from-threejs-drei/43723 "2023-08-31T13:31:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mostafa\_Salloum](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mostafa_salloum/32/13074_2.png) [@Mostafa\_Salloum](https://forum.babylonjs.com/u/Mostafa_Salloum)\
**Post date:** [August 31, 2023, 1:31pm UTC](https://forum.babylonjs.com/t/shader-material-from-threejs-drei/43723/1 "2023-08-31T13:31:34Z")

</div>

Hello guys,  
I want to use this shader [https://github.com/pmndrs/drei/blob/master/src/materials/MeshRefractionMaterial.tsx](https://github.com/pmndrs/drei/blob/master/src/materials/MeshRefractionMaterial.tsx)  
in my babylon scene is it possible to do that?

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [August 31, 2023, 3:46pm UTC](https://forum.babylonjs.com/t/shader-material-from-threejs-drei/43723/2 "2023-08-31T15:46:38Z")

</div>

In theory it’s possible, as in the end it’s only shader code.

However, you will have to know a bit of Threejs and Babylon.js to know how things work in both engines and to port the code to Babylon.

Also, in this case, there are additional complexities because the code is using a BVH structure to compute intersections, so you will also have to port the code that build this structure, which is coming from [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh/tree/master). As you can see, there’s a bit of code there, so it’s definitely not a small task to port this refraction shader to Babylon.
