#[Resolved] VERTEX vs UV

8 messages · Page 1 of 1 (latest)

desert oak
#

In spatial shaders, what specifically does VERTEX represent? I thought it would be the 3D position on the mesh, but if I feed it in with texture(tex, VERTEX.xz) I actually get different colors based on the position and orientation of the camera. Why is that?

#

The same thing happens with NORMAL.

#

Here's a simple demonstration of what I mean:

shader_type spatial;

void fragment() {
ALBEDO = VERTEX;
ALPHA = 1.0;
}

Just move the camera around and watch the colors change.

wraith hill
#

could be that it is a difference between world coordinates and screen coordinates. Vertex does indeex represent the vertices "corner points" of the mesh, all of them in fact.

#

I feel like there is some info missing here however

wraith hill
#

yeah Vertex is in view space so it likely needs to be transformed to world space

#

if you want the color to simply depends on the position of the node in the world, you can use NODE_POSITION_WORLD

desert oak
#

I see, thanks.