-
Notifications
You must be signed in to change notification settings - Fork 437
Unify texcoord conventions across render targets #3001
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,9 +112,13 @@ class MX_GENSHADER_API GenOptions | |
| ShaderInterfaceType shaderInterfaceType; | ||
|
|
||
| /// If true the y-component of texture coordinates used for sampling | ||
| /// file textures will be flipped before sampling. This can be used if | ||
| /// file textures need to be flipped vertically to match the target's | ||
| /// texture space convention. By default this option is false. | ||
| /// file textures will be flipped before sampling. Set this option when | ||
| /// the target samples images with their origin at the upper left (e.g. | ||
| /// textures uploaded to the GPU in scanline order), compensating for | ||
| /// the lower-left origin of texture space in MaterialX. Leave it false | ||
| /// when the target samples images with their origin at the lower left | ||
| /// (e.g. MDL), or when the client compensates by flipping images | ||
| /// vertically at upload time, as web clients typically do. | ||
| bool fileTextureVerticalFlip; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A suggestion here to be explicit and say what the target orientation is vs "flip". e.g. ORENTATION_LOWER_LEFT, ORIENTATION_UPPER_LEFT. Then a comparison between source (MaterialX) and (renderer) can be made and flip as required. It would be nice to codify MaterialX lower left orientation somewhere in any case. If the plans to support USD input graphs (or other) goes forward the default uv convention could be different.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for this suggestion, @kwokcb, and I agree that the MaterialX convention deserves to be codified more visibly, with the expanded documentation of this option being a first step in that direction. I see the appeal of expressing the target as an orientation rather than a flip, though since On the source side, my sense is that we should keep the MaterialX convention fixed rather than configurable, and this changelist is intended as a step in that direction: geometry loaders normalize texture coordinates to the MaterialX convention at load time, so that shader generation only needs to account for the image orientation of its target. I'd anticipate a future OpenUSD importer following the same pattern, converting texture coordinates at import time if needed, though USD conveniently places its texture origin at the lower left as well. |
||
|
|
||
| /// An optional override for the target color space. | ||
|
|
||
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.
As any geometry loader could be used to load geometry this may not be always true.
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.
That's a good point, and we should remain flexible about this in the future, though as of today the web viewer loads geometry exclusively through the three.js GLTFLoader, where the glTF convention holds.