-
Notifications
You must be signed in to change notification settings - Fork 815
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
Conversation
Missing: iridescene, next commit anisotropy, not supported by three.js yet.
Hi Emmett, |
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.
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, |
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.
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: |
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.
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); | ||
} |
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 this reused, consider a function.
private[$transmissionTexture]!: TextureInfo; | ||
private[$thicknessTexture]!: TextureInfo; | ||
private[$specularTexture]!: TextureInfo; | ||
private[$specularColorTexture]!: TextureInfo; |
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.
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?
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.
Maybe this map approach is better?
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.
Much improved, thanks!
private[$thicknessTexture]!: TextureInfo; | ||
private[$specularTexture]!: TextureInfo; | ||
private[$specularColorTexture]!: TextureInfo; | ||
private[$pbrTextures]!: Map<TextureUsage, TextureInfo>; |
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.
You can skip the !
by creating it right here, see $variantSet
above.
textureInfoFromUsage(TextureUsage.Transmission); | ||
textureInfoFromUsage(TextureUsage.Thickness); | ||
textureInfoFromUsage(TextureUsage.Specular); | ||
textureInfoFromUsage(TextureUsage.SpecularColor); |
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.
💯
nit: maybe createTextureInfo
? FromUsage is already clear from the input type.
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.
Thanks, LGTM.
* Add PBR Next properties API Missing: iridescene, next commit anisotropy, not supported by three.js yet. * Cleanup code * Fix for cleanup bug * nits
Missing:
iridescene, next commit
anisotropy, not supported by three.js yet.
Reference Issue