Merge branch 'master' into 3.2

This commit is contained in:
Rémi Verschelde
2020-04-21 14:02:11 +02:00
14 changed files with 123 additions and 41 deletions

View File

@@ -11,6 +11,16 @@ Level prototyping is one of the main uses of CSG in Godot. This technique allows
users to create simple versions of most common shapes by combining primitives.
Interior environments can be created by using inverted primitives.
.. note:: The CSG nodes in Godot are mainly intended for prototyping. There is
no built-in support for UV mapping or editing 3D polygons (though
extruded 2D polygons can be used with the CSGPolygon node).
If you're looking for an easy to use level design tool for a project,
you may want to use `Qodot <https://github.com/Shfty/qodot-plugin>`__
instead. It lets you design levels using
`TrenchBroom <https://kristianduske.com/trenchbroom/>`__ and import
them in Godot.
.. image:: img/csg.gif
Introduction to CSG nodes
@@ -235,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**.

View File

@@ -694,9 +694,9 @@ If the currently loaded/open scene is ``Testing_Area.tscn``, we'd be adding our
.. warning:: As mentioned later below in the section on adding sounds, this method makes an assumption. This will be explained later
in the section on adding sounds in :ref:`doc_fps_tutorial_part_three`
Next we set the global transform of the clone to the ``Pistol_Aim_Point``'s global transform. The reason we do this is so the bullet is spawned at the end of the pistol.
Next we set the global transform of the clone to the ``Pistol_Point``'s global transform. The reason we do this is so the bullet is spawned at the end of the pistol.
You can see that ``Pistol_Aim_Point`` is positioned right at the end of the pistol by clicking the :ref:`AnimationPlayer <class_AnimationPlayer>` and
You can see that ``Pistol_Point`` is positioned right at the end of the pistol by clicking the :ref:`AnimationPlayer <class_AnimationPlayer>` and
scrolling through ``Pistol_fire``. You'll find the position is more or less at the end of the pistol when it fires.
Next we scale it up by a factor of ``4`` because the bullet scene is a little too small by default.