Skip to content

Conversation

bhouston
Copy link
Contributor

@bhouston bhouston commented Mar 1, 2016

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:

image

image

image

mrdoob added a commit that referenced this pull request Mar 1, 2016
@mrdoob mrdoob merged commit ce31853 into mrdoob:dev Mar 1, 2016
@mrdoob
Copy link
Owner

mrdoob commented Mar 1, 2016

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 ) {
Copy link
Contributor

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?

Copy link
Contributor Author

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 )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, good to know.

Switching it to FloatType produces errors on Windows (ANGLE maybe?). FloatType works fine on OSX.

Error: WebGL: generateMipmap: Texture at base level is not unsized internal format or is not color-renderable or texture-filterable.

blackuv

Copy link
Contributor Author

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.

@bhouston bhouston deleted the recent_examples_cleanup branch March 14, 2016 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants