Commit Graph

155 Commits (8fbd2aaaf56573fce07ddb6376c12179137d5ca8)

Author SHA1 Message Date
santorac 8fbd2aaaf5 Tied up a few loose ends to support deeply nested property groups.
Simplified the call back for MaterialTypeSourceData::EnumeratePropertyGroups while also providing more data.
Made the Material Inspector join nested property group display names to be like "Layer 1 | Base Color", since the leaf property groups are shown as a flat list in the inspector.
Fixed CreateMaterialAssetFromSourceData to include the imported json files in the list of sourceDependencies. This triggers the Material Editor to hot-reload when one of these json files changes.
Updated a few places that were still assuming only one level of property group.
Updated EditorMaterialComponentInspector to apply the per-property-group material functors, before it was still only applying the top-level onces.
Moved some accessor function implementations to the cpp files, per feedback on another already-merged PR.

Testing:
Made changes to MinimalMultilayerPbr (in AtomSampleViewer) to use nested property groups, and saw the correct behavior in the Material Editor's property inspector.
Used MaterialComponent's property inspector to edit a StandardPbr material instance. Confrimed that functors were correctly controlling property visibility by enabling and disabling things like emissive and clear coat.
Used MaterialComponent's property inspector to edit a MinimalMultilayerPbr material instance. Saw all the expected groups and properties show up. Confirmed that per-group functors were correctly controlling property visibility.
Used MaterialComponent's property inspector to export a material instance and confirmed the .material file included the expected properties.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac 74f6d1ec74 Cleanup up and resolving conflicts after the latest merge.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac 1a10369adb Merge branch 'development' into Atom/santorac/RemixableMaterialTypes4_Layering
There were conflicts in MaterialDocument.cpp which I had resolve by just taking development. This will not compile. I will make additional fixes in another commit.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Qing Tao 01892914ea
Atom/qingtao/atom 16135 (#7334)
* Changes to AttachmentImage related classes to have better support using render target as texture.
- Updated AttachmentImageAsset to support an unique name which can be used as AttachmentId.
- Functions in ImageSystemInterface to find an AttachmentImage by its unique name.
- Added InsertChild function to ParentPass class so it can insert a child pass at any location.
- Change to ImageAttachmentPreviewPass so it can preview cached pass attachment even the source pass was disabled.

Signed-off-by: Qing Tao <55564570+VickyAtAZ@users.noreply.github.com>
4 years ago
santorac 2c59f1b8a4 Added support for deeply nested material property groups.
The main addition here is the MaterialNameContext class which represents the concept of a namespace for properties, shader options, and SRG fields. This concept was already somewhat supported in LuaMaterialFunctor through bespoke "prefix" fields, but I have generalized it be available for all material functors. Note that I have not yet updated the other material functor types to ensure they take advantage of this feature, that will be in another commit.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac b1cc469914 Merge branch 'Atom/santorac/ShaderOptionValueUtils' into Atom/santorac/RemixableMaterialTypes4_Layering
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac 3441c02637 Minor cleanup of some shader option related unit tests.
Added new utility functions for easily creating the value set for a ShaderOptionDescriptor.
Made ShaderOptionDescriptor default value optional, picking the first available value as the default ... by default.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac a352807c87 Renamed MaterialFunctor code to use propertyId instead of propertyName, because 'name' is us for the short name of a property and 'ID' is for the full name including groups.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
lumberyard-employee-dm b9824ed172
Updated all array_view uses with the C++20 span. (#7157)
* Updated all array_view uses with the C++20 span.

The updates were done in the following order
1. `AZStd::array_view<([^>].+)\* ?>`  -> `AZStd::span<\1 const>`
2. `AZStd::array_view<(?:const )(.+)>` -> `AZStd::span<const \1>`
3. `AZStd::array_view` -> `AZStd::span`

Removed the implementation of array_view.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Added missing whitespace between `const` and the typename for spans.

Updated the ShaderTest comparison of the ShaderResourceGroupLayout span
to compare the sizes as well

Updated comments on some of the methods that stated that they return "an
array" to mention they return "a span".

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
4 years ago
santorac 730daae1e6 Added code comments.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac fbe17b0022 Merge remote-tracking branch 'upstream/development' into Atom/santorac/MaterialAssetDeferredBaking3 4 years ago
santorac b61238e50c Minor fixes to whitespace and comments.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
dmcdiarmid-ly 8ec07031e3
Merge pull request #6959 from aws-lumberyard-dev/Atom/dmcdiar/ATOM-15740
Support supervariants in the PrecompiledShaderBuilder
4 years ago
santorac a896ff11bc Changed .material serialization to avoid loading the .materialtype file, since the .material builder doesn't declare a source dependency on the .materialtype. Otherwise there can be ambiguous edge cases where changes to the .materialtype might or might not impact the baked MaterialAsset. Note that another option would have been to add a the appropriate source dependency, but that would hurt iteration time as any change to the .materialtype file would cause every .material file and .fbx to rebuild.
These changes have the added benefit of simplifying some of the serialization code. MaterialSourceDataSerializer is no longer needed, as its main purpose was to pass the MaterialTypeSourceData down to the MaterialPropertyValueSerializer.

Before, the JSON serialization system gave a lot of data flexibility because it did best-effort conversions, like allowing a float to be loaded as an int for example. But now the material serialization code doesn't know target data type, so it has to assume the data type based on what's in the .material file, and then the MaterialAsset will convert the data to the appropriate type later when Finalize() is called.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac 45429872d6 Switched back to making MaterialAsset::GetPropertyValues automatically finalize the material asset. I realized that it's too burdensome to expect client code to call Finalize on the MaterialAsset; every code that calls GetPropertyValues would have to call Finalize(). Instead of using const_cast in GetPropertyValues like I was doing before, I just changed GetPropertyValues to be a non-const function. There were a few places in Decal code I had to update to pass non-const MaterialAsset pointers. This isn't ideal, but I think it's better than the alternatives.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac 2627b507d3 Fixed unused variable warning
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac c24546a85d Fixed unused variable warning.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac 2d6d14abf7 Changed MaterialAsset::GetPropertyValues to not auto-finalize. Client code must call Finalize manually. It's better to avoid unexpected side-effects from a const getter function.
In some cases it may be acceptable to do non-const things in a const function as long as it is only manipulating internal data, and the public facing API returns the same values as before. But in this case, the IsFinalized function is a public facing API that would have a different result after GetPropertyValues was called.

I also updated a couple other minor things from code review feedback.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac 8084775d7a Updating code comments.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac aafd34679a Merged MaterialAssetCreatorCommon class into MaterialTypeAssetCreator because it is no longer needed for MaterialAssetCreator.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac 1fa1eaad15 Added unit tests for the new functionality.
I found a mistake where MaterialAssetCreator needs to clear the raw data when configured to finalize the material asset.
Since MaterialSourceData no longer relies on the material type source file at all, I was able to change MaterialSourceDataTest to avoid saving the source data to disk.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac a627cda5ae Got the unit tests working again.
I made MaterialAsset::Finalize private so I could add some parameters specifically for MaterialAssetCreator to use. Now MaterialAssetCreator::Begin has an option to finalize the material or not.
Moved MaterialAssetCreatorCommon::ValidateDataType to MaterialPropertyDescriptor as "ValidateMaterialPropertyDataType" so that MaterialAsset::Finalize could use it too

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac c5b128bec4 First pass at reworking and formalizing the way deferred material asset baking works. The feature basically works but needs more testing.
Before, the material builder was loading the MaterialTypeAsset and doing some processing with it, but was avoiding declaring job dependencies that would cause reprocessing lots of assets when a shader or .materialtype file changes. Reading the asset data isn't safe when not declaring a job dependency (or when declaring a weak job dependency like OrderOnce which is the case here). This caused to several known bugs.

The main change here is it no longer loads the MaterialTypeAsset at all; all other changes flow from there.

The biggest changes (when deferred material processing is enabled) are ...
1) MaterialSourceData no longer loads MaterialTypeAsset. All it really needs is to determine whether a string is an image file reference or an enum value, which is easy to do by just looking for the "." for the extension.
2) MaterialAssetCreator no longer produces a finalized material asset. It no longer uses MaterialAssetCreatorCommon because that only produces a non-finalized MaterialAsset, which has very different needs for the SetPropertyValue function. (We could consider merging MaterialAssetCreatorCommon into MaterialTypeAssetCreator since that's the only subclass at this point). And it doesn't do any validation against the properties layout since that can be done at runtime.
3) Moved processing of enum property values from MaterialSourceData to MaterialAsset::Finalize (this was the only thing being done in the builder that actually needed to read the material type asset data).

