Skip to content

Render fixes, HDR support, PMREM for correct radiance#133

Closed
jsantell wants to merge 1 commit intomasterfrom
hdr
Closed

Render fixes, HDR support, PMREM for correct radiance#133
jsantell wants to merge 1 commit intomasterfrom
hdr

Conversation

@jsantell
Copy link
Contributor

@jsantell jsantell commented Nov 10, 2018

Added HDR support for background-image

hdr

Generated PMREM for LDR background-images

This generates radiance maps so that rough, yet metallic surfaces, do not reflect the environment directly, but a mipmapped approximation -- notice the difference with the spheres on the right

Before, with a series of metalness (1) spheres, with increasing roughness:

ldr

After:

ldr-pmrem

Generated PMREM for HDR background-image

Before:

hdr2k

After:

hdr-pmrem-spheres

Generated PMREM for default environment

Most likely less useful and probably need more improvements on the default envmap (and caching/coloring), but this is applied here as well:

Before:

default-env

After:

default-pmrem

@jsantell jsantell requested a review from cdata November 10, 2018 15:55
@jsantell
Copy link
Contributor Author

Understandable if wanting to hold off landing this, but should pull out the render fixes at least!

Copy link
Contributor

@cdata cdata left a comment

Choose a reason for hiding this comment

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

This looks gorgeous. However, you already know I'm going to ask for the fixes without the PMREM. Let's file a issue for discussion and planning and keep this PR open. Meanwhile, let's land the rendering fixes as a separate change.

// Materials aren't cloned when cloning meshes; geometry
// and materials are copied by reference. This is necessary
// for the same model to be used twice with different
// environment maps.
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

if (model) {
model.traverse(object => {
if (object.material) {
object.material = object.material.clone();
Copy link
Contributor

Choose a reason for hiding this comment

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

WDYT if clone let us visit each node and decide how to clone it with a callback @mrdoob ?

Could save us a double traversal, but also might be general enough for other use cases

this.applyRoomSize();

// Ensure the model renders after the skysphere
this.model.traverse(obj => obj.renderOrder = 1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is guaranteed to happen, why not do it in the loader traversal where materials are cloned?

@jsantell jsantell mentioned this pull request Nov 11, 2018
@jsantell
Copy link
Contributor Author

Superceded by #237

@jsantell jsantell closed this Nov 27, 2018
@jsantell jsantell deleted the hdr branch November 27, 2018 01:31
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.

Investigate vanishing mesh Support HDR environment maps, and HDR-ify default environment map

2 participants