Can i ignore the fragment part of a shader?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SodeT

I am creating a tree and was wondering if it is possible to apply a material while at the same time having a vertex shader that makes the tree sway forwards and backwards a bit.

My problem is that i can’t apply both the shader and material at the same time.

:bust_in_silhouette: Reply From: Calinou

It’s not possible to use vertex() and fragment() functions from different shaders yet.

However, you can convert a SpatialMaterial resource to a ShaderMaterial. First, configure your material so that the correct shader version is used (with the features you need), then use this button in the SpatialMaterial resource dropdown by clicking on the arrow on the right of the resource:

You can then click the ShaderMaterial resource, edit the shader and modify its vertex() function.

Thank you so much, this has been bugging me for so long!

SodeT | 2021-11-07 20:16