- Add new Linux Trait to determine which display driver client API to use (only xcb supported for now)
- Add support for xcb connections (initial) for Linux/Vulkan
- Fix minor assertion caused by wrong use of sizeof
- Fix casing issue in a couple of material files (Linux is case sensitive)
* Final update copyright headers to reference license files at the repo root
Signed-off-by: spham <spham@amazon.com>
* Fix copyright validator unit tests to support the stale O3DE header scenario
Signed-off-by: spham <spham@amazon.com>
Adding a factor for alpha affecting specular in the standard and enhanced pbr materials (#1474)
* Adding a factor for how much alpha should affect specular to standard and enhanced pbr. Currently blended and tinted transparency always assume that the geometry represents the surface, and the surface may just be transparent like glass. In this model, specular is unnaffected by alpha - perfectly clear glass still reflects light and obeys the Fresnel factor. However alpha may also represent the absence of a surface entirely for mateirals where cut-out alpha is a bad fit because of subpixel detail, like hair or cob webs. This change addresses that by allowing the alpha to also affect specular reflection if desired.
* Adding material for ASV test.
The only remaining unnecessary enable flag I found was for the parallax property group. It is removed, and now we just use the texture map and useTexture flag to gate whether the feature is enabled.
Copied tinted transparency opacity mode from EnhancedPBR to StandardPBR.
Fixed a bug in EnhancedPBR where Blended opacity didn't work right because the second DrawListOverride functor was stomping on the results of the first DrawListOverride. I removed these functors and made StandardPBR_HandleOpacityMode.lua set the draw list override instead.
Updated material type files for StandardPBR, EnhancedPBR, and Skin to align with each other as much as possible.
There were minor cases like some property settings were different, properties in different order, comments, and formatting.
There were major cases as well, like EnhancedPBR using clunky built in functors where lua functors would be better, property visibility state wasn't right, properties were missing, etc.
I also added a new HasShaderWithTag function for lua functors. This is used in StandardPBR_ShaderEnable.lua to allow this script to be used for both StandardPBR and EnhancedPBR (EnhancedPBR doesn't have the low end pipeline shaders).
Updated material types to have default parallax settings of POM, Low quality, 0.05 scale. That way the parallax effect will show up as soon as a user adds a heightmap.
Updated StandardMultilayerPBR_Displacement.lua to control the o_parallax_feature_enabled, so we can have the material's parallax.enable=true by default. Again this is to allow parallax behavior to show up as soon as the user adds a heightmap or adjusts the displacement offset. Note that even though we have a functor to drive the feature based on displacement settings, we still need the parallax.enable flag that that the user can set to false when they want to use displacement blending but not parallax.
Updated test materials to maintain their prior implied settings.
It wasn't just a matter of using smoothstep, I had to refactor the code to take a different approach to generating blend weights. We really have to avoid any kind of division for normalization of weights because that causes all the blend functions to become non-linear. So with these changes, the blend weights are calculated based on linear interpretation for displacement-based blending too (before only the non-displacement blending used linear interpolation). With that in place, smoothstep can now be used to give a smooth transition.
I'm not sure which of these edge cases may have existed before updating the property handling, and which were caused by it.
- Rearranged the per-layer parallax property groups because these are more general than just parallax. They can be used for displacement-based blending regardless of whether a parallax effect is being used.
-- Renamed "Parallax Mapping" to "Displacement" because these properties can be used for other things besides parallax, in particular the new displacement-based blend modes.
-- Removed the unnecessary per-layer "enable parallax" flags. This also allowed me to remove the StandardMultilayerPBR_ParallaxPerLayer.lua script and replace this with simply a UseTexture functor for each layer.
-- Made the "offset" property always available, so this can be used to adjust displacement for blending purposes even when there is no heightmap or parallax. The "factor" property still only shows up with a heightmap because its only purpose is to scale the heightmap.
-- In order to get the offset to work when there is no texture map, I had to fix the logic a bit in GetLayerDepthValues where it was ignoring the offset.
-- Had to rearrange the logic in StandardMultilayerPBR_Displacement.lua a bit to get this all working, particularly because the per-layer displacement properties are no longer hidden behind an enable flag.
- Change the displacementBlendFactor to displacementBlendDistance because it felt weird when sliding per-layer displacment offset values and seeing this impact the surface property transition. Using an absolute distance value feels more natural.
- Made the displacement blend mask push the displacement down *past* the min displacement value to address edge cases where blend mask 0 didn't actually make a layer disappear. (See GetSubMinDisplacement()).
- Inlined the GetBlendWeightsFromLayerDepthValues code into GetBlendWeights because I realized it was only being used there, and the code is easier to read this way IMO.
- Displacement-based blend weights weren't being normalized in cases where layerDepthBlendDistance is 0, which caused incorrect depth values where two layers meet.
Renamed StandardMultilayerPBR_Parallax.lua to StandardMultilayerPBR_Displacement.lua because it is used for more than just strictly parallax, it generally deals with displcament which can be used for blending even when parallax is disabled.
Updated the terminology (yet again) to hopefully be a bit more clear and consistent.
"Blend mask" means the R and G channels that mask layers 2-3. These can come from multipls source, including a "blend mask texture" or "blend mask vertex colors".
"Blend weights" are the final RGB channels that are multiplied and added with layer properties to do the final blend.
"Blend source" is the combination of data that is used to produce the blend weights, which could be a combination of displacement maps, blend mask texture, vertex colors, or others in the future.
Added another debug render mode, so now we can show either the blend mask and the final blend weights.
Added flags for enabling StandardMultilayerPBR layers 2 and 3. This makes it easy to create a two-layer material, or to flip layers off and on for debugging.
Changed to lerp-based blending, with an implicit base layer.
Renamed some variables to be more clear (blendWeight instead of blendMask, since the weights could come from vertex colors instead of a texture).
Updated DefaultBlendMask_layers.png to better suit the new layering model. It has a black background and overlapping R, G, and B areas.
Updated some of the test materials UV transforms to better fit the new DefaultBlendMask_layers image.
Added a new test object, which is a plane that has painted vertices.
Note that I updated test criteria in AtomSampleViewer to account for these changes as well.
Added new "Displacment" blend source option that blends between layers based on which displaced height is higher. For now it simply picks the higher of the three. In subsequent commits I'll improve on the blending to allow for some transition.
Recactored GetLayerDepthValues(), GetBlendWeights(), and GetBlendWeightsFromLayerDepthValues() to optimize parallax searches so that the displacment maps are sampled once and used for both parallax and the calculating the blend weights.
Renamed several layer blending types and variables to be more clear.
Added Height Offset support to StandardMultilayerPBR.materialtype.
In order to make this work, I updated the GetDepth callback function to support the option of returning absolute depth values rather than relative depth values. Although I could have done transformations inside the GetDepth function, having this as absolute cleans things up a lot. StandardMultilayerPBR_Parallax.lua functor code now populates the MaterialSRG with displacement min/max values, instead of having to normalize the depth factors for each layer. I think this is easier to understand and work with.
Added Height Offset to each layer of StandardMultilayerPBR.
Updated the naming and description for the parallax factor in each layer, to match the other material types.
I removed the global "factor" material property because it doesn't seem applicable anymore since we have per-layer height offset. We can always add some form of this later if customers ask for it.
Squashed commit of the following:
commit 8df460800ff7058f9fbb01f995efdd5ab53d3d2c
Author: Chris Santora <santorac@amazon.com>
Date: Tue May 4 13:35:27 2021 -0700
Found a workaround for the DXC compiler bug
commit 5d81617285eb42bb7b48eb060234d2cb89249e34
Author: Chris Santora <santorac@amazon.com>
Date: Tue May 4 12:27:22 2021 -0700
Local WIP changes to get a DepthResult struct set up for the GetDepth functions.
Added parallax "Height Offset" properties to StandardPBR and EnhancedPBR.
- Refactored depth pass and shadow pass shaders to use the GetParallaxInput utility.
- Updated EnhancedPBR.materialtype to match the parallax controls and functors of StandardPBR.materialtype.
- Updated EnhancedPBR's shadow pass shader to apply a ShadowMapDepthBias because I noticed StandardPBR is doing this, so I made them match.
- Updated StandardPBR and EnhancedPBR to both use the depth offset property, as well as heightmap clipping debug view.
- Note that depth offset is not supported in StandardMultilayerPBR yet, it's hard-coded to 0 for now.
- Note that I plan to rename a lot of the "depth" terms to "heightmap" or "displacement" in an upcoming commit.
Note there were significant conflicts in LightingModel.azsli and StandardPBR_ForwardPass.azsl. I only did basic resolves of these conflicts, mostly preserving the changes from main and distarding the changes in the local branch. The shaders are not compiling at this point, and of course the tests are not passing. I will fix up the code to make corrections in a separate commit, to make it easier to review those changes separate from this merge.
Added new input attachment to the fullscreen reflection pass to receive the "ambient" gbuffer.
Added diffuse and specular occlusion to the Skin material type; it was missing before.
ATOM-14040 Add Support for Cavity Maps
Testing:
AtomSampleViewer automation, with updates that will be submitted in that repo.
Manual testing in Material Editor.
Built all AtomTest assets and opened a few test levels, with updates that will be submitted in that repo.
Made local copies of the occlusion test materials and changed replaced the material types with EnhancedPBR and Skin, and got identical results (with clear coat disabled since it works different in EnhancedPBR and is absent in Skin).
Remove option from presets
Updated code to select current default options
Will data drive default options with editor settings or settings registry in upcoming tasks
https://jira.agscollab.com/browse/ATOM-13950
Before working on adding cavity map support, I am replacing the 010_SpecularOcclusion test case with maps that make it easier to distinguish what's going on. The brick map was just too noisy. This simpler tile map will make it easier to see if there are artifacts like banding that get introduced somewhere along the way.
There are corresponding changes in AtomSampleViewer for the baseline screenshot.
Several image preset files had a full list of file masks for only one platform. I made sure that the same list was applied to every platform including the default preset.
Removed the "Swizzle" command from Displacement.preset. Swizzle "aaa1" is wrong since this preset expects a single channel image.
Added "_col" to Albedo.preset as an abbreviation for "_color".
Added "_rough" to Roughness.preset as it's a common abbreviation.
Added "_rgbmask" filter to LayerMask.preset to correspond to the "_mask" filter in Grayscale.preset.
Added a warning when an image can't be processed according to the assigned preset due to dimension issues. Otherwise it's difficult to figure out why it's using the ReferenceImage preset instead of what was expected.
Resized the "bark" textures to make them compatible with the image presets.
Removed the "bark1disp2.jgp" image and just applied the changes to the original bark1disp.jpg". It's just blurred a bit to remove excessive noise.
Renamed all the "bark" textures to include an underscore "_" after "bark1" to get the image pipeline to properly recognize the file masks.
Testing:
AtomSampleViewer automation.
All assets in AtomTest build.
Opened several levels in AtomTest.