The purpose of this shader refactor is to split various material type
shaders into disparate pieces:
1. The original material type shaders now include an external file with
the actual shader entry points and structure of the algorithm (e.g.
depth pass, shadow pass, forward pass) but continue to specify the
SRGs used
2. Common functionality used across multiple shaders was consolidated
into routines implemented in the MaterialFunctions folder
(Materials/Types/MaterialFunctions)
3. The implementation shaders rely on common routines to be
included/imported prior to inclusion, and by design, make no
references to any Draw, Object, or Material SRG.
This refactor only includes the Standard and Enhanced material types,
and is, for the most part, a non-functional change. However, the Surface
definition needed to be augmented to include information needed by
lighting later. Modifying the Surface structure enables the lighting
loops to avoid any references to the Material SRG. This completes the
decoupling needed to support future Material canvas work, as well as a
future Material pipeline abstraction (where by the implementation
shaders can be injected by the user, customized per platform, and in
general, are simply decoupled from the materials themselves).
Signed-off-by: Jeremy Ong <jcong@amazon.com>
There were lots of material system conflicts that had to be resolved. I expect the build is broken at this commit, and I'll fix it in followup commits.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
Having subsurface scattering into a completely back area is an unrealistic scenario and caused colored artifacts. I changed the material to mask out the black areas from applying SS. Corresponding changes will be made to the expceted screenshot in AtomSampleViewer as well.
Note these artifacts were originally introduced at commit 19638c4697 Fri Jul 2 01:18:09 where SS was fixed to work again where it bad previously been broken and didn't show up in this test case.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
(It's a simple enough change to make manually, and making .materialtype is an uncommon workflow, so not worth doing this automatically).
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
* Adding vertex shadow and using it for all shadows
* Fixing small issue with it not being initialized
* Adis recommendations for hair
Signed-off-by: mrieggeramzn <mriegger@amazon.com>
* Expose OnModelReady to behavior context for hydra automation
Signed-off-by: amzn-tommy <waltont@amazon.com>
* Adding assets used by the hydra test to Atom/TestData
Signed-off-by: amzn-tommy <waltont@amazon.com>
* Attempt to fix line ending
Signed-off-by: amzn-tommy <waltont@amazon.com>
* Moving behavior context for mesh notification bus to the component controller
Signed-off-by: amzn-tommy <waltont@amazon.com>
* Changed the AssetManager DispatchEvents function to continously pump the
AssetBus of queued functions until empty.
This replicates the old behavior of the EBusQueuePolicy::Execute
function that would continue to execute functions if new ones were added
during the execution of the current queue.
Split the TestFixture class from the AssetHandler and EBus handler for the DynamicSliceInstanceSpawnerTests and
PrefabInstanceSpawnerTest.
This avoids the AssetMananager destructor from deleting the test fixture
if the call to UnregisterHandler is ever removed. This also allows the
memory allocators to get online earlier.
Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
* Removing an incorrect [[maybe_unused]]
Signed-off-by: amzn-tommy <waltont@amazon.com>
* Moving incorrectly placed [[maybe_unused]]
Signed-off-by: amzn-tommy <waltont@amazon.com>
Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
First I used some local changes to do an auto-conversion that loaded, upgraded, and then saved each .materialtype but some details were lost in translation. For example, comments were lost, and default values changed slightly. So I grabbed an original copy of each file, and copied/pasted each section from the old file to the new one, while preserving the new layout.
I did not update StandardMultilayerPBR because that will be too much work, will wait until after common property sets can be factored out. And I will likely discard that auto-conversion soon.
Testing: AtomSampleViewer MaterialScreenshotTest script passed with the same results as before.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
* Intial attempt to convert the Atom/RHI/FrameScheduler to use the new TaskGraph api
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Avoid enqueuing work on the active task thread if the submitted task
graph is waitable
When submitting a task graph, supplying a wait event implies that
dependent jobs must occur on threads that do not wait on the event (in
the absence of work stealing). This change prevents this by adding a
notion of a task thread enable/disable state, and prohibiting dependent
jobs from being enqueued on waiting threads.
Signed-off-by: Jeremy Ong <jcong@amazon.com>
* Convert RPI/Scene to use TaskGraph pass 1, Culling jobs remain on the old system
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* RemoveTask Graph changes from the FrameScheduler::ExecuteGroups, use old job system instead
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Per review, removing commented out code
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Cleanup debug code, & build fix
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Add a cvar & interface to query whether to use jobs or task graph
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Make TaskGraph assert if you try to wait inside a job
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Fix TaskTest SpawnSubgraph to account for the new TaskGraphEvent assert on wait in a running task
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* 3 minor cleanups. 1) Events always store a ptr to their executor 2) Fix clang compile error 3) remove an early out.
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Fix double group end that was causing assert/crash plus misc minor diff's with development
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Fix deallocation failure on deactivation of the TaskGraphSystemComponent. Also make the system component account for multiple creation in Unit Tests.
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Update with PR feedback
1) Rename UseTaskGraph to IsTaskGraphActive & update related code
2) prefer TaskExecutor::SetInstance
3) add comments and remove commented out code
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Fix incorrect RTTI name for TaskGraphActiveInterface
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
* Move TaskGraphSystemComponent CRC calculation to a shared variable
Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
Co-authored-by: Jeremy Ong <jcong@amazon.com>
Here we formalize the concept of a Property Set, which replaces property "groups", containing the group name and description, properties, and functors all in one place.
The Property Set structure will allow arbitrarily deep nesting, whereas before you only had one level of grouping. This nesting is not fully supported yet throughout the system, particularly in the Material Editor. It was easier to go ahead and put in some of the nesting mechanims, parituclar in the implementation of MaterialTypeSourceData.
This change is backward compatible, which is proved with unit tests, and by the fact that only MinimalPBR.materialtype has been updated to the new format. StandardPBR, EnhancedPBR, and others are still using the old format. (In a subsequent commit I'll update these as well, to prove that the new format works correctly).
Other changes and improvements...
- A new constructor for MaterialPropertyId
- Improved API for MaterialTypeSourceData that hides a good deal more of it's data as private, with clear and convenient APIs. Especially AddProperty, AddPropertySet, FindProperty, FindPropertySet, EnumerateProperties, EnumeratePropertySets.
- Added lots of new unit tests
- Updated MinimalPBR.materialtype to the new format.
Testing:
- Updated unit tests.
- Reprocessed Atom material assets.
- Ran AtomSampleViewer material screenshot test.
- Opened, edited, saved material in the Material Editor.
- Opened a level, edited material property overrides, saved and reloaded.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
Before, the only way to set the double-sided flag was to enable a non-opaque mode, because the flag was hidden. We are moving the double-sided flag to the general property group instead of the opacity property group, so it is always available. In this particular commit, we just add the general.doubleSided property so we don't break existing data. In an upcoming commit I will remove opacity.doubleSided, once we have the material backward compatibility system ready.
I also added another "default" texture map to the Common/Feature gem that is directional, so better for understanding UV/tangent space. These were copied from the AtomLyIntegration gem. This is being used for a screenshot test in AtomSampleViewer with the new 009_Opacity_Opaque_DoubleSided.material.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
This revealed that the approach of reflecting both the old "id" and the new "name" would not work, because whenn saving it would write out both fields. So I decied to just give up on backward compatibility. This will be much cleaner than trying to continue supporting "id" as a field name, it is uncommon for users to make their own material types at this point, and if they have made some it is very easy to search and replace "id" with "name" update their files.
All .materialtype files have been updated. RPI unit tests now pass. ASV still passes.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
- 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.