Also...
- Updated the MaterialAsset class mostly to clarify and formalize the two different modes it can be in: whether it is finalized or not.
- Merged the separate "IncludeMaterialPropertyNames" registry settings from MaterialConverterSystemComponent and MaterialBuilder into one "FinalizeMaterialAssets" setting used for both.
- Removed MaterialSourceData::ApplyVersionUpdates. Now the flow of data is the same regardless of whether the materials are finalized by the AP or at runtime. Version updates are always applied on the MaterialAsset.
- Added a validation check to MaterialTypeAssetCreator ensuring that once a property is renamed, the old name can never be used again for a new property. This assumption was already made previously, but not formalized, in that Material::FindPropertyIndex does not expect every caller to provide a version number for the material property name, also the material asset's list of raw property names was never versioned. The only way for this to be a safe assumption is to prevent reuse of old names.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
dmcdiarmid-ly 2b103ce445 Added support for supervariants to the PrecompiledShaderBuilder
Signed-off-by: dmcdiarmid-ly <63674186+dmcdiarmid-ly@users.noreply.github.com>
4 years ago
dmcdiarmid-ly 1ef868437a Added supervariantIndex check in Shader::OnShaderVariantAssetReady
Signed-off-by: dmcdiarmid-ly <63674186+dmcdiarmid-ly@users.noreply.github.com>
4 years ago
Esteban Papp 0b9497cd45 Changes call from AZ_TRACE to AZ_PROFILE. AZ_TRACE uses a driller bus that is going to be removed
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
4 years ago
puvvadar 6eec6c8f8e
Merge pull request #5752 from aws-lumberyard-dev/puvvadar/gitflow_211118_o3de
Merge stabilization/2110
4 years ago
Guthrie Adams e97f5de94a Updated material version warning messages to include the affected asset
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
puvvadar 724ff3b011 Merge commit 'd222aeef48ad10224958e682294e704c10ee06df' into puvvadar/gitflow_211118_o3de 4 years ago
Tommy Walton 0dcf49affc Merge commit 'b0dfe26232b318e520887af65cd579ec87016636' into amzn-tommy/gitflow_211116_o3de2
Signed-off-by: Tommy Walton <waltont@amazon.com>
4 years ago
Tommy Walton 783bb72944 Merge commit 'f1d9e7ae28bf0667487c939aa32b1ef833da80f4' into amzn-tommy/gitflow_211116_o3de2 4 years ago
santorac db3d41ad9d Merge remote-tracking branch 'upstream/stabilization/2110' into Atom/santorac/MaterialEditorHandlesMissingTextures 4 years ago
santorac aa85963a2b Fixed MaterialPropertyValue::FromAny to preserve the Hint string when converting Asset objects. This fixed an issue where the hint didn't show up in the Material Component's instance inspector.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
galibzon b0dfe26232
The Build Time Stamp of ShaderAsset And (#5373)
* The Build Time Stamp of ShaderAsset And
ShaderVariantAsset Should Be Based On
GetTimeUTCMilliSecond()

GetTimeNowMicroseconds() is useful to measure time stamp differences.
GetTimeUTCMilliSecond() is for time stamps based on absolute clock/wall time.

* Updated DiffuseGlobalIllumination precompiled shaders

Co-authored-by: dmcdiar <dmcdiar@amazon.com>
Signed-off-by: galibzon <66021303+galibzon@users.noreply.github.com>
4 years ago
santorac e1e282484f Merge remote-tracking branch 'upstream/stabilization/2110' into Atom/santorac/MaterialEditorHandlesMissingTextures 4 years ago
Tommy Walton f1d9e7ae28
Skybox hot reloading - fix black screen when running the editor for the first time with a clean cache (#5529)
* Add a default fallback image when a StreamingImageAsset fails to load

Signed-off-by: Tommy Walton <waltont@amazon.com>

* Don't release a missing/invalid texture reference in the skybox component. Hold on to the reference so that it can hot-reload

Signed-off-by: Tommy Walton <waltont@amazon.com>

* Don't release a missing/invalid texture reference in the ibl component. Hold on to the reference so that it can hot-reload

Signed-off-by: Tommy Walton <waltont@amazon.com>

* Use a different fallback image depending on the status of the asset. Including a setting to use a friendly image that is less obnoxious for anything that might have been missed in a release build

Signed-off-by: Tommy Walton <waltont@amazon.com>

* Adding the stubbed in fallback textures

Signed-off-by: Tommy Walton <waltont@amazon.com>

* Updated the seedlist for the RPI to include the fallback images. It only needs the default and the missing asset images, since the AP doesn't run in release builds, the asset status will always be unknown, not processing or failed to process, so if an asset is not bundled, it is just missing.

Signed-off-by: Tommy Walton <waltont@amazon.com>

* Switched to GetAssetIdByPath and removed some tabs

Signed-off-by: Tommy Walton <waltont@amazon.com>
4 years ago
Nicholas Van Sickle 8d5dd4e35f Merge remote-tracking branch 'upstream/stabilization/2110' into nvsickle/StabToDevNov21
Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
4 years ago
Tom Hulton-Harrop 2812ec2024
Fix brute force mesh intersection function (#5447)
* fix brute force mesh intersection function

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>

* add test for brute force ray intersection fix

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>

* refactor tests to remove as much duplication and provide API for future tests if required

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>

* small updates after review feedback

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>

* update following review feedback

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>

* fix for pointer offset

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>
4 years ago
santorac f27203a5fa Updated Material Editor to use the available default fallback images to visually indicate a missing texture.
Material Editor also warns the user when saving a material that is populated with fallback image references.
Factored out the path strings for the default images to ImateSystemInterface.h.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Tommy Walton 9a470f35ad Merge remote-tracking branch 'upstream/stabilization/2110' into Atom/amzn-tommy/ATOM-16289_SkyboxHotReloading
Signed-off-by: Tommy Walton <waltont@amazon.com>
4 years ago
Tommy Walton 09b9d371e0 Use a different fallback image depending on the status of the asset. Including a setting to use a friendly image that is less obnoxious for anything that might have been missed in a release build
Signed-off-by: Tommy Walton <waltont@amazon.com>
4 years ago
santorac 04c6f3cc94 cherry-pick 48f3bb7d
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Guthrie Adams 6ea951214c Moving material type asset PostInit call to be consistent with material asset
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Guthrie Adams b038faf9ca material editor loads source data
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
santorac 48f3bb7d7a Fixed missing initialization of ShaderCollection::Item::m_renderStatesOverlay.
This RenderStates is used to override the values in the final draw packet, if the values are valid; it's supposed to be initialized to invalid values, but it wasn't. So the depth compare function was getting set to Less instead of GreaterEqual. This wasn't a problem when using serialized assets from disk, because the deserialization uses the default constructor which did initialize m_renderStatesOverlay. No all Item constructors initialize m_renderStatesOverlay.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Guthrie Adams e632dc3b39 Moving material type asset PostInit call to be consistent with material asset
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Guthrie Adams 898b1811e0 material editor loads source data
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Tommy Walton 55ebc17b01 Merge remote-tracking branch 'upstream/stabilization/2110' into Atom/amzn-tommy/ATOM-16289_SkyboxHotReloading
Signed-off-by: Tommy Walton <waltont@amazon.com>
4 years ago
Chris Burel 69059ba3e6 Merge branch stabilization/2110 into development
Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
Tommy Walton 672c82f69d Add a default fallback image when a StreamingImageAsset fails to load
Signed-off-by: Tommy Walton <waltont@amazon.com>
4 years ago