Change the color/brightness of the DefaultEnvironments reflectionTexture

Hello Forum <3

Is there a way to change the color/brightness of the defaultEnvironment-skybox-reflectionTexture?

The default Environment is a simple way to create all needed environment effects, but it is a little… ORANGE :smiley: So the effect this has on all objects in the scene is also a little orange, and I’d like to change that.

Is there a way to simply change the tone of the reflectionTexture without uploading a custom texture as a replacement?

const environment = scene.createDefaultEnvironment();
//environment.skyboxMaterial.reflectionTexture <---------

I’d like to change the color tone of this texture (at least i think that this texture effects the color of the objects in my scene)

Thank you for any help!

chatGPT sometimes dreams, I hope this time it gives you answer nearby the truth…

Yes, you can change the color and brightness of the defaultEnvironment’s skyboxMaterial.reflectionTexture without uploading a custom texture by modifying the BaseTexture’s level and toneMappingColor properties.

The level property controls the overall brightness of the texture, while the toneMappingColor property applies a color correction to the texture. By modifying these properties, you can adjust the tone and brightness of the skybox reflection in your scene.

Here’s an example of how you can modify the reflectionTexture in your code to adjust the tone and brightness:

arduinoCopy code

const environment = scene.createDefaultEnvironment();
const reflectionTexture = environment.skyboxMaterial.reflectionTexture;

// Adjust the brightness of the reflection texture
reflectionTexture.level = 0.5; // Reduce brightness by 50%

// Adjust the color tone of the reflection texture
reflectionTexture.toneMappingColor = new BABYLON.Color3(1.0, 0.5, 0.2); // Apply an orange color tone

In the above code, I’ve reduced the brightness of the reflection texture by 50% and applied an orange color tone to the texture by setting the toneMappingColor property to a new Color3 instance with RGB values of (1.0, 0.5, 0.2).

You can experiment with different values for these properties to achieve the desired tone and brightness for your scene’s reflection texture.

Yet another great hallucination from ChatGPT :slight_smile: toneMappingColor does not exist on our texture class.

@Sarrus4x4 I would advise to use another HDR texture instead as it might be the best way to achieve your goal. There are lot of them on HDRIs • Poly Haven for instance and you could use this technique to convert into a .env within the sandbox for instance Using An HDR Environment For PBR | Babylon.js Documentation.


Thank you both :smiley:

I guess I’ll use a custom HDR as you suggested :slight_smile:

1 Like

May be it’s about to exist and you don’t know about it. :grin: In which case, I would call it ‘anticipation’. WoW that thing can even anticipate features that do not (yet) exist. Amazing :joy:

1 Like