I notice that the vertex shader has a UV property, but I cant find any documentation about it. In the vertex shader is UV a vector2 that represents the x, y position of the current pixel in the texture?
https://mcmap.net/q/21957/-about-opengl-texture-coordinates
http://www.glprogramming.com/red/chapter09.html
Godots shader language is essentially just a subset of openGL with a simpler syntax. Where there are caps in documentation, for godot 3.x at least, you can essentially just fall back on the openGL documentation, Red book for an example.
Vertex and fragment function both have built-in UV property. In vertex function it represents vertex position in the texture space while in fragment function it's pixel position in the texture space. UV in fragment shader is in fact interpolation of three UV coordinates belonging to shaded triangle's vertices. So if you manipulate UV value in the vertex shader, it'll affect UV value in the fragment shader.
© 2022 - 2024 — McMap. All rights reserved.