Skip to content

Commit

Permalink
Update VisualShader page for 4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
skyace65 committed May 19, 2024
1 parent abda5a1 commit fd33020
Show file tree
Hide file tree
Showing 20 changed files with 20 additions and 14 deletions.
Binary file not shown.
Binary file not shown.
Binary file modified tutorials/shaders/img/visual_shader_create.webp
Binary file not shown.
Binary file modified tutorials/shaders/img/visual_shader_create2.webp
Binary file not shown.
Binary file removed tutorials/shaders/img/visual_shader_editor2.png
Binary file not shown.
Binary file added tutorials/shaders/img/visual_shader_editor2.webp
Binary file not shown.
Binary file modified tutorials/shaders/img/vs_boolean.webp
Binary file not shown.
Binary file removed tutorials/shaders/img/vs_expression.gif
Binary file not shown.
Binary file removed tutorials/shaders/img/vs_fresnel.png
Binary file not shown.
Binary file added tutorials/shaders/img/vs_fresnel.webp
Binary file not shown.
Binary file modified tutorials/shaders/img/vs_node.webp
Binary file not shown.
Binary file removed tutorials/shaders/img/vs_popup.png
Binary file not shown.
Binary file added tutorials/shaders/img/vs_popup.webp
Binary file not shown.
Binary file modified tutorials/shaders/img/vs_sampler.webp
Binary file not shown.
Binary file modified tutorials/shaders/img/vs_scalar.webp
Binary file not shown.
Binary file removed tutorials/shaders/img/vs_switch.png
Binary file not shown.
Binary file added tutorials/shaders/img/vs_switch.webp
Binary file not shown.
Binary file modified tutorials/shaders/img/vs_transform.webp
Binary file not shown.
Binary file modified tutorials/shaders/img/vs_vector.webp
Binary file not shown.
34 changes: 20 additions & 14 deletions tutorials/shaders/visual_shaders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,23 @@ Creating a VisualShader
VisualShaders can be created in any :ref:`class_ShaderMaterial`. To begin using
VisualShaders, create a new ``ShaderMaterial`` in an object of your choice.

.. image:: img/shader_material_create_mesh.png
.. image:: img/shader_material_create_mesh.webp

Then assign a :ref:`class_VisualShader` resource to the ``Shader`` property.
Then assign a :ref:`class_Shader` resource to the ``Shader`` property.

.. image:: img/visual_shader_create.webp

Click on the new ``Shader`` resource and the Create Shader dialog will
open automatically. Change the Type option to VisualShader in the dropdown.
open automatically. Change the Type option to :ref:`class_VisualShader`
in the dropdown, then give it a name.

.. image:: img/visual_shader_create2.webp

The layout of the Visual Shader Editor comprises two parts:
Click on the visual shader you just created to open the Shader Editor.
The layout of the Shader Editor comprises two parts:
the upper toolbar and the graph itself.

.. image:: img/visual_shader_editor2.png
.. image:: img/visual_shader_editor2.webp

From left to right in the toolbar:

Expand All @@ -46,6 +48,12 @@ From left to right in the toolbar:
script shaders, it defines what built-in nodes will be available.
- The following buttons and number input control the zooming level, grid
snapping and distance between grid lines (in pixels).
- The toggle controls if the graph minimap in the bottom right of the editor
is visible or not.
- The automatically arrange selected nodes button will try to organize any
nodes you have selected as efficiently and cleanly as possible.
- The Manage Varyings button opens a dropdown that lets you add or remove a
varying.
- The last icon shows the generated shader code corresponding to your graph.

.. note::
Expand All @@ -68,7 +76,7 @@ create your shader. To add a new node, click on the ``Add Node`` button on the
upper left corner or right click on any empty location in the graph, and a menu
will pop up.

.. image:: img/vs_popup.png
.. image:: img/vs_popup.webp

This popup has the following properties:

Expand Down Expand Up @@ -117,23 +125,23 @@ These ports are colored to differentiate type of port:
- Description
- Example
* - Scalar
- Cyan
- Gray
- Scalar is a single value.
- |scalar|
* - Vector
- Purple
- Vector is a set of values.
- |vector|
* - Boolean
- Blue
- Green
- On or off, true or false.
- |boolean|
* - Transform
- Orange
- Pink
- A matrix, usually used to transform vertices.
- |transform|
* - Sampler
- Yellow
- Orange
- A texture sampler. It can be used to sample textures.
- |sampler|

Expand All @@ -160,8 +168,6 @@ parsing or compilation errors will be printed to the Output tab. The outputs are
initialized to their zero value by default. The node is located under the
Special tab and can be used in all shader modes.

.. image:: img/vs_expression.gif

The possibilities of this node are almost limitless – you can write complex
procedures, and use all the power of text-based shaders, such as loops, the
``discard`` keyword, extended types, etc. For example:
Expand All @@ -176,7 +182,7 @@ a scalar which is the saturated dot product between them. Additionally, you can
setup the inversion and the power of equation. The ``Fresnel`` node is great for
adding a rim-like lighting effect to objects.

.. image:: img/vs_fresnel.png
.. image:: img/vs_fresnel.webp

Boolean node
++++++++++++
Expand Down Expand Up @@ -205,4 +211,4 @@ The ``Switch`` node returns a vector if the boolean condition is ``true`` or
``false``. ``Boolean`` was introduced above. If you convert a vector to a true
boolean, all components of the vector should be above zero.

.. image:: img/vs_switch.png
.. image:: img/vs_switch.webp

0 comments on commit fd33020

Please sign in to comment.