Hello everybody, just trying to set the color of mesh instance via setParameter('material_diffuse', [0, 0, 0] and is produces quite different results comparing to meshInstance.material.diffuse = new pc.Color(); meshInstance.material.update():
Am I doing it wrong? What may affect the colors here (checked the scene lighting, skybox, emissive)?
The colors are specified in gamma space, and internally for rendering using uniforms, those are converted to linear space by the standard material.
But this does not happen when setting on MeshInstance, and you are responsible for setting a uniform values directly. And so you need to do a gamma correction yourself.
Just in case, is there a way to extract the gamma correction power factor (defaulting to 2.2) from the engine instead of hardcoding? Get a value based on app.scene.gammaCorrection ?
I see there are different presets for the gamma value in the engine ( pc.GAMMA_SRGB, pc.GAMMA_SRGBFAST, pc.GAMMA_SRGBHDR etc), where can I check the actual gamma power values?
EDIT: ah, I see now it’s hardcoded to 2.2 in the standard-material.js