Heading capitalization fixes + misc edits

This commit is contained in:
Rémi Verschelde
2018-08-23 10:57:22 +02:00
parent 8cd23c4d48
commit e29dc58cbb
33 changed files with 179 additions and 210 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
Creating 3D Content
Creating 3D content
===================
.. toctree::
+4 -6
View File
@@ -1,6 +1,6 @@
.. _doc_making_trees:
Making Trees
Making trees
============
This is a short tutorial on how to make trees and other types of vegetation from scratch.
@@ -20,7 +20,7 @@ https://sketchfab.com/models/ea5e6ed7f9d6445ba69589d503e8cebf
and opened it in Blender.
Paint with Vertex Colors
Paint with vertex colors
------------------------
The first thing you may want to do is to use the vertex colors to paint how much the tree will sway when there is wind. Just use the vertex color painting tool of your favorite 3D modelling program and paint something like this:
@@ -84,12 +84,10 @@ And this is pretty much it.
The trunk shader is similar, except it does not write to the alpha channel (thus no alpha prepass is needed) and does not require transmission to work. Both shaders can be improved by adding normal mapping, AO and other maps.
Improving the Shader:
---------------------
Improving the shader
--------------------
There are many more resources on how to do this that you can read. Now that you know the basics, a recommended read is the chapter from GPU Gems3 about how Crysis does this
(focus mostly on the sway code, as many other techniques shown there are obsolete):
https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch16.html
@@ -1,6 +1,6 @@
.. _doc_custom_resource_format_loaders:
Custom Resource Format Loaders
Custom resource format loaders
==============================
Introduction
@@ -14,9 +14,8 @@ loaded resources must be stateless.
This guide assumes the reader knows how to create C++ modules and godot
data types. If not, refer to this guide :ref:`doc_custom_modules_in_c++`.
References:
~~~~~~~~~~~
References
~~~~~~~~~~
- :ref:`ResourceLoader<class_resourceloader>`
- `core/io/resource_loader.cpp <https://github.com/godotengine/godot/blob/master/core/io/resource_loader.cpp#L258>`__
@@ -36,8 +35,8 @@ What not?
ImageFormatLoader should be used to load images.
References:
~~~~~~~~~~~
References
~~~~~~~~~~
- `core/io/image_loader.h <https://github.com/godotengine/godot/blob/master/core/io/image_loader.h>`__
@@ -107,7 +106,7 @@ read and handle data serialization.
}
Creating Custom Data Types
Creating custom data types
--------------------------
Godot may not have a proper substitute within its :ref:`doc_core_types`
@@ -207,13 +206,14 @@ calls into ``std::istream``.
};
References:
~~~~~~~~~~~
References
~~~~~~~~~~
- `istream <http://www.cplusplus.com/reference/istream/istream/>`__
- `streambuf <http://www.cplusplus.com/reference/streambuf/streambuf/?kw=streambuf>`__
- `core/io/fileaccess.h <https://github.com/godotengine/godot/blob/master/core/os/file_access.h>`__
Registering the New File Format
Registering the new file format
-------------------------------
Godot registers ``ResourcesFormatLoader`` with a ``ResourceLoader``
@@ -240,10 +240,10 @@ when ``load`` is called.
memdelete(my_json_loader);
}
References:
~~~~~~~~~~~
- `core/io/resource_loader.cpp <https://github.com/godotengine/godot/blob/master/core/io/resource_loader.cpp#L280>`__
References
~~~~~~~~~~
- `core/io/resource_loader.cpp <https://github.com/godotengine/godot/blob/master/core/io/resource_loader.cpp#L280>`__
Loading it on GDScript
----------------------
+18 -18
View File
@@ -1,4 +1,4 @@
TSCN File Format
TSCN file format
================
A :code:`.tscn` File format is the "Text SCeNe" file format and represents
@@ -15,8 +15,7 @@ For those looking for a complete description, the parsing is handled in the
file `scene_format_text.cpp <https://github.com/godotengine/godot/blob/master/scene/resources/scene_format_text.cpp>`_
in the class :code:`ResourceFormatLoaderText`
File Structure
File structure
--------------
There are five main sections inside the TSCN File:
@@ -27,7 +26,6 @@ There are five main sections inside the TSCN File:
3. Nodes
4. Connections
The file descriptor looks like :code:`[gd_scene load_steps=1 format=2]` And
should be the first entry in the file. The load_steps parameter should (in
theory) be the number of resources within the file, though in practice it's
@@ -39,9 +37,9 @@ for all of the items in the section.
For example, the heading of all external resources should start with
:code:`[ext_resource .....]`
Entries inside the file
~~~~~~~~~~~~~~~~~~~~~~~
A heading looks like:
:code:`[<resource_type> key=value key=value key=value ...]`
Where resource_type is one of:
@@ -60,7 +58,7 @@ so on. For example, a spatial node looks like:
[node name="Cube" type="Spatial" parent="."]
transform=Transform( 1.0, 0.0, 0.0 ,0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 )
The Scene Tree
The scene tree
--------------
The scene tree is made up of... nodes! The heading of each node consists of
@@ -81,6 +79,7 @@ exactly one scene root. It it does not, Godot will fail to import the file.
The parent path of other nodes should be absolute, but without the scene
root's name. If it is a direct child of the scene root, it should be
:code:`"."`. Here is an example scene tree (but without any node content).
::
[node name="Player" type="Spatial"] ; The scene root
@@ -125,8 +124,8 @@ save a file with that node in it. Some example nodes are:
transform = Transform( 0.6859206557273865 , -0.32401350140571594 , 0.6515582203865051 , 0.0 , 0.8953956365585327 , 0.44527143239974976 , -0.7276763319969177 , -0.3054208755493164 , 0.6141703724861145 ,14.430776596069336 ,10.093015670776367 ,13.058500289916992 )
far = 100.0
Node Path
~~~~~~~~~
NodePath
~~~~~~~~
A tree structure is not enough to represent the whole scene, Godot use
a :code:`NodePath(Path/To/Node)` structure to refer to another node or
@@ -151,7 +150,8 @@ animation track use :code:`NodePath()` points to animated attribute in node.
...
Skeleton
~~~~~~~~~
~~~~~~~~
Skeleton node inherits Spatial node, besides that it may have a list
of bones described in key, value pair in the format :code:`bones/Id/Attribute=Value`,
attributes of bone consists of
@@ -196,6 +196,7 @@ An example of a skeleton node with two bones:
BoneAttachment
~~~~~~~~~~~~~~
BoneAttachment node is an intermediate node to describe some node being parented
to a single bone in Skeleton node. The BoneAttachment has a :code:`bone_name=NameOfBone`,
and the corresponding bone being the parent has the BoneAttachment node
@@ -225,7 +226,8 @@ An example of one MeshInstance parented to a bone in Skeleton:
transform = Transform(1.0, 0.0, 0.0, 0.0, 1.86265e-09, 1.0, 0.0, -1.0, 0.0, 0.0219986, -0.0343127, 2.25595)
AnimationPlayer
~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~
AnimationPlayer works as an animation lib. it has animations listed in the format
:code:`anim/Name=SubResource(ResourceId)`, each refers to a Animation
internal resource. All the animation resources use the root node of AnimationPlayer.
@@ -243,10 +245,9 @@ The root node is stored as :code:`root_node=NodePath(Path/To/Node)`.
anims/default = SubResource( 2 )
blend_times = [ ]
Resources
---------
Resources are components that make up the nodes. For example, a MeshInstance
node will have an accompanying ArrayMesh resource. The ArrayMesh resource
may be either internal or external to the TSCN file.
@@ -261,8 +262,7 @@ For example, to refer to the resource
:code:`[ext_resource id=3 type="PackedScene" path=....]` you would use
:code:`ExtResource(3)`
External Resources
External resources
~~~~~~~~~~~~~~~~~~
External resources are links to resources not contained within the TSCN file
@@ -283,8 +283,7 @@ Some example external resources are:
[ext_resource path="res://characters/player.dae" type="PackedScene" id=1]
[ext_resource path="metal.tres" type="Material" id=2]
Internal Resources
Internal resources
~~~~~~~~~~~~~~~~~~
A TSCN file can contain meshes, materials and other data, and these are
@@ -311,6 +310,7 @@ saved files, others can only be found by looking through Godot's source.
ArrayMesh
~~~~~~~~~
ArrayMesh consists of several surfaces, each in the format :code:`surface\Index={}`,
each surface is a set of vertex and a material.
@@ -362,7 +362,8 @@ An example of ArrayMesh:
}
Animation
~~~~~~~~~~
~~~~~~~~~
An animation resource consists of tracks. Besides, it has 'length', 'loop' and
'step' applied to all the tracks.
@@ -383,7 +384,6 @@ it includes:
- imported
- enabled
1) The :code:`type` must be put as the first attribute of each track.
The value of :code:`type` can be:
+4 -4
View File
@@ -118,7 +118,7 @@ changed:
hide()
emit_signal("hit")
Export Templates
Export templates
----------------
In order to export, you need to download the *export templates* from the
@@ -136,7 +136,7 @@ version that matches your version of Godot.
.. note:: If you upgrade Godot, you must download templates that match the new version
or your exported projects may not work correctly.
Export Presets
Export presets
--------------
Next, you can configure the export settings by clicking on *Project -> Export*:
@@ -156,13 +156,13 @@ of your game, such as an `.apk` for Android or an `.exe` for Windows.
In the "Resources" and "Features" tabs you can customize how the game is
exported for each platform. We can leave those settings alone for now.
Exporting by Platform
Exporting by platform
---------------------
In this section, we'll walk through the process for each platform,
including any additional software or requirements you'll need.
PC (Linux/MacOS/Windows)
PC (Linux/macOS/Windows)
~~~~~~~~~~~~~~~~~~~~~~~~
Exporting PC platforms works the same across the three supported operating
+2 -2
View File
@@ -30,7 +30,7 @@ if it were any other node.
In the above picture, Scene B was added to Scene A as an instance.
Instancing By Example
Instancing by example
---------------------
To learn how instancing works, let's start by downloading a sample
@@ -74,7 +74,7 @@ Press "Play" and watch the ball fall to the bottom of the screen:
.. image:: img/instancing_playbutton.png
Multiple Instances
Multiple instances
------------------
You can add as many instances as you like to a scene, either by using the
@@ -382,7 +382,7 @@ kept loaded and ready to use so that you can create as many
instances as desired. This is especially useful to quickly instance
several enemies, bullets, and other entities in the active scene.
Register Scripts as Classes
Register scripts as classes
---------------------------
Godot has a "Script Class" feature to register individual scripts with the
@@ -1,6 +1,6 @@
.. _doc_your_first_game:
Your First Game
Your first game
===============
Overview
@@ -24,7 +24,7 @@ final result:
**Why 2D?** 3D games are much more complex than 2D ones. You should stick to 2D
until you have a good understanding of the game development process.
Project Setup
Project setup
-------------
Launch Godot and create a new project. Then, download
@@ -39,7 +39,7 @@ This game will use portrait mode, so we need to adjust the size of the
game window. Click on Project -> Project Settings -> Display -> Window and
set "Width" to 480 and "Height" to 720.
Organizing the Project
Organizing the project
~~~~~~~~~~~~~~~~~~~~~~
In this project, we will make 3 independent scenes: ``Player``,
@@ -52,14 +52,14 @@ Dock in the upper left corner:
.. image:: img/filesystem_dock.png
Player Scene
Player scene
------------
The first scene we will make defines the ``Player`` object. One of the benefits
of creating a separate Player scene is that we can test it separately, even
before we've created other parts of the game.
Node Structure
Node structure
~~~~~~~~~~~~~~
To begin, click the "Add/Create a New Node" button and add an :ref:`Area2D <class_Area2D>`
@@ -84,7 +84,7 @@ Save the scene. Click Scene -> Save, or press ``Ctrl+S`` on Windows/Linux or ``C
conventions. Classes (nodes) use ``PascalCase``, variables and
functions use ``snake_case``, and constants use ``ALL_CAPS``.
Sprite Animation
Sprite animation
~~~~~~~~~~~~~~~~
Click on the ``Player`` node and add an :ref:`AnimatedSprite <class_AnimatedSprite>` node as a
@@ -128,7 +128,7 @@ When you're finished, your ``Player`` scene should look like this:
.. image:: img/player_scene_nodes.png
Moving the Player
Moving the player
~~~~~~~~~~~~~~~~~
Now we need to add some functionality that we can't get from a built-in
@@ -315,7 +315,7 @@ around the screen in all directions.
this likely means you spelled the node name wrong. Node names are case-sensitive
and ``$NodeName`` or ``get_node("NodeName")`` must match the name you see in the scene tree.
Choosing Animations
Choosing animations
~~~~~~~~~~~~~~~~~~~
Now that the player can move, we need to change which animation the
@@ -382,7 +382,7 @@ starts:
Hide();
Preparing for Collisions
Preparing for collisions
~~~~~~~~~~~~~~~~~~~~~~~~
We want ``Player`` to detect when it's hit by an enemy, but we haven't
@@ -470,7 +470,7 @@ the player when starting a new game.
collisionShape2D.Disabled = false;
}
Enemy Scene
Enemy scene
-----------
Now it's time to make the enemies our player will have to dodge. Their
@@ -481,7 +481,7 @@ despawn when they go offscreen.
We will build this into a ``Mob`` scene, which we can then *instance* to
create any number of independent mobs in the game.
Node Setup
Node setup
~~~~~~~~~~
Click Scene -> New Scene and we'll create the Mob.
@@ -520,7 +520,7 @@ As in the ``Player`` scene, add a ``CapsuleShape2D`` for the
collision. To align the shape with the image, you'll need to set the
``Rotation Degrees`` property to ``90`` under ``Node2D``.
Enemy Script
Enemy script
~~~~~~~~~~~~
Add a script to the ``Mob`` and add the following member variables:
@@ -602,7 +602,7 @@ node and add this code:
This completes the `Mob` scene.
Main Scene
Main scene
----------
Now it's time to bring it all together. Create a new scene and add a
@@ -631,7 +631,7 @@ follows:
In addition, set the ``One Shot`` property of ``StartTimer`` to "On" and
set ``Position`` of the ``StartPosition`` node to ``(240, 450)``.
Spawning Mobs
Spawning mobs
~~~~~~~~~~~~~
The Main node will be spawning new mobs, and we want them to appear at a
@@ -660,7 +660,7 @@ node as a child of ``MobPath`` and name it ``MobSpawnLocation``. This node will
automatically rotate and follow the path as it moves, so we can use it
to select a random position and direction along the path.
Main Script
Main script
~~~~~~~~~~~
Add a script to ``Main``. At the top of the script we use
@@ -1118,7 +1118,7 @@ sync with the changing score:
Now you're ready to play! Click the "Play the Project" button. You will
be asked to select a main scene, so choose ``Main.tscn``.
Finishing Up
Finishing up
------------
We have now completed all the functionality for our game. Below are some
@@ -1138,7 +1138,7 @@ screen.
You can also add a background image, if you have one, by using a
``Sprite`` node.
Sound Effects
Sound effects
~~~~~~~~~~~~~
Sound and music can be the single most effective way to add appeal to
@@ -1191,7 +1191,7 @@ all the way to ``0``.
.. seealso:: See :ref:`Particles2D <class_Particles2D>` for more details on using
particle effects.
Project Files
Project files
-------------
You can find a completed version of this project here:
+2 -2
View File
@@ -1,7 +1,7 @@
.. _doc_2d_lights_and_shadows:
Working with lights and shadows in 2D
=====================================
2D lights and shadows
=====================
Introduction
------------
+5 -9
View File
@@ -1,6 +1,6 @@
.. _doc_2d_movement:
2D Movement Overview
2D movement overview
====================
Introduction
@@ -25,7 +25,7 @@ input actions (see :ref:`InputEvent <doc_inputevent>` for details):
.. image:: img/movement_inputs.png
8-Way Movement
8-way movement
--------------
In this scenario, you want the user to press the four directional keys (up/left/down/right
@@ -112,11 +112,7 @@ its *length* to ``1``, and multiply by the desired speed.
.. tip:: If you've never used vector math before, or need a refresher,
you can see an explanation of vector usage in Godot at :ref:`doc_vector_math`.
Rotation + Movement
Rotation + movement
-------------------
This type of movement is sometimes called "Asteroids-style" because it resembles
@@ -206,7 +202,7 @@ in the same direction as the body. ``rotated()`` is a useful vector function
that you can use in many circumstances where you would otherwise need to apply
trigonometric functions.
Rotation + Movement (mouse)
Rotation + movement (mouse)
---------------------------
This style of movement is a variation of the previous one. This time, the direction
@@ -283,7 +279,7 @@ could get the same effect by setting the angle like this:
var rotation = GetGlobalMousePosition().AngleToPoint(Position);
Click-and-Move
Click-and-move
--------------
This last example uses only the mouse to control the character. Clicking
+3 -3
View File
@@ -154,7 +154,6 @@ portion of a circle? You will have to code a function to perform this and draw i
Arc function
^^^^^^^^^^^^
An arc is defined by its support circle parameters. That is: the center position
and the radius. The arc itself is then defined by the angle it starts from
and the angle at which it stops. These are the 4 parameters that we have to provide to our drawing.
@@ -234,6 +233,7 @@ increase the number of points.
Draw the arc on screen
^^^^^^^^^^^^^^^^^^^^^^
We now have a function that draws stuff on the screen:
It is time to call in the _draw() function.
@@ -265,10 +265,9 @@ Result:
.. image:: img/result_drawarc.png
Arc polygon function
^^^^^^^^^^^^^^^^^^^^
We can take this a step further and not only write a function that draws the plain
portion of the disc defined by the arc, but also its shape. The method is exactly
the same as previously, except that we draw a polygon instead of lines:
@@ -310,6 +309,7 @@ the same as previously, except that we draw a polygon instead of lines:
Dynamic custom drawing
^^^^^^^^^^^^^^^^^^^^^^
Alright, we are now able to draw custom stuff on screen. However, it is static:
Let's make this shape turn around the center. The solution to do this is simply
to change the angle_from and angle_to values over time. For our example,
+3 -3
View File
@@ -1,6 +1,6 @@
.. _doc_particle_systems_2d:
Particle Systems (2D)
Particle systems (2D)
=====================
Intro
@@ -49,7 +49,7 @@ the relevant texture property:
.. image:: img/particles2.png
Time Parameters
Time parameters
---------------
Lifetime
@@ -125,7 +125,7 @@ Fract Delta
This can be used to turn Fract Delta on or off.
Drawing Parameters
Drawing parameters
------------------
Visibility Rect
+12 -16
View File
@@ -1,6 +1,6 @@
.. _doc_baked_lightmaps:
Baked Lightmaps
Baked lightmaps
===============
Introduction
@@ -25,7 +25,7 @@ use case. In general, GIProbe looks better and is much
easier to set up. For low-end compatibility or mobile, though, Baked Lightmaps
are your only choice.
Visual Comparison
Visual comparison
-----------------
Here are some comparisons of how Baked Lightmaps vs GIProbe look. Notice that
@@ -36,8 +36,7 @@ smooth overall.
.. image:: img/baked_light_comparison.png
Setting Up
Setting up
----------
First of all, before the lightmapper can do anything, the objects to be baked need
@@ -81,7 +80,7 @@ It can be found in the Mesh menu:
This will generate a second set of UV2 coordinates which can be used for baking,
and it will also set the texture size automatically.
Unwrap on Scene import
Unwrap on scene import
~~~~~~~~~~~~~~~~~~~~~~
This is probably the best approach overall. The only downside is that, on large
@@ -112,7 +111,7 @@ Make sure, if something is failing, to check that the meshes have these UV2 coor
.. image:: img/baked_light_uvchannel.png
Setting up the Scene
Setting up the scene
--------------------
Before anything is done, a **BakedLight** Node needs to be added to a scene.
@@ -125,8 +124,7 @@ A sub-scene can be instanced several times, as this is supported by the baker, a
each will be assigned a lightmap of its own (just make sure to respect the rule
about scaling mentioned before):
Configure Bounds
Configure bounds
~~~~~~~~~~~~~~~~
Lightmap needs an approximate volume of the area affected because it uses it to
@@ -135,7 +133,7 @@ cover the scene with the volume as you do with GIProbe:
.. image:: img/baked_light_bounds.png
Setting Up Meshes
Setting up meshes
~~~~~~~~~~~~~~~~~
For a **MeshInstance** node to take part in the baking process, it needs to have
@@ -145,7 +143,7 @@ the "Use in Baked Light" property enabled.
When auto-generating lightmaps on scene import, this is enabled automatically.
Setting up Lights
Setting up lights
~~~~~~~~~~~~~~~~~
Lights are baked with indirect light by default. This means that shadowmapping
@@ -157,13 +155,13 @@ can be controlled from the **Bake Mode** menu in lights:
.. image:: img/baked_light_bake_mode.png
The modes are :
The modes are:
- **Disabled:** Light is ignored in baking. Keep in mind hiding a light will have no effect for baking, so this must be used instead.
- **Indirect:** This is the default mode. Only indirect lighting will be baked.
- **All:** Both indirect and direct lighting will be baked. If you don't want the light to appear twice (dynamically and statically), simply hide it.
Baking Quality
Baking quality
~~~~~~~~~~~~~~
BakedLightmap uses, for simplicity, a voxelized version of the scene to compute
@@ -185,7 +183,6 @@ Two modes of capturing indirect are provided:
- **Voxel Cone**: Trace: Is the default one, it's less precise but faster. Looks similar (but slightly better) to GIProbe.
- **Ray Tracing**: This method is more precise but can take considerably longer to bake. If used in low or medium quality, some scenes may produce grain.
Baking
------
@@ -197,7 +194,7 @@ when selecting the BakedLightmap node:
This can take from seconds to minutes (or hours) depending on scene size, bake
method and quality selected.
Configuring Bake
Configuring bake
~~~~~~~~~~~~~~~~
Several more options are present for baking:
@@ -212,8 +209,7 @@ Several more options are present for baking:
- **Extents**: Size of the area affected (can be edited visually)
- **Light Data**: Contains the light baked data after baking. Textures are saved to disk, but this also contains the capture data for dynamic objects which can be a bit heavy. If you are using .tscn formats (instead of .scn), you can save it to disk.
Dynamic Objects
Dynamic objects
---------------
In other engines or lightmapper implementations, you are required to manually
@@ -1,6 +1,6 @@
.. _doc_environment_and_post_processing:
Environment and Post-Processing
Environment and post-processing
===============================
Godot 3 provides a redesigned Environment resource, as well as a brand new
@@ -14,8 +14,8 @@ rendering environment. This includes sky, ambient lighting, tone mapping,
effects, and adjustments. By itself it does nothing, but it becomes enabled once
used in one of the following locations in order of priority:
Camera Node
^^^^^^^^^^^^
Camera node
^^^^^^^^^^^
An Environment can be set to a camera. It will have priority over any other setting.
@@ -24,8 +24,7 @@ An Environment can be set to a camera. It will have priority over any other sett
This is mostly useful when wanting to override an existing environment,
but in general it's a better idea to use the option below.
WorldEnvironment Node
WorldEnvironment node
^^^^^^^^^^^^^^^^^^^^^
The WorldEnvironment node can be added to any scene, but only one can exist per
@@ -37,9 +36,8 @@ Any Environment added has higher priority than the default Environment
(explained below). This means it can be overridden on a per-scene basis,
which makes it quite useful.
Default Environment
^^^^^^^^^^^^^^^^^^^^^
Default environment
^^^^^^^^^^^^^^^^^^^
A default environment can be set, which acts as a fallback when no Environment
was set to a Camera or WorldEnvironment.
@@ -51,13 +49,12 @@ New projects created from the Project Manager come with a default environment
(``default_env.tres``). If one needs to be created, save it to disk before
referencing it here.
Environment Options
Environment options
-------------------
Following is a detailed description of all environment options and how they
are intended to be used.
Background
^^^^^^^^^^
@@ -75,7 +72,6 @@ There are many ways to set the background:
- **Sky** lets you define a panorama sky (a 360 degree sphere texture) or a procedural sky (a simple sky featuring a gradient and an optional sun). Objects will reflect it and absorb ambient light from it.
- **Color+Sky** lets you define a sky (as above) but uses a constant color value for drawing the background. The sky will only be used for reflection and ambient light.
Ambient Light
^^^^^^^^^^^^^
@@ -90,7 +86,6 @@ enabled).
.. image:: img/environment_ambient.png
When a *Sky* is set as background, it's possible to blend between ambient color
and sky using the **Sky Contribution** setting (this value is 1.0 by default for
convenience so only sky affects objects).
@@ -184,7 +179,7 @@ defaults, but you can still tweak then:
- **Max Luma:** Maximum luminance that auto exposure will aim to adjust for.
- **Speed:** Speed at which luminance corrects itself. The higher the value, the faster correction happens.
Mid and Post-Processing Effects
Mid and post-processing effects
-------------------------------
A large amount of widely-used mid and post-processing effects are supported
@@ -269,7 +264,6 @@ a given range. It has an initial **Distance** with a **Transition** region
The **Amount** parameter controls the amount of blur. For larger blurs, tweaking
the **Quality** may be needed in order to avoid artifacts.
Depth of Field / Near Blur
^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -287,7 +281,6 @@ given object:
.. image:: img/environment_mixed_blur.png
Glow
^^^^
+7 -10
View File
@@ -1,7 +1,7 @@
.. _doc_gi_probes:
GI Probes
==========
=========
Introduction
------------
@@ -17,18 +17,18 @@ will be used, lights can be added, changed or removed, and this will be updated
in real-time. Dynamic objects that move within one of these
probes will also receive indirect lighting from the scene automatically.
Just like with ReflectionProbe, GIProbes can be blended (in a bit more limited
Just like with ReflectionProbe, GIProbe can be blended (in a bit more limited
way), so it is possible to provide full real-time lighting
for a stage without having to resort to lightmaps.
The main downside of GIProbes are:
The main downsides of GIProbe are:
- A small amount of light leaking can occur if the level is not carefully designed. This must be artist-tweaked.
- Performance requirements are higher than for lightmaps, so it may not run properly in low-end integrated GPUs (may need to reduce resolution).
- Reflections are voxelized, so they don't look as sharp as with ReflectionProbe. However, in exchange they are volumetric, so any room size or shape works for them. Mixing them with Screen Space Reflection also works well.
- They consume considerably more video memory than Reflection Probes, so they must be used by care in the right subdivision sizes.
Setting Up
Setting up
----------
Just like a ReflectionProbe, simply set up the GIProbe by wrapping it around
@@ -46,8 +46,8 @@ toolbar to begin the pre-baking process:
.. image:: img/giprobe_bake.png
Adding Lights
--------------
Adding lights
-------------
Unless there are materials with emission, GIProbe does nothing by default.
Lights need to be added to the scene to have an effect.
@@ -80,8 +80,7 @@ as a full 3-stage fallback-chain. This allows to have precise reflections where
.. image:: img/giprobe_ref_blending.png
Interior vs Exterior
Interior vs exterior
--------------------
GI Probes normally allow mixing with lighting from the sky. This can be disabled
@@ -97,7 +96,6 @@ from spreading inside to being ignored.
As complex buildings may mix interiors with exteriors, combining GIProbes
for both parts works well.
Tweaking
--------
@@ -113,7 +111,6 @@ GI Probes support a few parameters for tweaking:
- **Bias** Value used to avoid self-occlusion when doing voxel cone tracing, should generally be above 1.0 (1==voxel size).
- **Normal Bias** Alternative type of bias useful for some scenes. Experiment with this one if regular bias does not work.
Quality
-------
+4 -4
View File
@@ -77,8 +77,8 @@ too which makes the problem worse.
In any case though, this is the easy solution that works everywhere.
Hardware sRGB -> linear conversion.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hardware sRGB -> linear conversion
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the most correct way to use assets in linear-space, as the
texture sampler on the GPU will do the conversion after reading the
@@ -86,8 +86,8 @@ texel using floating point. This works fine on PC and consoles, but most
mobile devices do no support it, or do not support it on compressed
texture format (iOS for example).
Linear -> sRGB at the end.
~~~~~~~~~~~~~~~~~~~~~~~~~~
Linear -> sRGB at the end
~~~~~~~~~~~~~~~~~~~~~~~~~
After all the rendering is done, the linear-space rendered image must be
converted back to sRGB. To do this, simply enable sRGB conversion in the
+1 -1
View File
@@ -65,7 +65,7 @@ pre-calculated constants, or you could add an extra bone at the tip of the
IK bone and calculate using that.
Implementation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~
We will use an exported variable for the bone length to make it easy.
+7 -9
View File
@@ -1,6 +1,6 @@
.. _doc_lights_and_shadows:
Lights And Shadows
Lights and shadows
==================
Introduction
@@ -38,7 +38,7 @@ Each one has a specific function:
- **Specular**: Affects the intensity of the specular blob in objects affected by this light. At zero, this light becomes a pure diffuse light.
- **Cull Mask**: Objects that are in the selected layers below will be affected by this light.
Shadow Mapping
Shadow mapping
^^^^^^^^^^^^^^
Lights can optionally cast shadows. This gives them greater realism (light does
@@ -80,7 +80,7 @@ does not affect the lighting at all and can be anywhere.
Every face whose front-side is hit by the light rays is lit while the others stay dark. Most light types
have specific parameters, but directional lights are pretty simple in nature so they don't.
Directional Shadow Mapping
Directional shadow mapping
^^^^^^^^^^^^^^^^^^^^^^^^^^
To compute shadow maps, the scene is rendered (only depth) from an orthogonal point of view that covers
@@ -159,7 +159,7 @@ These two parameters allow tweaking how this works visually in order to find aes
.. image:: img/light_attenuation.png
Omni Shadow Mapping
Omni shadow mapping
^^^^^^^^^^^^^^^^^^^
Omni light shadow mapping is relatively straightforward. The main issue that needs to be
@@ -175,7 +175,6 @@ If the objects being rendered are mostly irregular, Dual Paraboloid is usually
enough. In any case, as these shadows are cached in a shadow atlas (more on that at the end), it
may not make a difference in performance for most scenes.
Spot light
~~~~~~~~~~
@@ -191,14 +190,13 @@ Spot lights share the same **Range** and **Attenuation** as **OmniLight**, and a
- **Angle**: The aperture angle of the light
- **Angle Attenuation**: The cone attenuation, which helps soften the cone borders.
Spot Shadow Mapping
Spot shadow mapping
^^^^^^^^^^^^^^^^^^^
Spots don't need any parameters for shadow mapping. Keep in mind that, at more than 89 degrees of aperture, shadows
stop functioning for spots, and you should consider using an Omni light instead.
Shadow Atlas
Shadow atlas
~~~~~~~~~~~~
Unlike Directional lights which have their own shadow texture, Omni and Spot lights are assigned to slots of a shadow atlas.
@@ -230,7 +228,7 @@ If the slots in a quadrant are full, lights are pushed back to smaller slots dep
This allocation strategy works for most games, but you may to use a separate one in some cases (as example, a top-down game where
all lights are around the same size and quadrands may have all the same subdivision).
Shadow Filter Quality
Shadow filter quality
~~~~~~~~~~~~~~~~~~~~~
The filter quality of shadows can be tweaked. This can be found in
+5 -6
View File
@@ -1,13 +1,13 @@
.. _doc_reflection_probes:
Reflection Probes
Reflection probes
=================
Introduction
------------
As stated in the :ref:`doc_spatial_material`, objects can show reflected or diffuse light.
Reflection Probes are used as a source of reflected and ambient light for objects inside their area of influence.
Reflection probes are used as a source of reflected and ambient light for objects inside their area of influence.
A probe of this type captures the surroundings (as a sort of 360 degrees image), and stores versions
of it with increasing levels of *blur*. This is used to simulate roughness in materials, as well as ambient lighting.
@@ -17,7 +17,7 @@ While these probes are a efficient way of storing reflections, they have a few s
* They are efficient to render but expensive to compute. This leads to a default behavior where they only capture on scene load.
* They work best for rectangular shaped rooms or places, otherwise the reflections shown are not as faithful (especially when roughness is 0).
Setting Up
Setting up
----------
Create a ReflectionProbe node and wrap it around the area where you want to have reflections:
@@ -61,7 +61,7 @@ use the *Cull Mask* setting:
.. image:: img/refprobe_cullmask.png
Interior vs Exterior
Interior vs exterior
--------------------
If you are using reflection probes in an interior setting, it is recommended
@@ -77,7 +77,6 @@ Optionally, you can blend this ambient light with the probe diffuse capture by
tweaking the **Ambient Contribution** property (0.0 means, pure ambient color,
while 1.0 means pure diffuse capture).
Blending
--------
@@ -101,7 +100,7 @@ Finally, blending interior and exterior probes is the recommended approach when
levels that combine both interiors and exteriors. Near the door, a probe can
be marked as *exterior* (so it will get sky reflections) while on the inside, it can be interior.
Reflection Atlas
Reflection atlas
----------------
In the current renderer implementation, all probes are the same size and
+2 -4
View File
@@ -178,7 +178,6 @@ represents the shape of a light source reflected in the object.
.. image:: img/spatial_material7.png
Blend Mode
~~~~~~~~~~
@@ -399,7 +398,6 @@ liquids, etc.
.. image:: img/spatial_material21.png
Transmission
~~~~~~~~~~~~
@@ -447,7 +445,7 @@ world triplanar, so the brick texture continues smoothly between them.
.. image:: img/spatial_material25.png
Proximity and Distance Fade
Proximity and distance fade
----------------------------
Godot allows materials to fade by proximity to each other as well as depending
@@ -461,7 +459,7 @@ entire scene is usually not a good idea.
.. image:: img/spatial_material_proxfade.gif
Render Priority
Render priority
---------------
The rendering order of objects can be changed, although this is mostly
+2 -2
View File
@@ -15,7 +15,7 @@ as if you were building a level with an unlimited amount of Lego blocks.
Collisions and navigation can also be added to the meshes, just like you
would do with the tiles of a tilemap.
Example Project
Example project
---------------
To learn how GridMaps work, start by downloading the sample project:
@@ -98,7 +98,7 @@ the drawing plane higher or lower on its axis.
.. image:: img/gridmap_shift_axis.png
Using gridmap in code
Using GridMap in code
---------------------
See :ref:`class_GridMap` for details on the node's methods and member variables.
+1 -1
View File
@@ -47,7 +47,7 @@ Click it and select *Populate surface* in the dropdown menu. A new window titled
.. image:: img/multimesh_settings.png
MultiMesh Settings
MultiMesh settings
~~~~~~~~~~~~~~~~~~
Below are descriptions of the options.
+11 -12
View File
@@ -1,7 +1,7 @@
.. _doc_using_transforms:
Using 3D transforms in Godot
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using 3D transforms
~~~~~~~~~~~~~~~~~~~
Introduction
------------
@@ -24,12 +24,12 @@ hat).
The idea of this document is to explain why, as well as outlining best practices for dealing with transforms when programming 3D games.
Problems of Euler Angles
Problems of Euler angles
------------------------
While it may seem intuitive that each axis has a rotation, the truth is that it's just not practical.
Axis Order
Axis order
==========
The main reason for this is that there isn't a *unique* way to construct an orientation from the angles. There isn't a standard mathematical function that
@@ -58,7 +58,6 @@ If we were to apply rotation in the *X* axis first, and then in *Y*, the effect
Depending on the type of game or effect desired, the order in which you want axis rotations to be applied may differ. Therefore, applying rotations in X, Y, and Z is not enough: you also need a *rotation order*.
Interpolation
=============
@@ -77,14 +76,14 @@ There are a few reasons this may happen:
* Rotations don't map linearly to orientation, so interpolating them does not always result in the shortest path (i.e., to go from ``270`` to ``0`` degrees is not the same as going from ``270`` to ``360``, even though the angles are equivalent).
* Gimbal lock is at play (first and last rotated axis align, so a degree of freedom is lost). See `Wikipedia's page on Gimbal Lock <https://en.wikipedia.org/wiki/Gimbal_lock>`_ for a detailed explanation of this problem.
Say no to Euler Angles
Say no to Euler angles
======================
The result of all this is that you should **not use** the ``rotation`` property of :ref:`class_Spatial` nodes in Godot for games. It's there to be used mainly in the editor, for coherence with the 2D engine, and for simple rotations (generally just one axis, or even two in limited cases). As much as you may be tempted, don't use it.
Instead, there is a better way to solve your rotation problems.
Introducing Transforms
Introducing transforms
----------------------
Godot uses the :ref:`class_Transform` datatype for orientations. Each :ref:`class_Spatial` node contains a ``transform`` property which is relative to the parent's transform, if the parent is a Spatial-derived type.
@@ -140,7 +139,7 @@ The gizmo's arrows show the ``X``, ``Y``, and ``Z`` axes (in red, green, and blu
For more information on the mathematics of vectors and transforms, please read the :ref:`doc_vector_math` tutorials.
Manipulating Transforms
Manipulating transforms
=======================
Of course, transforms are not as straightforward to manipulate as angles and have problems of their own.
@@ -194,7 +193,7 @@ To rotate relative to object space (the node's own transform) use the following:
// Rotate locally
RotateObjectLocal(Vector3.Right, Mathf.Pi);
Precision Errors
Precision errors
================
Doing successive operations on transforms will result in a loss of precision due to floating-point error. This means the scale of each axis may no longer be exactly ``1.0``, and they may not be exactly ``90`` degrees from each other.
@@ -227,7 +226,7 @@ It is recommended you don't scale nodes that are going to be manipulated. Scale
transform = transform.Orthonormalized();
transform = transform.Scaled(scale);
Obtaining Information
Obtaining information
=====================
You might be thinking at this point: **"Ok, but how do I get angles from a transform?"**. The answer again is: you don't. You must do your best to stop thinking in angles.
@@ -303,7 +302,7 @@ Jump:
All common behaviors and logic can be done with just vectors.
Setting Information
Setting information
===================
There are, of course, cases where you want to set information to a transform. Imagine a first person controller or orbiting camera. Those are definitely done using angles, because you *do want* the transforms to happen in a specific order.
@@ -355,7 +354,7 @@ Example of looking around, FPS style:
As you can see, in such cases it's even simpler to keep the rotation outside, then use the transform as the *final* orientation.
Interpolating with Quaternions
Interpolating with quaternions
==============================
Interpolating between two transforms can efficiently be done with quaternions. More information about how quaternions work can be found in other places around the Internet. For practical use, it's enough to understand that pretty much their main use is doing a closest path interpolation. As in, if you have two rotations, a quaternion will smoothly allow interpolation between them using the closest axis.
@@ -213,7 +213,7 @@ We can now use this noise function in place of ``cos`` and ``sin`` in the previo
With the noise function in place we already have something that looks kind of cool.
There is a lot of detail, it kind of looks hilly or mountainous.
Fragment Shader
Fragment shader
---------------
The difference between a vertex shader and a fragment shader is that the vertex shader
+8 -8
View File
@@ -1,6 +1,6 @@
.. _doc_audio-buses:
Audio Buses
Audio buses
===========
Introduction
@@ -22,7 +22,7 @@ a efficient tradeoff between performance and sound quality.
See also: the :ref:`doc_audio-buses` tutorial.
Decibel Scale
Decibel scale
-------------
The new audio engine works primarily using the decibel scale. We have
@@ -41,7 +41,7 @@ For those unfamiliar with it, it can be explained with a few facts:
This can take a bit getting used to, but it's friendlier in the end and will allow you to communicate better with audio professionals.
Audio Buses
Audio buses
-----------
Audio buses can be found in the bottom panel of Godot Editor:
@@ -58,7 +58,7 @@ avoids creating infinite routing loops!
In the above image, *Bus 2* is routing its output to *Master* bus.
Playback of Audio to a Bus
Playback of audio to a bus
--------------------------
To test playback to a bus, create an AudioStreamPlayer node, load an AudioStream and select a target bus for playback:
@@ -69,7 +69,7 @@ Finally toggle the "playing" property to on and sound will flow.
You may also be interested in reading about :ref:`doc_audio-buses` now.
Adding Effects
Adding effects
--------------
Audio buses can contain all sorts of effects. These effects modify the sound in one way or another and are applied in order.
@@ -175,20 +175,20 @@ StereoEnhance
This effect has a few algorithms available to enhance the stereo spectrum, in case this is needed.
Automatic Bus Disabling
Automatic bus disabling
-----------------------
There is no need to disable buses manually when not in use, Godot detects that the bus has been silent for a few seconds and disable it (including all effects).
.. image:: img/audio_buses5.png
Bus Rearrangement
Bus rearrangement
-----------------
Stream Players use bus names to identify a bus, which allows adding, removing and moving buses around while the reference to them is kept.
If a bus is renamed, however, the reference will be lost and the Stream Player will output to Master. This system was chosen because rearranging buses is a more common process than renaming them.
Default Bus Layout
Default bus layout
------------------
The default bus layout is automatically saved to the "res://default_bus_layout.res" file. Other bus layouts can be saved/retrieved from files in case of having
+2 -2
View File
@@ -1,6 +1,6 @@
.. _doc_audio-streams:
Audio Streams
Audio streams
=============
Introduction
@@ -58,7 +58,7 @@ Similar to AudioStreamPlayer2D, an Area can divert the sound to an audio bus.
Unlike for 2D, the 3D version of AudioStreamPlayer has a few more advanced options:
Reverb Buses
Reverb buses
~~~~~~~~~~~~
Godot allows 3D Audio Streams that enter a specific *Area* to send dry and wet audio to separate buses. This is useful when you have several reverb configurations for different types of rooms.
+16 -18
View File
@@ -154,7 +154,7 @@ which should be a lot simpler to understand after completing this
tutorial. We'll just explain how to use transforms.
Transform2D
-----------
~~~~~~~~~~~
:ref:`class_Transform2D` is a 3x2 matrix. It has 3 Vector2 elements and
it's used for 2D. The "X" axis is the element 0, "Y" axis is the element 1 and
@@ -180,7 +180,7 @@ Most operations will be explained with this datatype (Transform2D), but the
same logic applies to 3D.
Identity
--------
~~~~~~~~
An important transform is the "identity" matrix. This means:
@@ -220,7 +220,7 @@ Operations
----------
Rotation
--------
~~~~~~~~
Rotating Transform2D is done by using the "rotated" function:
@@ -238,7 +238,7 @@ Rotating Transform2D is done by using the "rotated" function:
.. image:: img/tutomat12.png
Translation
-----------
~~~~~~~~~~~
There are two ways to translate a Transform2D, the first one is moving
the origin:
@@ -298,7 +298,7 @@ You could also transform the global coordinates to local coordinates manually:
But even better, there are helper functions for this as you can read in the next sections.
Local to global coordinates and vice versa
------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are helper methods for converting between local and global coordinates.
@@ -306,7 +306,7 @@ There are :ref:`Node2D.to_local() <class_Node2D_to_local>` and :ref:`Node2D.to_g
as well as :ref:`Spatial.to_local() <class_Spatial_to_local>` and :ref:`Spatial.to_global() <class_Spatial_to_global>` for 3D.
Scale
-----
~~~~~
A matrix can be scaled too. Scaling will multiply the basis vectors by a
vector (X vector by x component of the scale, Y vector by y component of
@@ -339,7 +339,7 @@ matrix inside (and you are likely learning this many years *after*
discovering Santa is not real).
Transform
---------
~~~~~~~~~
Transform is the act of switching between coordinate systems. To convert
a position (either 2D or 3D) from "designer" coordinate system to the
@@ -366,7 +366,7 @@ And only for basis (no translation):
var newPosition = m.BasisXform(position);
Inverse transform
-----------------
~~~~~~~~~~~~~~~~~
To do the opposite operation (what we did up there with the rocket), the
"xform_inv" method is used:
@@ -392,7 +392,7 @@ Only for Basis:
var newPosition = m.BasisXformInv(position);
Orthonormal matrices
--------------------
^^^^^^^^^^^^^^^^^^^^
However, if the matrix has been scaled (vectors are not unit length),
or the basis vectors are not orthogonal (90°), the inverse transform
@@ -416,7 +416,7 @@ the position unchanged:
position = Transform2D.Identity.Xform(position);
Affine inverse
--------------
~~~~~~~~~~~~~~
The affine inverse is a matrix that does the inverse operation of
another matrix, no matter if the matrix has scale or the axis vectors
@@ -456,7 +456,7 @@ If the matrix is orthonormal, then:
position = m.XformInv(position);
Matrix multiplication
---------------------
~~~~~~~~~~~~~~~~~~~~~
Matrices can be multiplied. Multiplication of two matrices "chains"
(concatenates) their transforms.
@@ -517,7 +517,7 @@ However, this is not the same:
Because in matrix math, A * B is not the same as B * A.
Multiplication by inverse
-------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~
Multiplying a matrix by its inverse, results in identity:
@@ -533,7 +533,7 @@ Multiplying a matrix by its inverse, results in identity:
var B = A.AffineInverse() * A;
Multiplication by identity
--------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~
Multiplying a matrix by identity, will result in the unchanged matrix:
@@ -611,7 +611,7 @@ As mentioned before, for 3D, we deal with 3 :ref:`Vector3 <class_Vector3>`
vectors for the rotation matrix, and an extra one for the origin.
Basis
-----
~~~~~
Godot has a special type for a 3x3 matrix, named :ref:`Basis <class_basis>`.
It can be used to represent a 3D rotation and scale. Sub vectors can be
@@ -676,10 +676,8 @@ And can be accessed like this:
GD.Print(identityBasis);;
// prints: ((1, 0, 0), (0, 1, 0), (0, 0, 1))
Rotation in 3D
--------------
~~~~~~~~~~~~~~
Rotation in 3D is more complex than in 2D (translation and scale are the
same), because rotation is an implicit 2D operation. To rotate in 3D, an
@@ -702,7 +700,7 @@ that can point to any direction, but length must be one (1.0).
m3 = m3.Rotated(new Vector3(0, 1, 0), Mathf.Pi / 2);
Transform
---------
~~~~~~~~~
To add the final component to the mix, Godot provides the
:ref:`Transform <class_Transform>` type. Transform has two members:
+4 -5
View File
@@ -54,7 +54,7 @@ Both vectors represent a point 4 units to the right and 3 units below some
starting point. It does not matter where on the plane you draw the vector,
it always represents a relative direction and magnitude.
Vector Operations
Vector operations
~~~~~~~~~~~~~~~~~
You can use either method (x and y coordinates or angle and magnitude) to
@@ -383,7 +383,7 @@ With Godot, you can use the built-in method:
give the same result as ``b.cross(a)``. The resulting vectors
point in **opposite** directions.
Calculating Normals
Calculating normals
-------------------
One common use of cross products is to find the surface normal of a plane
@@ -414,7 +414,7 @@ Here is a function to calculate a triangle's normal:
return normal;
}
Pointing to a Target
Pointing to a target
--------------------
In the dot product section above, we saw how it could be used to find the
@@ -424,8 +424,7 @@ calculating the cross product of the current facing direction and the
target direction. The resulting perpendicular vector is the axis of
rotation.
More Information
More information
~~~~~~~~~~~~~~~~
For more information on using vector math in Godot, see the following articles:
+1 -1
View File
@@ -1,6 +1,6 @@
.. _doc_vectors_advanced:
Advanced Vector Math
Advanced vector math
====================
Planes
+1 -1
View File
@@ -1,4 +1,4 @@
Multi-Threading
Multi-threading
===============
.. toctree::
+5 -5
View File
@@ -1,6 +1,6 @@
.. _doc_thread_safe_apis:
Thread Safe APIs
Thread safe APIs
================
Threads
@@ -11,14 +11,14 @@ Godot supports multi threading, but not in the whole engine.
Below is a list of the areas in Godot and how they can be used with threads.
Global Scope
Global scope
------------
:ref:`Global Scope<class_@GlobalScope>` singletons are all thread safe. Accessing servers from threads is supported (for VisualServer and Physics servers, ensure threaded or thread safe operation is enabled in the project settings!).
This makes them ideal for code that creates dozens of thousands of instances in servers and controls them from threads. Of course, it requires a bit more code, as this is used directly and not within the scene tree.
Scene Tree
Scene tree
----------
Interacting with the active scene tree is **NOT** thread safe. Make sure to use mutexes when sending data between threads. If you want to call functions from a thread, the *call_deferred* function may be used:
@@ -39,8 +39,8 @@ However, creating scene chunks (nodes in tree arrangement) outside the active tr
enemy.add_child(weapon) # Set a weapon.
world.call_deferred("add_child", enemy)
GDScript Arrays, Dictionaries:
------------------------------
GDScript arrays, dictionaries
-----------------------------
In GDScript, reading and writing elements from multiple threads is ok, but anything that changes the container size (resizing, adding or removing elements) requires locking a mutex.
+4 -4
View File
@@ -1,14 +1,14 @@
.. _doc_vr_primer:
An AR/VR Primer for Godot
=========================
AR/VR primer
============
This tutorial gives you a springboard into the world of AR and VR in the Godot game engine.
A new architecture was introduced in Godot 3 called the AR/VR Server. On top of this architecture specific implementations are available as interfaces most of which are plugins based on GDNative.
This tutorial focuses purely on the core elements abstracted by the core architecture. This architecture has enough features for you to create an entire VR experience that can then be deployed for various interfaces. However each platform often has some unique features that are impossible to abstract. Such features will be documented on the relevant interfaces and fall outside of the scope of this primer.
AR/VR Server
AR/VR server
------------
When Godot starts each available interface will make itself known to the AR/VR server. GDNative interfaces are setup as singletons, as long as they are added to the list of GDNative singletons in your project they will make themselves known to the server.
@@ -38,7 +38,7 @@ For our mobile vr interface, and any interface where the main input is directly
Finally you should only initialize an interface once, switching scenes and reinitializing interfaces will just introduce a lot of overhead. If you want to turn the headset off temporarily just disable the viewport or set arvr to false on the viewport. In most scenarios though you wouldn't disable the headset once you're in VR, this can be disconcerting to the gamer.
New AR/VR Nodes
New AR/VR nodes
---------------
Three new node types have been added for supporting AR and VR in Godot and one additional node type especially for AR. These are:
+3 -5
View File
@@ -1,10 +1,10 @@
.. _doc_vr_starter_tutorial:
VR Starter Tutorial
VR starter tutorial
===================
Tutorial introduction
---------------------
Introduction
------------
.. image:: img/starter_vr_tutorial_sword.png
@@ -588,7 +588,6 @@ The last thing we are doing in ``button_pressed`` is checking to see if the butt
If the menu button is pressed, we change grab modes, and set the visibility of the grab :ref:`Raycast <class_Raycast>` so it is only visible when using ``RAYCAST`` as the grab mode.
_________
Let's look at ``button_released`` next.
@@ -791,7 +790,6 @@ Next, we spawn/instance the :ref:`RigidBody <class_RigidBody>` version of the ta
Then we set ``destroyed`` to ``true`` and start processing ``_physics_process``.
Finally, we play a sound, and remove a sphere from ``Game.gd`` by calling ``remove_sphere``.
________
Now, you may have noticed we are calling a function in ``Game.gd`` we have not made yet, so let's fix that!