playcanvas / engine

Powerful web graphics runtime built on WebGL, WebGPU, WebXR and glTF
https://playcanvas.com
MIT License
9.73k stars 1.36k forks source link

[BREAKING] Refactor API for gammaCorrection, toneMapping and Fog settings #7101

Closed mvaligursky closed 1 week ago

mvaligursky commented 2 weeks ago

Breaking changes:

gammaCorrection and toneMapping

Before, those were properties of the scene.rendering:

Scene.rendering.gammaCorrection
Scene.rendering.toneMapping

But these are now per camera:

CameraComponent.gammaCorrection
CameraComponent.toneMapping

exmple

 cameraEntity.addComponent('camera', {
    toneMapping: pc.TONEMAP_ACES
});

Fog parameters

Before, those were properties of the scene.rendering:

Scene.rendering.fog // fog type
Scene.rendering.fogColor, fogStart, fogEnd, fogDensity

Now these are in its dedicated FogParams module, available on the Scene:

Scene.fog.type
Scene.fog.color, start, end, density

The fog can be also overriden on the CameraComponent, where FogParams instance can be assigned:

CameraComponent.fog = new ForParams();
CameraComponent.fog.type = ..;
CameraComponent.fog.start = ..;

Other changes