shader_materials.rst 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. .. _doc_shader_materials:
  2. Shader materials
  3. ================
  4. Introduction
  5. ------------
  6. For the most common cases, Godot provides ready to use materials for
  7. most types of shaders, such as :ref:`SpatialMaterial <class_SpatialMaterial>`,
  8. :ref:`CanvasItemMaterial <class_CanvasItemMaterial>` and :ref:`ParticlesMaterial <class_ParticlesMaterial>`.
  9. They are flexible implementations that cover most use cases.
  10. Shader materials allow writing a custom shader directly, for maximum flexibility.
  11. Examples of this are:
  12. - Create procedural textures.
  13. - Create complex texture blending effects.
  14. - Create animated materials, or materials that change over time.
  15. - Create refractive effects or other advanced effects.
  16. - Create special lighting shaders for more exotic materials.
  17. - Animate vertices, like tree leaves or grass.
  18. - Create custom particle code.
  19. - And much more!
  20. Godot provides built in functionality to make frequent operations
  21. easier. Additionally, Godot's shader editor will detect errors as you
  22. type, so you can see your edited shaders in real-time. It is also
  23. possible to edit shaders using a visual, node-based graph editor.
  24. Creating a ShaderMaterial
  25. -------------------------
  26. Create a new ShaderMaterial in some object of your choice. Go to the
  27. "Material" property and create a ShaderMaterial.
  28. .. image:: img/shader_material_create.png
  29. Edit the newly created shader, and the shader editor will open:
  30. .. image:: img/shader_material_editor.png
  31. Converting to ShaderMaterial
  32. ----------------------------
  33. It is possible to convert from SpatialMaterial, CanvasItemMaterial and
  34. ParticlesMaterial to ShaderMaterial. To do so, go to the material properties
  35. and select the convert option.
  36. .. image:: img/shader_material_convert.png