Merge pull request #3421 from Calinou/doc-csg-prototype-textures

Document how to apply prototype textures to CSG nodes
This commit is contained in:
Rémi Verschelde
2020-04-21 13:39:54 +02:00
committed by GitHub

View File

@@ -245,3 +245,41 @@ this:
You've successfully prototyped a room level with the CSG tools in Godot.
CSG tools can be used for designing all kinds of levels, such as a maze
or a city; explore its limitations when designing your game.
Using prototype textures
------------------------
Godot's :ref:`doc_spatial_material` supports *triplanar mapping*, which can be
used to automatically apply a texture to arbitrary objects without distortion.
This is handy when using CSG as Godot doesn't support editing UV maps on CSG
nodes yet. Triplanar mapping is relatively slow, which usually restricts its
usage to organic surfaces like terrain. Still, when prototyping, it can be used
to quickly apply textures to CSG-based levels.
.. note:: If you need some textures for prototyping, Kenney made a
`set of CC0-licensed prototype textures <https://kenney.nl/assets/prototype-textures>`__.
There are two ways to apply a material to a CSG node:
- Applying it to a CSGCombiner node as a material override
(**Geometry > Material Override** in the Inspector). This will affect its
children automatically, but will make it impossible to change the material in
individual children.
- Applying a material to individual nodes (**Material** in the Inspector). This
way, each CSG node can have its own appearance. Subtractive CSG nodes will
apply their material to the nodes they're "digging" into.
To apply triplanar mapping to a CSG node, select it, go to the Inspector, click
the **[empty]** text next to **Material Override** (or **Material** for
individual CSG nodes). Choose **New SpatialMaterial**. Click the newly created
material's icon to edit it. Unfold the **Albedo** section and load a texture
into the **Texture** property. Now, unfold the **Uv1** section and check
**Triplanar**. You can change the texture offset and scale on each axis by
playing with the **Scale** and **Offset** properties just above. Higher values
in the **Scale** property will cause the texture to repeat more often.
.. tip:: You can copy a SpatialMaterial to reuse it across CSG nodes. To do so,
click the dropdown arrow next to a material property in the Inspector
and choose **Copy**. To paste it, select the node you'd like to apply
the material onto, click the dropdown arrow next to its material
property then choose **Paste**.