Hello ! Shader

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

Hello. I began to play around with shader =P . Do you know if i can apply a shader over another shader . I mix them but if i want to do somthing like frozing my ennemie or things like that . How to apply shader without losing or adding code in the preexisting shader ! I Thanks !

:bust_in_silhouette: Reply From: zhyrin

Shaders can be applied in multiple stages if I’m not mistaken.
A mesh (resource) can have a shader, a material can define a next pass material, a mesh instance3D (node) can have a surface material override, a geometry instance3D (node) can have a material override and a material overlay (probably what you want).

thanks ill take a look

purple_mage | 2023-03-29 13:24

I found how ty !!!

 var materialVar = preload("res://Buddy/MaterialSaved.tres")
whatevermesh.set_surface_override_material( 0, materialVar)

easy !

purple_mage | 2023-03-29 14:05

hmm do you know if its possible to remove the material after ?

how do i procced . I save the material before replacing it ?

and when im done with the override i put the one before on it ?

EDIT : you just set it to null and voila ! ty man

purple_mage | 2023-03-29 14:12

hitbox.set_material_overlay( material)

this doesnt work. do you know why

purple_mage | 2023-03-29 14:27