mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
102.04k stars 35.33k forks source link

Additive Reflection #2559

Closed EmilioDrax closed 11 years ago

EmilioDrax commented 11 years ago

As suggested in this post: http://stackoverflow.com/questions/13067079/additive-reflection-in-three-js i'd like to request additive reflections. If you have a Environment map which is black and white, you sometimes want to have only the whites to lighten your texture up but not the blacks to darken it. Somehow like a specular reflection, but with an Environment map. Or like an additive blending in photoshop.

Thank you guys for your amazing work!

alteredq commented 11 years ago

Hmmm, there have been always some looks that were hard to achieve with cube maps, maybe this would help. We could add additive combine mode for environment mapping.

Could you put somewhere an example of such model and cubemap for testing?

EmilioDrax commented 11 years ago

https://dl.dropbox.com/u/48050531/webgl_loader_obj.html

Left to Right: only Illumination, Reflection: 0.4, Reflection: -0.4 and inverted and crunched Environmentmap (see Stackoverflow)

The third version actually works pretty well...

in this case the goal was to create something like porcelain http://media.treehugger.com/assets/images/2011/10/leo-battistelli-recovered-porcelain-1.JPG

alteredq commented 11 years ago

Cool, thanks. I added a new combine type - AddOperation.

This is how it looks (center one):

https://dl.dropbox.com/u/26786471/tmp/tests/additive-reflection/webgl_loader_obj2.html

mrdoob commented 11 years ago

Yay!

EmilioDrax commented 11 years ago

nice! thanx guys! Looks much better in darker areas and doesn't change the saturation so much

mrdoob commented 11 years ago

Indeed! It's great to finally have additive environment mapping. This is such a common an effective resource in the demoscene ^^