Content-Length: 284631 | pFad | http://github.com/godotengine/godot-docs/pull/10997/files

A7 Document POSITION built-in in canvas-item shader reference by Lielay9 · Pull Request #10997 · godotengine/godot-docs · GitHub
Skip to content

Document POSITION built-in in canvas-item shader reference #10997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tutorials/shaders/shader_reference/canvas_item_shader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,16 @@ happen later) and do it manually with the following code:
render_mode skip_vertex_transform;

void vertex() {

VERTEX = (MODEL_MATRIX * vec4(VERTEX, 0.0, 1.0)).xy;
}

Other built-ins, such as ``UV`` and ``COLOR``, are also passed through to the ``fragment()`` function if not modified.

The default canvas to clip space transform can be skipped using the ``POSITION`` built-in. If ``POSITION`` is written
to anywhere in the shader, the value of ``VERTEX`` is ignored and not used in the vertex stage. However, ``VERTEX``
can still be written a value that is transformed to canvas space, interpolated based on the **w** component of
``POSITION`` and passed to the fragment shader.

For instancing, the ``INSTANCE_CUSTOM`` variable contains the instance custom data. When using particles, this information
is usually:

Expand Down Expand Up @@ -134,6 +138,9 @@ is usually:
| in int **VERTEX_ID** | The index of the current vertex in the vertex |
| | buffer. |
+--------------------------------+----------------------------------------------------------------+
| out vec4 **POSITION** | If written to, overrides the final vertex position |
| | in clip space. |
+--------------------------------+----------------------------------------------------------------+
| inout vec2 **UV** | Normalized texture coordinates. Range from ``0.0`` |
| | to ``1.0``. |
+--------------------------------+----------------------------------------------------------------+
Expand Down








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/godotengine/godot-docs/pull/10997/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy