Convert material to shader code, how?

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


the doc says you can convert material to shader code:

How to get the code?



:bust_in_silhouette: Reply From: Inces

In Material properties in editor there is Shader property. For 3D models You can choose there new spatial material or new shader material. Spatial material is built-in shader with code hidden, it is that thing You can choose albedo color, roughness, metallic and many other properties. When You choose to use it and create new spatial material, You can set all its properties as You like, and when You click Shader property again, You will notice a new option there - convert to shader material. This will not change any properties, and You will have access to spatial materials code, all properties will be transormed into its uniforms. The same applies to particles material.

Hi Inces, that’s the solution, I’ve found it. Thank you very much, Mike

MikeMikeMike | 2022-01-12 20:29

The answer is:

  1. Assign the StandardMaterial3D you wish to convert to shader code to a MeshInstance3D’s Surface Material Override slot.
  2. Right-click on the material preview.
  3. Click “Convert to ShaderMaterial”