Y Inverted DynamicTexture in Photodome

Hello everyone,

I need to draw on the texture of a photodome from the texture coordinates corresponding to those pointed by the mouse. To do that I replace the texture generated by the Photodome constructor with a dynamic texture.

I almost managed to achieve what I wanted, the only problem is that when I set the dynamic texture to the dome, it is upside down.

I tried to play with parameters like “useDirectMapping” in the dome constructor, or the invertY parameter in the texture options, but either the texture is upside down, or it is the texture coordinates that are inverted (and thus the drawing gets inverted and does’nt follow the mouse anymore)

I feel like I could cheat with some math to “compensate” that effect, but I was hoping there would be a cleaner/simpler solution that I missed.

Here is a playground to illustrate the problem : Photodome drawing | Babylon.js Playground (babylonjs.com)

Thank you for your help !

dynamicTexture.wAng = Math.PI

Example - https://playground.babylonjs.com/#14KRGG#995

(seems that drawing is broken though).

Thank you for your suggestion, I didn’t try this one, unfortunately the drawing is indeed broken :cry:. I also tried to set vScale to -1 but the result is the same.

https://playground.babylonjs.com/#14KRGG#997 should work

1 Like

Indeed it is ! :trophy:

For those who might wonder : just writing dynamicTexture.update(false) instead of dynamicTexture.update() was enough to solve the case (‘false’ corresponding to the invertY parameter).

I wasn’t aware of this parameter in that context. I’m not sure to understand why it is true by default though.

Thank you for your help ! :smiley:

1 Like