MirrorTexture reflects the background color of the scene by default, how to remove this feature

RT.

One way to do it is to assign a new clear color for your mirror material. Something like this:

1 Like

But diffuseTexture is invalid…

What do you mean by invalid? I didn’t touch it and it does not throw any error.
If by ‘invalid’ you mean that you cannot see it, that’s because obviously with a black clear color you cannot see it anymore. Use a neutral light gray, like this:

This still doesn’t fundamentally solve the problem I’m talking about, it will mix in the unwanted color

But still thank you

Well, it mixes with the clear color because of the setting of the diffuseTexture in the node material.
Where this ‘lava’ I believe material uses a color4 diffuse with alpha.
You have two choices here.

  1. EZ enough you can make the clearColor of your mirrorMaterial white, like this:
    https://playground.babylonjs.com/#45R5JK#778

  2. Edit the node material and make the diffuse opaque OR add an opacityTexture OR add a neutralColor OR anything you can imagine with a NM. I cannot list all of the ways you can achieve this. I also don’t know what FX exactly you want to achieve.

Still, hope this helps and meanwhile, have a great day :sunglasses:

1 Like

By debugging I found that clearcolor is more like a controller:

0,0,0-------->get black
1,1,1-------->get diffuseTexture’s style
other-------->mix?



1 Like

Kind of but not just exactly.

clearColor simply uses color3 values. It does not have an alpha. It adds color on top (to clear it).

Where you entered 255/255 for all of RGB, is equal to #FFFFFF and equal to #FFFFFFFF and equal to White. The clearColor is plain solid white and this is why the diffuse texture shows unaltered on top of it.

Where you entered 0 for all of RGB is equal to #000000 and #00000000 and equal to Black.
Reason why an underlying diffuseTexture or color will simply not display.

The other values you can enter will ADD to the color and ‘tint’ the texture (as shown in your 2nd pict).

Maybe we can handle this in another way,i just created a new topic

Indeed. As, I said there are many ways. I didn’t mention shaders because I don’t master them. :slightly_frowning_face: May be one day… :thinking:
Thanks for sharing and have a great day :sunglasses:

I got another way to do this from another topic.

   XXX : var backgroundMaterial = new BABYLON.BackgroundMaterial("backgroundMaterial", scene);  
   √√√ : var backgroundMaterial = new BABYLON.StandardMaterial("backgroundMaterial", scene);