-
-
Notifications
You must be signed in to change notification settings - Fork 36k
Recent examples cleanup #8256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recent examples cleanup #8256
Conversation
Thanks! I would revert to black background though. |
|
||
var hdrUrls = genCubeUrls( "../examples/textures/cube/pisaHDR/", ".hdr" ); | ||
new THREE.HDRCubeTextureLoader().load( hdrType, hdrUrls, function ( hdrCubeMap ) { | ||
new THREE.HDRCubeTextureLoader().load( THREE.UnsignedByteType, hdrUrls, function ( hdrCubeMap ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm why is this param now using UnsignedByteType? Doesn't that mean the PMREMGenerator is getting clamped colours?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use half or float, it unpacks the *.hdr maps into float or half buffers as appropriate. If you specify UnsignedByte, it keeps the original RGBE byte encoding and does live decoding within the fragment shader (because texture.encoding = THREE.RGBEEncoding.) RGBE is 8bit per channel, but the E is the exponent. Thus it is 16 bit floating point with a shared 8 exponent in the former:
r = R * 2^ ( E * 255 - 128.0 )
g = G * 2^ ( E * 255 - 128.0 )
b = B * 2^ ( E * 255 - 128.0 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FloatType worked for me on my Windows PC.
I believe it is related to asking for the right extension before using it. You need both OES_texture_float and oes_texture_float_linear available for float, and oes_texture_half_float and oes_texture_half_float_linear for Half support.
I cleaned up the recent tonemapping, transparency and envmap_hdr examples to look better and have better defaults, and more meaningful options. I also fixed one bug introduced by some of my recent PRs being slightly incompatible with each other.
The examples now look like this now: