atteneder / glTFast

Efficient glTF 3D import / export package for Unity
Other
1.24k stars 250 forks source link

Dynamic branch shaders/shader graphs with less variants. #703

Open atteneder opened 2 months ago

atteneder commented 2 months ago

The current glTFast shader (graphs) have many shader keywords that are used to enable or disable certain material features (e.g. emission). While this improves runtime complexity and thus increases performance, it creates a large number of shader variants.

Another way to solve this problem is to use dynamic branching instead of keywords. While such a shader may perform worse at runtime, it would have a lot less variants.

This is especially useful if it's unknown upfront which glTF material features/extension will be used (e.g. a generic glTF viewer).

This wouldn't be a complete replacement for the existing shaders, but an alternative.

gkiernozek commented 1 month ago

🚀