Skip to content

Commit 3454e9f

Browse files
Apply suggestions from code review
Co-authored-by: A Thousand Ships <[email protected]>
1 parent ea19a84 commit 3454e9f

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

tutorials/shaders/your_first_shader/your_second_3d_shader.rst

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ Your second 3D shader
66
From a high-level, what Godot does is give the user a bunch of shader parameters
77
that can be optionally set (``AO``, ``SSS_Strength``, ``RIM``, etc.). These
88
parameters correspond to different complex effects (Ambient Occlusion,
9-
SubSurface Scattering, Rim Lighting, etc.). When not written to, the code is
9+
SubSurface Scattering, Rim Lighting, etc.). When not written to, the code is
1010
thrown out before it is compiled and so the shader does not incur the cost of
1111
the extra feature. This allows users to have complex PBR-correct
1212
shading, without writing complex shaders. Of course, Godot also allows you to
1313
ignore all these parameters and write a fully customized shader.
1414

15-
For a full list of these parameters see the :ref:`spatial shader <doc_spatial_shader>`
15+
For a full list of these parameters see the :ref:`spatial shader <doc_spatial_shader>`
1616
reference doc.
1717

1818
A difference between the vertex function and a fragment function is that the
@@ -26,7 +26,7 @@ importantly, sets the ``ALBEDO`` color of the :ref:`MeshInstance3D<class_MeshIns
2626
fragment function in Godot is to set up different material properties and let
2727
Godot handle the rest. In order to provide even more flexibility, Godot also
2828
provides render modes. Render modes are set at the top of the
29-
shader, directly below ``shader_type``. They;re used to specify what sort of
29+
shader, directly below ``shader_type``. They're used to specify what sort of
3030
functionality you want the built-in aspects of the shader to have.
3131

3232
For example, if you do not want to have lights affect an object, set the
@@ -37,8 +37,8 @@ importantly, sets the ``ALBEDO`` color of the :ref:`MeshInstance3D<class_MeshIns
3737
render_mode unshaded;
3838
3939
You can also stack multiple render modes together. For example, if you want to
40-
use toon shading instead of more-realistic PBR shading, set the diffuse mode
41-
and specular mode to toon:
40+
use toon shading instead of more-realistic PBR shading, set the diffuse
41+
and specular modes to toon:
4242

4343
.. code-block:: glsl
4444
@@ -47,7 +47,7 @@ importantly, sets the ``ALBEDO`` color of the :ref:`MeshInstance3D<class_MeshIns
4747
This model of built-in functionality allows you to write complex custom
4848
shaders by changing only a few parameters.
4949

50-
For a full list of render modes see the :ref:`Spatial shader reference <doc_spatial_shader>`.
50+
For a full list of render modes, see the :ref:`Spatial shader reference <doc_spatial_shader>`.
5151

5252
Your first spatial fragment function
5353
------------------------------------
@@ -67,7 +67,7 @@ mesh.
6767
.. code-block:: glsl
6868
6969
void vertex() {
70-
tex_position = VERTEX.xz / 10.0 + 0.5; // Scaling factor set to 10 for 10x10 mesh
70+
tex_position = VERTEX.xz / 10.0 + 0.5; // Scaling factor set to 10 for 10x10 mesh.
7171
float height = texture(noise, tex_position).x;
7272
VERTEX.y += height * height_scale;
7373
}
@@ -104,7 +104,7 @@ the reflection and the ``ALBEDO`` color. A high ``METALLIC`` almost ignores
104104
``METALLIC`` has a more equal representation of sky color and ``ALBEDO`` color.
105105

106106
In the example below, ``ROUGHNESS`` increases from ``0`` to ``1`` from left to
107-
right while ``METALLIC`` increase from ``0`` to ``1`` from top to bottom.
107+
right while ``METALLIC`` increases from ``0`` to ``1`` from top to bottom.
108108

109109
.. image:: img/PBR.webp
110110

@@ -213,9 +213,9 @@ cosine of ``TIME``.
213213
.. note::
214214

215215
This will result in texture coordinates that will go out of the bounds of our
216-
noise textures and wrap around. The :ref:`NoiseTexture2D <class_NoiseTexture2D>`'s
216+
noise textures and wrap around. The :ref:`NoiseTexture2D <class_NoiseTexture2D>`s
217217
we are using for **Noise** and **Normalmap** should have their :ref:`Seamless <class_NoiseTexture2D_property_seamless>`
218-
property set to ``On`` at this stage, or the seams will start to be visible.
218+
property set to ``On`` at this stage, or the seams will be visible.
219219

220220
This results in waves that move slowly, but not in a very natural way. The next
221221
section will dig deeper into using shaders to create more complex effects, in
@@ -233,7 +233,7 @@ corresponding normal value from our normal map. In the next section we will be
233233
introducing functions to compute our own height values, making our normal map
234234
invalid. This means we will have to compute them manually.
235235

236-
First we will move the height calculation into it's own function. Put the code
236+
First we will move the height calculation into its own function. Put the code
237237
into a function called ``height()``.
238238

239239
.. code-block:: glsl
@@ -271,7 +271,7 @@ We will also remove the code assigning to ``NORMAL_MAP`` in ``fragment()``.
271271
As these are estimates, we have lost some quality. We can partially address this
272272
by reducing the detail in our noise texture. Open **Mesh > Material > Shader
273273
parameters** and then the :ref:`Noise <class_NoiseTexture2D_property_noise>`
274-
texture. Set it's :ref:`Noise > Frequency <class_FastNoiseLite_property_frequency>`
274+
texture. Set its :ref:`Noise > Frequency <class_FastNoiseLite_property_frequency>`
275275
value to ``0.005``.
276276

277277
.. image:: img/set-frequency.webp
@@ -348,6 +348,7 @@ We do this by scaling ``position``.
348348
float h = wave(position * 0.4);
349349
return h;
350350
}
351+
351352
.. image:: img/wave2.webp
352353

353354
This wave has a more natural shape, but it is a bit smooth. In our material settings
@@ -429,6 +430,6 @@ the same mesh and noise settings as mentioned above.
429430
}
430431
431432
For more information about Spatial shaders read the :ref:`Shading Language <doc_shading_language>`
432-
doc and the :ref:`Spatial Shaders <doc_spatial_shader>` doc.
433+
and :ref:`Spatial Shaders <doc_spatial_shader>` docs.
433434
Also look at more advanced tutorials in the :ref:`Shading section<toc-learn-features-shading>`
434-
and the :ref:`3D <toc-learn-features-3d>` sections.
435+
and :ref:`3D <toc-learn-features-3d>` sections.

0 commit comments

Comments
 (0)