Skip to content

Add PBR Next properties API#4330

Merged
diegoteran merged 4 commits intomasterfrom
next
Jul 7, 2023
Merged

Add PBR Next properties API#4330
diegoteran merged 4 commits intomasterfrom
next

Conversation

@diegoteran
Copy link
Collaborator

Missing:
iridescene, next commit
anisotropy, not supported by three.js yet.

Reference Issue

Missing:
iridescene, next commit
anisotropy, not supported by three.js yet.
@diegoteran
Copy link
Collaborator Author

Hi Emmett,
Can you take a look at this first pass and recommend what to test/change?

Copy link
Contributor

@elalish elalish left a comment

Choose a reason for hiding this comment

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

I just realized you haven't added any of your earlier APIs into our editor yet. You may want to do that first to verify everything is working well before you get too far along with the rest.

onUpdate,
TextureUsage.SheenColor,
null,
correlatedMaterials,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a helper function to removed some duplication?

case TextureUsage.ClearcoatNormal:
material.clearcoatNormalMap = threeTexture;
break;
case TextureUsage.SheenColor:
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't love this huge switch statement - if you can think of a cleaner way to architect this, I'm open to it, but only if you're feeling inspired.

color.fromArray(rgb);
} else {
color.set(rgb as ColorRepresentation);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If this reused, consider a function.

private[$transmissionTexture]!: TextureInfo;
private[$thicknessTexture]!: TextureInfo;
private[$specularTexture]!: TextureInfo;
private[$specularColorTexture]!: TextureInfo;
Copy link
Contributor

Choose a reason for hiding this comment

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

I really hate symbols, but they're only necessary directly in a publicly-accessible object. Maybe we can assemble these into a single object and just have one symbol instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe this map approach is better?

elalish
elalish previously approved these changes Jul 5, 2023
Copy link
Contributor

@elalish elalish left a comment

Choose a reason for hiding this comment

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

Much improved, thanks!

private[$thicknessTexture]!: TextureInfo;
private[$specularTexture]!: TextureInfo;
private[$specularColorTexture]!: TextureInfo;
private[$pbrTextures]!: Map<TextureUsage, TextureInfo>;
Copy link
Contributor

Choose a reason for hiding this comment

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

You can skip the ! by creating it right here, see $variantSet above.

textureInfoFromUsage(TextureUsage.Transmission);
textureInfoFromUsage(TextureUsage.Thickness);
textureInfoFromUsage(TextureUsage.Specular);
textureInfoFromUsage(TextureUsage.SpecularColor);
Copy link
Contributor

Choose a reason for hiding this comment

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

💯
nit: maybe createTextureInfo? FromUsage is already clear from the input type.

Copy link
Contributor

@elalish elalish left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM.

@diegoteran diegoteran merged commit a86ac42 into master Jul 7, 2023
@diegoteran diegoteran deleted the next branch July 25, 2023 20:25
JL-Vidinoti pushed a commit to vidinoti/model-viewer that referenced this pull request Apr 22, 2024
* Add PBR Next properties API

Missing:
iridescene, next commit
anisotropy, not supported by three.js yet.

* Cleanup code

* Fix for cleanup bug

* nits
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.

2 participants