shader_materials.rst 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 SpatialMaterial, CanvasItemMaterial and
  8. ParticlesMaterial (@TODO link to tutorials/classes). They are flexible implementations that cover most
  9. 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 blendings.
  14. - Create animated materials, or materials that change with 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, that responds to baked animations or force fields.
  19. - And much more!
  20. Traditionally, most engines will ask you to learn GLSL, HLSL or CG,
  21. which are pretty complex for the skillset of most artists. Godot uses a
  22. simplified version of a shader language that will detect errors as you
  23. type, so you can see your edited shaders in real-time. Additionally, it
  24. is possible to edit shaders using a visual, node-based graph editor.
  25. Creating a ShaderMaterial
  26. -------------------------
  27. Create a new ShaderMaterial in some object of your choice. Go to the
  28. "Material" property and create a ShaderMaterial.
  29. .. image:: img/shader_material_create.png
  30. Edit the newly created shader, and the shader editor will open:
  31. .. image:: img/shader_material_editor.png
  32. Converting to ShaderMaterial
  33. ----------------------------
  34. It is possible to convert from SpatialMaterial, CanvasItemMaterial and
  35. ParticlesMaterial to ShaderMaterial. To do this go to the material properties
  36. and enable the convert option.
  37. .. image:: img/shader_material_convert.png