# Is it possible to use video as a mesh reflection?

**URL:** https://forum.babylonjs.com/t/is-it-possible-to-use-video-as-a-mesh-reflection/56582
**Category:** Questions
**Tags:** material
**Created:** [February 14, 2025, 1:59pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-video-as-a-mesh-reflection/56582 "2025-02-14T13:59:02Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![vlayd16](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vlayd16/32/32660_2.png) [@vlayd16](https://forum.babylonjs.com/u/vlayd16)
#### Post date: [February 14, 2025, 1:59pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-video-as-a-mesh-reflection/56582/1 "2025-02-14T13:59:02Z")

</div>

**Hi team,**

I wanted to check if it’s possible to display any video as a reflection texture for the mesh material.

> **[Babylon.js Playground](https://playground.babylonjs.com/#1BYH8W%234)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

Something like this, but I want the mesh to have its own material—just with a video reflection instead of an environment reflection. Maybe even a video environment.

@Evgeni_Popov

---

<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: [February 14, 2025, 4:41pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-video-as-a-mesh-reflection/56582/2 "2025-02-14T16:41:15Z")

</div>

You can assign the video to the reflection texture, and set the right coordinate mode to `coordinatesMode`:

> **[Babylon.js Playground](https://playground.babylonjs.com/#1BYH8W%2395)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

---

<div class="post-metadata">

### Author: ![vlayd16](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vlayd16/32/32660_2.png) [@vlayd16](https://forum.babylonjs.com/u/vlayd16)
#### Post date: [February 17, 2025, 9:15am UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-video-as-a-mesh-reflection/56582/3 "2025-02-17T09:15:59Z")

</div>

Awesome, that works.  
My only last question is that texture scaling doesnt seem to work in Projection mode:

> **[Babylon.js Playground](https://playground.babylonjs.com/#1BYH8W%2396)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

---

<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: [February 17, 2025, 10:22am UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-video-as-a-mesh-reflection/56582/4 "2025-02-17T10:22:30Z")

</div>

Yes, that’s how this coordinate mode works. You can try to provide your own reflection matrix by overriding the `Texture.getReflectionTextureMatrix` method:

> **[Babylon.js Playground](https://playground.babylonjs.com/#1BYH8W%2398)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

I simply copied/pasted the bits of [Babylon.js/packages/dev/core/src/Materials/Textures/texture.ts at master · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/core/src/Materials/Textures/texture.ts#L775-L845) which correspond to the “Projection” mode, and factored the uScale/vScale properties in the projection matrix.

---

<div class="post-metadata">

### Author: ![vlayd16](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vlayd16/32/32660_2.png) [@vlayd16](https://forum.babylonjs.com/u/vlayd16)
#### Post date: [February 17, 2025, 12:00pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-video-as-a-mesh-reflection/56582/5 "2025-02-17T12:00:52Z")

</div>

Thank you! Works perfect

---

<div class="post-metadata">

### Author: ![vlayd16](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vlayd16/32/32660_2.png) [@vlayd16](https://forum.babylonjs.com/u/vlayd16)
#### Post date: [February 21, 2025, 9:12am UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-video-as-a-mesh-reflection/56582/6 "2025-02-21T09:12:33Z")

</div>

How would it be possible to rotate video texture with TEXTURE\_FIXED\_EQUIRECTANGULAR\_MODE

> **[Babylon.js Playground](https://playground.babylonjs.com/#1BYH8W%2399)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

I tried different option, but got no result.

The second option I wanted to try is to rotate TEXTURE\_SPHERICAL\_MODE  
Even though that code works, but it appears that it actually rotates the sphere instead of charging the texture position, I just want to rotate the video by 30-180 degrees so that right corner of the video is in the center of the sphere

> **[Babylon.js Playground](https://playground.babylonjs.com/#1BYH8W%23100)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

@Evgeni_Popov

---

<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: [February 21, 2025, 10:01am UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-video-as-a-mesh-reflection/56582/7 "2025-02-21T10:01:02Z")

</div>

You can try to update our projection shader code to take into account some offsets.

Here’s one way to do it for the fixed equirectangular case:

> **[Babylon.js Playground](https://playground.babylonjs.com/#1BYH8W%23101)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

The projection code is in the `reflectionFunction.fx` file, so I simply copy/pasted this code in the PG and added a `opOffsets` uniform to the `computeFixedEquirectangularCoords` function, which is added to the longitude/latitude calculated lines 135/136. A material plugin is used to set values to this uniform.

---

<div class="post-metadata">

### Author: ![vlayd16](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vlayd16/32/32660_2.png) [@vlayd16](https://forum.babylonjs.com/u/vlayd16)
#### Post date: [February 21, 2025, 2:04pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-video-as-a-mesh-reflection/56582/8 "2025-02-21T14:04:10Z")

</div>

Awesome, worked for me!
