-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Merged
mvaligursky
merged 7 commits into
playcanvas:main
from
Mistale:feature/secondary-ao-map
May 17, 2023
Merged
AO Detail Map #5270
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
00ef58d
Add AO detail map properties to StandardMaterial
Mistale 57e07cb
Implement shader code for AO detail map
Mistale 6c2f31c
Add validation of AO detail map properties to StandardMaterial tests
Mistale ac409a8
Merge branch 'main' into feature/secondary-ao-map
Mistale b01f4d2
Merge branch 'main' into feature/secondary-ao-map
Mistale 4a55793
Clarify default value in documentation for aoDetailMapChannel
Mistale 34c2505
Remove aoDetailMapPS entry from chunkVersions table since it is brand…
Mistale File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export default /* glsl */` | ||
float addAoDetail(float ao) { | ||
#ifdef MAPTEXTURE | ||
float aoDetail = texture2DBias($SAMPLER, $UV, textureBias).$CH; | ||
return detailMode_$DETAILMODE(vec3(ao), vec3(aoDetail)).r; | ||
#else | ||
return ao; | ||
#endif | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.