Ethereal-Software / virtual-world

Virtual world interaction
0 stars 0 forks source link

Mapping color space #18

Open RoddoWasHere opened 4 years ago

RoddoWasHere commented 4 years ago

https://www.youtube.com/watch?v=2IITte79Tic

Color space theory:

linear space represents all the color values within the space (gamma: 2.2) sRGB space represents a perceivable portion of the color space perceivable on the medium (gamma: 1)

in 3D we use a linear work flow

lighting: 1.0, materials 2.2 (default) ...apply gamma 2.2 to lighting, result: lighting: 2.2, materials 4.4 -> materials appear washed out ...first fix gamma on materials: lighting: 1.0, materials 1.0 (correct linear space image, i.e. contains correct data, but looks wrong) [HRD, EXR, 32bit] lighting: 2.2, materials 2.2

Therefore: we work in linear color space, i.e.

Example:

Here we have a photo (in sRGB) relatively unfilter, we can use this to work back to this result: image

now we apply a gamma 0f 0.45 to convert to linear color space: image

We can now sample colors from here which will then result in the correct colors in sRGB

//set output encoding
renderer.outputEncoding = THREE.sRGBEncoding;

//set exposure
rendere.toneMappingExposure = 1;

VirtuCon