Skip to content
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

Add PBR Next properties API #4330

Merged
merged 4 commits into from
Jul 7, 2023
Merged

Add PBR Next properties API #4330

merged 4 commits into from
Jul 7, 2023

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
Collaborator

@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
Collaborator

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?

@@ -157,6 +163,24 @@ export class TextureInfo implements TextureInfoInterface {
case TextureUsage.ClearcoatNormal:
material.clearcoatNormalMap = threeTexture;
break;
case TextureUsage.SheenColor:
Copy link
Collaborator

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
Collaborator

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
Collaborator

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
Collaborator

@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
Collaborator

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
Collaborator

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
Collaborator

@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
3 checks passed
@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