|
@@ -12,10 +12,10 @@ The aim of CSG in Godot is for it to be used in level prototyping. This techniqu
|
|
|
Introduction to CSG nodes
|
|
|
-------------------------
|
|
|
|
|
|
-Like other features of Godot, CSG is supported in form of nodes, these are the CSG nodes:
|
|
|
+Like other features of Godot, CSG is supported in the form of nodes; these are the CSG nodes:
|
|
|
|
|
|
- :ref:`CSGBox <class_CSGBox>`
|
|
|
-- :ref:`CSGCylinder <class_CSGCylinder>` (Also support cone)
|
|
|
+- :ref:`CSGCylinder <class_CSGCylinder>` (Also supports cone)
|
|
|
- :ref:`CSGSphere <class_CSGSphere>`
|
|
|
- :ref:`CSGTorus <class_CSGTorus>`
|
|
|
- :ref:`CSGPolygon <class_CSGPolygon>`
|
|
@@ -52,13 +52,13 @@ The :ref:`CSGPolygon <class_CSGPolygon>` node extrude along a Polygon drawn in 2
|
|
|
|
|
|
.. image:: img/csg_poly.png
|
|
|
|
|
|
-.. note:: ``Path`` mode needs a ``Path`` :ref:`Path <class_Path>` node to operate. In ``Path``, draw the path and the polygon in ``CSGPolygon`` will extrude along the path.
|
|
|
+.. note:: The ``Path`` mode must be provided with a :ref:`Path <class_Path>` node to work. In the ``Path`` node, draw the path and the polygon in ``CSGPolygon`` will extrude along the given path.
|
|
|
|
|
|
|
|
|
Custom meshes
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
-Any mesh can be used for :ref:`CSGMesh <class_CSGMesh>`, the mesh can be modelled in other software and imported into Godot. Multiple materials is supported. There are some restrictions for geometry:
|
|
|
+Any mesh can be used for :ref:`CSGMesh <class_CSGMesh>`; the mesh can be modelled in other software and imported into Godot. Multiple materials are supported. There are some restrictions for geometry:
|
|
|
|
|
|
- It must be closed
|
|
|
- It must not self-intersect
|
|
@@ -74,7 +74,7 @@ The :ref:`CSGCombiner <class_CSGCombiner>` node is an empty shape used for organ
|
|
|
Process order
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
-Every CSG node will first process its children nodes and their operations: union, intersection or subtraction, in tree order and apply them to itself one after the other.
|
|
|
+Every CSG node will first process its children nodes and their operations: union, intersection or subtraction, in tree order, and apply them to itself one after the other.
|
|
|
|
|
|
.. note:: A note on performance : Make sure CSG geometry remains relatively simple, as complex meshes can take a while to process. If adding objects together (such as table and room objects), please create them as separate CSG trees. Forcing too many objects in a single tree will eventually start affecting performance. Only use binary operations where you actually need them.
|
|
|
|
|
@@ -83,9 +83,10 @@ Prototyping a level
|
|
|
|
|
|
We will prototype a room to practice the use of CSG tools.
|
|
|
|
|
|
-.. tip:: Working in ``Orthogonal`` view give a better view when combining the CSG shapes.
|
|
|
+.. tip:: Working in ``Orthogonal`` projection gives a better view when combining the CSG shapes.
|
|
|
|
|
|
Our level will contain these objects:
|
|
|
+
|
|
|
1. A room
|
|
|
2. A bed
|
|
|
3. A lamp
|
|
@@ -94,11 +95,11 @@ Our level will contain these objects:
|
|
|
|
|
|
Create a scene with a Spatial node as root node.
|
|
|
|
|
|
-.. tip:: The default lighting of the environment cannot provide clear shading in some angle, display in ``overdraw`` mode or add a direction light to help you see clearly.
|
|
|
+.. tip:: The default lighting of the environment cannot provide clear shading at some angles; display in ``overdraw`` mode or add a direction light to help you see clearly.
|
|
|
|
|
|
.. image:: img/csg_overdraw.png
|
|
|
|
|
|
-Then, create a CSGBox and name it room, select invert face and change the dimensions of your room.
|
|
|
+Then, create a CSGBox and name it room, enable ``Invert Faces`` and change the dimensions of your room.
|
|
|
|
|
|
.. image:: img/csg_room.png
|
|
|
|
|
@@ -112,11 +113,11 @@ Create 1 ``CSGBox`` children node in ``union`` mode for the surface and adjust t
|
|
|
|
|
|
Create 4 ``CSGBox`` children nodes in ``union`` mode for the legs and adjust the dimensions.
|
|
|
|
|
|
-Adjust the position to form a desk.
|
|
|
+Adjust their placement to resemble a desk.
|
|
|
|
|
|
.. image:: img/csg_desk.png
|
|
|
|
|
|
-.. note:: CSG nodes inside a ``CSGCombiner`` will only process their operation within the combiner, therefore, ``CSGCombiners`` are used to organize the CSG nodes.
|
|
|
+.. note:: CSG nodes inside a ``CSGCombiner`` will only process their operation within the combiner, therefore ``CSGCombiners`` are used to organize the CSG nodes.
|
|
|
|
|
|
Create a ``CSGCombiner`` and name it ``bed``.
|
|
|
|
|
@@ -126,7 +127,7 @@ Create a ``CSGBox`` and adjust its dimension for the bed. Create another ``CSGBo
|
|
|
|
|
|
.. image:: img/csg_bed_mat.png
|
|
|
|
|
|
-We will create another ``CSGCombiner`` and name it ``pillow`` as the child of ``bed``. The scene tree should look like this:
|
|
|
+We will create another ``CSGCombiner``, named ``pillow``, as the child of ``bed``. The scene tree should look like this:
|
|
|
|
|
|
.. image:: img/csg_bed_tree.png
|
|
|
|
|
@@ -134,13 +135,13 @@ We will combine 3 ``CSGshpere`` in ``union`` mode to form a pillow. Scale the y-
|
|
|
|
|
|
.. image:: img/csg_pillow_smooth.png
|
|
|
|
|
|
-Select the `pillow` node and switch the mode to ``subtraction``, the combined spheres will cut a hole on the mattress.
|
|
|
+Select the `pillow` node and switch the mode to ``subtraction``; the combined spheres will cut a hole into the mattress.
|
|
|
|
|
|
.. image:: img/csg_pillow_hole.png
|
|
|
|
|
|
-Try to re-parent the ``pillow`` node to the root ``Spatial`` node, the hole will disappear.
|
|
|
+Try to re-parent the ``pillow`` node to the root ``Spatial`` node; the hole will disappear.
|
|
|
|
|
|
-.. note:: this is to illustrate the effect of CSG process order. Since the root node is not a CSG node, the ``CSGCombiner`` nodes are the end of the operations, this shows the use of ``CSGCombiner`` to organize the CSG scene.
|
|
|
+.. note:: This is to illustrate the effect of CSG process order. Since the root node is not a CSG node, the ``CSGCombiner`` nodes are the end of the operations; this shows the use of ``CSGCombiner`` to organize the CSG scene.
|
|
|
|
|
|
Undo the re-parent after observing the effect.
|
|
|
|
|
@@ -153,11 +154,11 @@ Create a ``CSGCombiner`` and name it ``lamp``.
|
|
|
|
|
|
A lamp consists of 3 parts: the stand, the pole, and the lampshade.
|
|
|
|
|
|
-Create a ``CSGCylinder`` enable option ``cone`` and make it the stand. Create another ``CSGCylinder`` and adjust the dimensions to use it as a pole.
|
|
|
+Create a ``CSGCylinder``, enable the ``cone`` option and make it the stand. Create another ``CSGCylinder`` and adjust the dimensions to use it as a pole.
|
|
|
|
|
|
.. image:: img/csg_lamp_pole_stand.png
|
|
|
|
|
|
-We will use ``CSGPolygon`` for the lampshade. Use ``Spin`` mode for the ``CSGPolygon`` and draw a trapezium in front view, this shape will extrude around the origin and form the lampshade.
|
|
|
+We will use ``CSGPolygon`` for the lampshade. Use ``Spin`` mode for the ``CSGPolygon`` and draw a trapezoid in ``Front View`` (numeric keypad 1); this shape will extrude around the origin and form the lampshade.
|
|
|
|
|
|
.. image:: img/csg_lamp_spin.png
|
|
|
|
|
@@ -165,7 +166,7 @@ We will use ``CSGPolygon`` for the lampshade. Use ``Spin`` mode for the ``CSGPol
|
|
|
|
|
|
.. image:: img/csg_lamp_extrude.png
|
|
|
|
|
|
-Adjust the position of the 3 parts to make it a ``lamp``.
|
|
|
+Adjust the placement of the 3 parts to make it a ``lamp``.
|
|
|
|
|
|
.. image:: img/csg_lamp.png
|
|
|
|
|
@@ -181,7 +182,7 @@ Duplicate the ``CSGBox`` and shorten the dimension of each axis and change the m
|
|
|
|
|
|
.. image:: img/csg_shelf_subtract_menu.png
|
|
|
|
|
|
-You almost build a shelf. Create one more ``CSGBox`` for dividing the shelf into two levels.
|
|
|
+You've almost built a shelf. Create one more ``CSGBox`` for dividing the shelf into two levels.
|
|
|
|
|
|
.. image:: img/csg_shelf.png
|
|
|
|
|
@@ -189,7 +190,7 @@ Position your furniture in your room as you like and your scene should look this
|
|
|
|
|
|
.. image:: img/csg_room_result.png
|
|
|
|
|
|
-You prototyped successfully a room level with the csg tools in Godot. CSG tools can be used in designing all kind of level such as a maze or a city, explore the limitation of it when designing your game.
|
|
|
+You've successfully prototyped a room level with the CSG tools in Godot. CSG tools can be used for designing all kinds of level, such as a maze or a city; explore the limitations of it when designing your game.
|
|
|
|
|
|
|
|
|
|