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
AO Detail Map #5270
AO Detail Map #5270
Conversation
Hi @Mistale, Sorry for our slow response on your PR - it's awesome, so we'll review/test/merge real soon. Thanks!! |
* @property {number} aoDetailMapRotation Controls the 2D rotation (in degrees) of the detail | ||
* (secondary) AO map. | ||
* @property {string} aoDetailMapChannel Color channels of the detail (secondary) AO map | ||
* to use. Can be "r", "g", "b" or "a". |
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.
This should mention the default value is 'g'
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.
Is it common to use default value 'g' instead or 'r' in other similar properties?
We should avoid making assumptions of how artist should pack their channels, even as a default option while it is configurable.
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.
We don't seem to have that mentioned elsewhere in the docs, but we do set 'g' as the default channel in the material. It should be down to how textures are packed, surely, unless there is some bit depth favor for green channels (which would make sense perceptually) for certain file formats?
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've added a clarification about the default value. I can't figure out why 'g' is the default for ao either, but I figured I'd just follow the same standard as aoMapChannel
.
When packing ORM-textures for glTF, "r" is used for occlusion. But it may be related to inherent precision issues as @GSterbrant mentions.
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'm approving this, with a small JSDocs suggestion, but would like @GSterbrant to have a look as well.
My question is regarding the aoDetailMode parameter - did you find this useful when testing, versus just using one fixed way to blend those ao maps?
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.
Looks good! Just remember to update the chunk API version to 1.63 before merge.
It does spawn a conversation I think we've had before on the team which is that perhaps we should add details maps as an intrinsic engine feature instead of having to add a bunch of extra parameters manually for each texture you'd want to detail map.
* @property {number} aoDetailMapRotation Controls the 2D rotation (in degrees) of the detail | ||
* (secondary) AO map. | ||
* @property {string} aoDetailMapChannel Color channels of the detail (secondary) AO map | ||
* to use. Can be "r", "g", "b" or "a". |
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.
We don't seem to have that mentioned elsewhere in the docs, but we do set 'g' as the default channel in the material. It should be down to how textures are packed, surely, unless there is some bit depth favor for green channels (which would make sense perceptually) for certain file formats?
I think that using
The other options are mainly there for artistic freedom. |
This now has two approvals - any objections to merging @mvaligursky and @slimbuck? Last call for comments! ⌛ |
Lets merge it in. |
Fixes #4807
Uses the concepts introduced by #1968.
PR adds the following properties to
pc.StandardMaterial
with documentation and tests:aoDetailMap
(texture)aoDetailMapChannel
("r", "g", "b", "a", default is "g")aoDetailMapUv
(number)aoDetailMapTiling
(vec2)aoDetailMapOffset
(vec2)aoDetailMode
(pc.DETAILMODE_*
)When combined with a baked
aoMap
, this PR allows for high- and low-frequency AO to be mixed without requiring excessively large baked textures. Typical use-cases may be a fence, a car grille or similar where one might want to use a baked AO texture for the entire object, but use a tiling baked AO texture for the intricate details.Example:
I confirm I have read the contributing guidelines and signed the Contributor License Agreement.