Open Geenz opened 1 year ago
I've done quite a few things with mesh renderer layering that does things like this, it'll definitely be cool to have actual material layering!
I do have a question though, will this help performance significantly? I know it can depend on what you're doing and what materials you use, but I imagine this would perform better.
I'm curious on how vertex displacement will interact with a layering system. Specifically, will there be a way for layered materials to know they're supposed to apply post-transform vs pre-transform, since right now there is no viable way to stack anything on a vertex displaced material?
@Geenz - you marked this issue as blocked- but I'm not certain what specifically it is blocked by? Could you elaborate?
Is your feature request related to a problem? Please describe.
Material stacking is sub-optimal with regards to forward compatibility with some feature sets (such as some compatibility being problematic under Color Management), and overall isn't optimal from a performance standpoint often resulting in significant overdraw in some cases. Its usage can result in undefined behavior being observed on some meshes - particularly skinned ones.
It's also extremely limited in its capabilities - largely as a result of a lack of engineering with our existing shaders to support this usecase.
Describe the solution you'd like
Material layers is a feature set not entirely unlike Poiyomi or Unreal Substrate. The basic premise is to enable different material attributes to be "layered" on top of one another, using different masks, offsets, etc.
The idea is to enable different built-in shaders to interact with each other - effectively enabling many more complex effects to be achieved with a small number of different shaders. In the short term, this helps us mitigate a lack of custom shaders prior to the new rendering engine shipping. In the long term, this enables massively complex effects being able to be composed when combined with custom shaders in an optimized and forward compatible solution.
In some regards, this will also simplify our existing shaders with the expectation that they will be "layered" on top of other surfaces.
Some examples include:
Describe alternatives you've considered
Working around material stacking limitations, adding more shader attributes to already difficult to maintain existing shaders.
Finding a way to implement Poiyomi - this doesn't work due to the dependence of various Unity components that we will not be able to support long term. It would also make our already lengthy (~2 days for all variants for all platforms) shader build times go through the roof which comes at the detriment of productivity.
Additional Context
This will not be a direct replacement for systems such as Poiyomi, but rather a way to better compose complex surface types. You may be able to attain similar effects as Poiyomi, however.
It's perhaps better to draw comparisons long term to something like Unreal Substrate, where surface shading can be "layered" and "mixed" from multiple materials - with the specific materials being mixed being similar to substrate's "slabs" that are blended in sequence from foreground on top of a background.