Focusing on Shaders

Hi there, first of all, thanks for the initiative!

Following Jason’s last message, right now we can use #ifdefs only on shader code and to add some new defines.

What about making the new parser work on any line of the shader, we could use a new variant manager that would work for properties, multi_compile, basically anything, and based on the chosen variant, a new shader is compiled internally and the material would show the new props, add new keywords, etc.

For instance, I have a super basic parser for my vegetation asset, where I have these text-based presets, and based on some criteria, the preset lines are taken into account or not. No fancy stuff, just use or not the next lines if the criteria are met:

7682689--960430--upload_2021-11-24_9-6-18.png

Just throwing a basic idea here, it could use a new syntax.
7682689--960433--upload_2021-11-24_9-13-30.png

This would be similar to how Amplify Shader Editor has these function options where you can select an option and based on that, more options are unfolding or hiding, it adds properties, new keywords, everything that goes through that option. Here is an example:

So instead of creating tons of unused variants, a new shader is created with only those specific features. I think Jason does the same with Micro Splat, with each option selected, a new shader is compiled.

7682689--960424--upload_2021-11-24_8-41-40.png

1 Like