From 30ef0c80a35237002226e23f490380b0656168ab Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Mon, 20 Apr 2020 21:59:12 +0200 Subject: [PATCH] Document how to apply prototype textures to CSG nodes --- tutorials/3d/csg_tools.rst | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tutorials/3d/csg_tools.rst b/tutorials/3d/csg_tools.rst index 82a127906..2117ca4ea 100644 --- a/tutorials/3d/csg_tools.rst +++ b/tutorials/3d/csg_tools.rst @@ -235,3 +235,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 `__. + +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**.