Commit Graph

200 Commits (development)

Author SHA1 Message Date
Jeremy Ong faa65bca1b Refactor shader definitions to be more consistent with other shaders
Signed-off-by: Jeremy Ong <jcong@amazon.com>
4 years ago
Jeremy Ong 4bcc83e7ac Address PR feedback, ensure all ASV tests pass
Signed-off-by: Jeremy Ong <jcong@amazon.com>
4 years ago
Jeremy Ong 61f915366a Shader refactor (no functional changes)
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>
4 years ago
Santi Paprika c173fd9357 Remove division by constant in distance attenuation for DirectionalLight (https://github.com/o3de/o3de/pull/6428#discussion_r799216516)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 6e21d63943 Merge remote-tracking branch 'upstream/development' into thin-transmission
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 024933d4a1 Improve descriptions and comments (https://github.com/o3de/o3de/pull/6428#discussion_r799207891, https://github.com/o3de/o3de/pull/6428#discussion_r799213620)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 9c60bd008c Enable human skin profile via preprocessor define (https://github.com/o3de/o3de/pull/6428#discussion_r797699927)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 1087e45ce3 Fix typo (https://github.com/o3de/o3de/pull/6428#discussion_r797667772)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
antonmic 5b9bc3b479 address PR feedback
Signed-off-by: antonmic <56370189+antonmic@users.noreply.github.com>
4 years ago
antonmic 9f0b6d65f4 merging latest dev
Signed-off-by: antonmic <56370189+antonmic@users.noreply.github.com>
4 years ago
Santi Paprika d0bb222ce6 Refactor thin transmission factor variable packing and visibility + use thickness to modulate transmission distance
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika ed7c6198e1 Merge remote-tracking branch 'upstream/development' into thin-transmission 4 years ago
Santi Paprika 8770118b90 Fix nit typo in comment v2
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika c580499b6f Fix nit typo in comment
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
mrieggeramzn 03f6ba55fd
Adding cascade blending for pcf (#6181)
* Adding cascade blending for pcf

Signed-off-by: mrieggeramzn <mriegger@amazon.com>

* tabs to spaces

Signed-off-by: mrieggeramzn <mriegger@amazon.com>

* tabs to spaces

Signed-off-by: mrieggeramzn <mriegger@amazon.com>

* tabs 2 spaces

Signed-off-by: mrieggeramzn <mriegger@amazon.com>

* Feedback using min3

Signed-off-by: mrieggeramzn <mriegger@amazon.com>

* Only enable flag if > 1 cascade

Signed-off-by: mrieggeramzn <mriegger@amazon.com>

* no blending if last cascade

Signed-off-by: mrieggeramzn <mriegger@amazon.com>

* Remove unused

Signed-off-by: mrieggeramzn <mriegger@amazon.com>
4 years ago
Santi Paprika 0bae6d062f Remove pows and sqrts from attenuation computation + readjust attenuation parameter bounds (https://github.com/o3de/o3de/pull/6428#discussion_r776071926, https://github.com/o3de/o3de/pull/6428#discussion_r776066792)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 41e8e5dc89 Add nit empty space
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 69df812941 Add explanations for default constant parameters + define as separate const variables (https://github.com/o3de/o3de/pull/6428#discussion_r776073076, https://github.com/o3de/o3de/pull/6428#discussion_r776072881, https://github.com/o3de/o3de/pull/6428#discussion_r776069391)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika c814be22fd Saturate (NdL + bias) to preserve energy (https://github.com/o3de/o3de/pull/6428#discussion_r774253478, https://github.com/o3de/o3de/pull/6428#discussion_r776069110)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 7052b99671 Add reference for skin-specific profiles (https://github.com/o3de/o3de/pull/6428/files#r776068153)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 60ec8c3cfb Alias shadowCoords memory instead of using local variable (https://github.com/o3de/o3de/pull/6428#discussion_r774255818 cont'd)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 6dbb8e1794 Use local shrinked shadow coords (https://github.com/o3de/o3de/pull/6428#discussion_r774255818)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 46abff3093 Rename 'angleOffset' to 'transmissionNdLBias' (https://github.com/o3de/o3de/pull/6428#discussion_r774253626)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika eda405f5f1 Move attenuation computation into GetBackLighting (https://github.com/o3de/o3de/pull/6428#discussion_r774259148)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 6e3ada487e Move penumbra computation back to original place.
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 038c71a660 Move mode-specific behavior into GetBackLighting (improvement on https://github.com/o3de/o3de/pull/6428#discussion_r774259781 and c700b95c8d)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 14683bf3ef Fix nits (remove residual comment)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika c700b95c8d Avoid mode-specific transmission distance initialization (potential fix for https://github.com/o3de/o3de/pull/6428#discussion_r774259781)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 2d45ecb616 Fix nits (https://github.com/o3de/o3de/pull/6428#discussion_r774251316 , https://github.com/o3de/o3de/pull/6428#discussion_r774252019)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
rgba16f 67689d48cc
Add precise keyword to the depth and forward pass shaders. (#6536)
* Add precise keyword to the depth and forward pass shaders. Make sure metal shader pipeline passes the invariant along

Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>

* Update with VickyAtAZ's feedback, split the preserve invariance into a separate string

Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>

* Fix attribute comment alignment in the shaders

Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com>
4 years ago
antonmic a839a8f761 added defines in the shaders to turn off clear coat, transmission and area light types. Allows for thiner surface data and more control over features when authoring bespoke material shaders
Signed-off-by: antonmic <56370189+antonmic@users.noreply.github.com>
4 years ago
Santi Paprika 84829dd8ee Make scale parameter influence output instead of transmission distance
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 90bf2520be Add and expose distance attenuation to compensate low-res shadow maps
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 78aa73e3fd Remove thickness + refactor scale parameter influence
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 8de5f8b938 Use geometry normals instead of altered-by-maps normals
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 2e5df3f018 Avoid negative thickness values
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 4a10b5ac62 Update T(s) function explanation (comment)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 7e78c260c1 Use generic diffusion profiles instead of skin-specific
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika d951cd332f Consider default thickness value for quadlight fast approx mode
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 1178bc1420 Add disk light support for thin object translucency
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika d1b19a51d5 Add point light thin transmission support
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 97c36a71a2 Move directional shadow coordinates computation to PS + Fix clamp values
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 2b99867225 Add informative comments for directional light thin scattering
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 348c3cc0f6 Expose angle offset below (N.L)
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 9f8994823b Fix naming for transmission distance parameter
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 85d206c0c8 Support directional lights with disabled shadows
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 1417488a2b Increase scale range + expose shrink factor
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
Santi Paprika 9825d6aba3 Thin transmission mode fix for directional lights
Signed-off-by: Santi Paprika <santi.gonzalez.cs@gmail.com>
4 years ago
antonmic fbd7b67e11 added some explicit use of float3
Signed-off-by: antonmic <56370189+antonmic@users.noreply.github.com>
4 years ago
dmcdiarmid-ly 4e7a45a6c5 Merge branch 'development' into Atom/dmcdiar/ATOM-16896 4 years ago