By default, processing of model files (like FBX) automatically convert the included materials to Atom materials, using StandardPBR. This adds a job dependency on StandardPBR.materialtype, which propagates to any related azsl files as well. Thus any change to azsl code will cause all model files in the project to rebuild.
Some game teams have no interest in using the auto-converted materials; they always use a Material Component to apply material overrides for every mesh. This new setting allows teams to disable material auto-conversion for the entire project, thus removing the job dependency on StandardPBR.materialtype. Instead, every mesh will be assigned the same default material. Any change to azsl code will cause that one default material to rebuild, but this will not trigger any models to rebuild.
Details:
- Added /O3DE/SceneAPI/MaterialConverter registry settings for configuring the scene material converter. It includes an enable flag, and a default material to use when conversion is disabled.
- Added SceneBuilderDependencyRequests::AddFingerprintInfo which allows ScenePI components to modify the scene builder analysis fingerprint. We use this to reprocess scene files when the material converter settings change.
- Updated SceneAPI's material asset builder to skip the StandardPBR dependency when material conversion is disabled.
- Added some code to MaterialComponentController to handle an edge case that may when disabling material conversion on an existing project, and assigned materials disappear.
Testing:
- Changing the registery setting does trigger a rebuild of the fbx files.
- When material conversion is disabled, changing an azsl file does not cause fbx files to rebuild, but the shader still reloads as expected.
- Made a test level using multiple models with multiple meshes, made various adjustments to the material slots for each mesh, and tried switcihng the material conversion registry setting from true to false. (Details below)
- TODO: Will merge this change to a customer's fork and test on their existing content.
Details about my test level:
- Made a new test level AtomTest project
- Added two entities, both using multi-mat_mesh-groups_1m_cubes.fbx
- Added a material component to both entities
- Entity 1 material assignments
- Blue_Zaxis: left as-is
- Green_Yaxis: exported the material
- Red_Xaxis: exported the material, and changed the material instance color to pink
- StingrayPBS1: exported the material, scaled the UVs in the exported material source, and changed the material instance color to green.
- With_Texture: selected an existing brick material, changed the material instance color to red.
- Entity 2 material assignments
- Default Material: set to an existing brick material
- Blue_Zaxis: manually assigned built-in material that was converted from fbx
- Green_Yaxis: manually assigned built-in material that was converted from fbx, and changed the material instance color to orange
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
Repro steps:
- Create two entities.
- Entity 1
- Add a mesh component and assign a model with multiple sub-meshes
- Add a material component. The material component looks correct.
- Entity 2
- Add a mesh component and assign the same model as the other entity
- Add a material component. The material component shows "<unknown>" for all material slot names
The problem was that ReflectedPropertyEditor creates a new Asset<> reference with the correct ID but does not load it. This asset is passed to EditorMaterialComponent, MaterialComponentController, and MeshFeatureProcessor and none of these tell the Asset to load. The MeshFeatureProcessor was not loading the Asset or connecting to the AssetBus because the instance already existed in the InstanceDatabse so from the FP's perspecive there was no need. But for the FP's GetModelAsset() API to function correctly it needs to have the asset initialized to the available AssetData pointer. So we updated the MeshFeatureProcessor to always connect to the AssetBus so it will find the available AssetData via the OnAssetReady callback.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
I had to update the ModelLod class to take in both the ModelLodAsset and ModelAsset for initialization so it can fetch the slots for each mesh.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
Here we inttroduce a new struct ModelMaterialSlot which formalizes the concept of material slot, with an ID, display name, and default material assignment. The ID still comes from the MaterialUid like before. The display name is built-in, rather than being parsed out from the asset file name. And the default material assignment can be any material asset, it doesn't have to come from the FBX (or other scene file).
This commit is just the preliminary set of changes. Cursory testing shows that it works pretty well but more testing is needed (and likely some fixes) before merging.
Here is what's left to do...
Add serialization version converters to preserve prior prefab data.
See if we can get rid of GetLabelByAssetId function only rely on the display name inside ModelMaterialSlot.
I'm not sure if the condition for enabling the "Edit Material Instance..." context menu item is correct.
Test actors
Lots more testing in general
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
* Expose shadow bias to component & feature processors. Shadow bias now works more consistently with various near / far shadow planes and caster positions. Bias now also affects esm shadows which helps eliminate acne in certain situations.
Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
* Adding jira comment to light configuration serialization version. Improved comment on final adjustment to bias before its sent to the shader.
Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
* Hooking up bias to behavior context.
Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
* fix: Correct typo in profiling capture system.
Signed-off-by: Cynthia Lin <cyntlin@amazon.com>
* Move benchmark data aggregation from ASV into ly_test_tools module.
Signed-off-by: Cynthia Lin <cyntlin@amazon.com>
Added an initialization delay before starting the DiffuseProbeGrid texture readbacks, to allow the textures to settle.
Signed-off-by: dmcdiar <dmcdiar@amazon.com>
* Switching to Buffer<float> instead of Buffer<float3> in the skinning shader because metal doesn't support float3 buffers
Signed-off-by: amzn-tommy <waltont@amazon.com>
* Adding a comment to LinearSkinningPassSRG pointing out that positions, normals, and bitangents are using float buffers to work on Metal
Signed-off-by: amzn-tommy <waltont@amazon.com>
* ATOM-15939 Add support to capture attachment for ParentPass
- Moved the attachment read back support to Pass class so it supports both ParentPass and RenderPass.
- Added support to output input or output state of an InputOutput attachment.
- Enabled showing ParentPass attachments in PassTree tool.
Signed-off-by: Tao <qingtao@amazon.com>
* 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>
Fix writing to the correct mip in Metal
Set default m_outputScale to 1 in order to fix a 1/0 error
Add support for logging/printing errors pertaining to GPU crashes.
Setting Release queue's collection latency to MaxFrames.
Fix managed mem synchronization related offset bug
-Re-purposed an unused boolean in RPI::Cullable for previous frame's visiblity to instead represent objects that are hidden in the simulation.
-Updated MeshFeatureProcessor::SetVisible to set this value on the cullable.
-Updated the MeshComponent to handle visiblity changes by not rendering the mesh instead of deactivating and/or reactivating the component.
-Updated the AtomActorInstance to handle changes to the visibility from the ActorComponent.
Tested by creating two entities with static mesh components, on entity hidden and the other visible. Plus three entities with actor components, one where the actor is visible, one where the entity is visible but the 'render character' setting on the actor component is disabled, and one where the 'render character' setting is enabled, but the entity is not visible.
For each of these 5 entities, I added them as 5 loose entities, 5 entities that were children to a parent entity, and a slice with all 5 as children to a parent entity, and tested toggling visibility of the parent entities.
For each of these 3 sets of 5 entities, I added them directly to the level, added them all to a layer where the layer was visible, and added them all to a layer where the layer was not visible, and tested toggling the visibility of the layers.
* ATOM-15859 AuxGeom rendering in editor is too expensive
- The OrphanBuffer calls is the main reason that AuxGeom FP render is slow.
- Switched to use DynamicBuffer for buffers used in DynamicPrimitiveProcessor
- Added some profiling marks.
- Removed DynamicPrimitiveProcessor per view which was added because of OrphanBuffer can only be called once per frame.