Replies: 1 comment 10 replies
-
To my knowledge, this is already possible but not trivial. cc @QbieShay who I remember implementing something like this in a project. |
Beta Was this translation helpful? Give feedback.
10 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem
Simply creating shaders for each type of visual effects rapidly becomes a mess of all the options you could want depending on what effect you're trying to achieve:
Sometimes I'll need 1, 2 or 3 textures, sometimes it's additive, sometimes it's mix blending, sometimes I want soft "particles" and sometimes i want billboard (in various flavors), sometimes the 2nd texture's color is multiplied with the first and sometimes it's used as alpha. sometimes the 3rd texture distorts UV and sometimes I want it to be used as a palette, sometimes the textures scroll by time, sometimes I need them to be by instance so I can control the scrolling...
Depending on the effect I'll need various combinations of all of the above and more. It quickly turns into a big mess and the shader names become a light novel trying to describe what that particular shader's fixed options are... I've tried using .gdshaderinc but while it reduces the copypasting it doesn't really fix the problem.
Solution?
What is needed is something like a StandardMaterial3D, that generates a shader depending on the selected options.
While StandardMaterial3D has a lot of options for "normal" materials, when making materials for visual effects, it needs a different set of options (see Problem section for examples).
Because the options a "VisualEffectMaterial3D" should contain would be different for every project, we should be able to extend Material into our own "VisualEffectMaterial3D", like StandardMaterial3D does.
I initially thought I could just extend ShaderMaterial, and while the early results were promising (https://streamable.com/pls2va), there are some issues:
VfxMaterial.zip Here's the material I made for this if you'd like to give it a try.
Beta Was this translation helpful? Give feedback.
All reactions