Skip to main content
tidying, clairifying
Source Link
Djindjidj
  • 406
  • 2
  • 8

even the UVs never change

They do not change from drawcall to drawcall. But in the end your fragment shader interpolates the UV value for the current fragment from the vertices of the current triangle. And those values can change from pixel to pixel. The shader thus needs to associate the UV values with the vertices of the current pixel's triangle.

Usually, the fragment shader takes the UV value for the current fragment as an input from the vertex shader:
Vertex Shader:

out vec2 UV;

void main(){
...

    UV = vertexUV;
}

Fragment Shader:

in vec2 UV;

uniform sampler2D myTextureSampler;

void main(){

    color = texture( myTextureSampler, UV ).rgb;
}

even the UVs never change

They do not change from drawcall to drawcall. But in the end the rasterizer interpolates the UV value for the current fragment from the UV values of the vertices of the current triangle, following the information provided by the vertex shader. And those values can change from vertex to vertex .

I don't see how you would be able to deal with that in the fragment shader alone. You provide 4 UVs and look at 3 vertices for each triangle. How would you figure out what UVs to use and how would you compute the value for the current fragment?? In the end that is what the vertex shader and rasterizer combination is for, isn't it?

Also, why do you want to do that at all? The amount of data that are being transferred here seem too small to me to be worth the effort...

even the UVs never change

They do not change from drawcall to drawcall. But in the end your fragment shader interpolates the UV value for the current fragment from the vertices of the current triangle. And those values can change from pixel to pixel. The shader thus needs to associate the UV values with the vertices of the current pixel's triangle.

Usually, the fragment shader takes the UV value for the current fragment as an input from the vertex shader:
Vertex Shader:

out vec2 UV;

void main(){
...

    UV = vertexUV;
}

Fragment Shader:

in vec2 UV;

uniform sampler2D myTextureSampler;

void main(){

    color = texture( myTextureSampler, UV ).rgb;
}

I don't see how you would be able to deal with that in the fragment shader alone. You provide 4 UVs and look at 3 vertices for each triangle. How would you figure out what UVs to use and how would you compute the value for the current fragment?? In the end that is what the vertex shader is for, isn't it?

Also, why do you want to do that at all? The amount of data that are being transferred here seem too small to me to be worth the effort...

Usually, the fragment shader takes the UV value for the current fragment as an input from the vertex shader:
Vertex Shader:

out vec2 UV;

void main(){
...

    UV = vertexUV;
}

Fragment Shader:

in vec2 UV;

uniform sampler2D myTextureSampler;

void main(){

    color = texture( myTextureSampler, UV ).rgb;
}

even the UVs never change

They do not change from drawcall to drawcall. But in the end the rasterizer interpolates the UV value for the current fragment from the UV values of the vertices of the current triangle, following the information provided by the vertex shader. And those values can change from vertex to vertex .

I don't see how you would be able to deal with that in the fragment shader alone. You provide 4 UVs and look at 3 vertices for each triangle. How would you figure out what UVs to use and how would you compute the value for the current fragment?? In the end that is what the vertex shader and rasterizer combination is for, isn't it?

Also, why do you want to do that at all? The amount of data that are being transferred here seem too small to me to be worth the effort...

tidying, clairifying
Source Link
Djindjidj
  • 406
  • 2
  • 8

even the UVs never change

They do not change from drawcall to drawcall. But in the end your fragment shader interpolates the UV value for the current fragment from the vertices of the current triangle. And those values can change from pixel to pixel. The shader thus needs to associate the UV values with the vertices of the current pixel's triangle.

Usually, the fragment shader takes the UV value for the current fragment as an input from the vertex shader:
Vertex Shader:

out vec2 UV;

void main(){
...

    UV = vertexUV;
}

Fragment Shader:

in vec2 UV;

uniform sampler2D myTextureSampler;

void main(){

    color = texture( myTextureSampler, UV ).rgb;
}

I don't see how you would be able to deal with that in the fragment shader alone. You provide 4 UVs and look at 3 vertices for each triangle. How would you figure out what UVs to use and how would you compute the value for the current fragment?? In the end that is what the combination of vertex and fragment shader areis for, isn't it?

Also, why do you want to do that at all? The amount of data that are being transferred here seem too small to me to be worth the effort...

even the UVs never change

They do not change from drawcall to drawcall. But in the end your fragment shader interpolates the UV value for the current fragment from the vertices of the current triangle. And those values can change from pixel to pixel. The shader thus needs to associate the UV values with the vertices of the current pixel's triangle.

Usually, the fragment shader takes the UV value for the current fragment as an input from the vertex shader:
Vertex Shader:

out vec2 UV;

void main(){
...

    UV = vertexUV;
}

Fragment Shader:

in vec2 UV;

uniform sampler2D myTextureSampler;

void main(){

    color = texture( myTextureSampler, UV ).rgb;
}

I don't see how you would be able to deal with that in the fragment shader alone. You provide 4 UVs and look at 3 vertices for each triangle. How would you figure out what UVs to use? In the end that is what the combination of vertex and fragment shader are for, isn't it?

Also, why do you want to do that at all? The amount of data that are being transferred here seem too small to me to be worth the effort...

even the UVs never change

They do not change from drawcall to drawcall. But in the end your fragment shader interpolates the UV value for the current fragment from the vertices of the current triangle. And those values can change from pixel to pixel. The shader thus needs to associate the UV values with the vertices of the current pixel's triangle.

Usually, the fragment shader takes the UV value for the current fragment as an input from the vertex shader:
Vertex Shader:

out vec2 UV;

void main(){
...

    UV = vertexUV;
}

Fragment Shader:

in vec2 UV;

uniform sampler2D myTextureSampler;

void main(){

    color = texture( myTextureSampler, UV ).rgb;
}

I don't see how you would be able to deal with that in the fragment shader alone. You provide 4 UVs and look at 3 vertices for each triangle. How would you figure out what UVs to use and how would you compute the value for the current fragment?? In the end that is what the vertex shader is for, isn't it?

Also, why do you want to do that at all? The amount of data that are being transferred here seem too small to me to be worth the effort...

tidying, clairifying
Source Link
Djindjidj
  • 406
  • 2
  • 8

even the UVs never change

They do not change from drawcall to drawcall. But in the end your vertexfragment shader gets calledinterpolates the UV value for every single vertex, and theythe current fragment from the vertices of the current triangle. And those values can change from vertexpixel to vertexpixel. The pipeline The shader thus needs to know how to associate each pass's vertex with itsthe UV-values values with the vertices of the current pixel's triangle.

Usually, the fragment shader takes the UV value for the current fragment as an input from the vertex shader:
Vertex Shader:

out vec2 UV;

void main(){
...

    UV = vertexUV;
}

Fragment Shader:

in vec2 UV;

uniform sampler2D myTextureSampler;

void main(){

    color = texture( myTextureSampler, UV ).rgb;
}

I don't see how you would be able to deal with that in the vertexfragment shader alone. You provide 4 UVs and look at 3 vertices for each triangle. How would you figure out what UVs to use? In the end that is what the combination of vertex and fragment shader are for, isn't it?

Also, why do you want to do that at all? The amount of data that are being transferred here seem too small to me to be worth the effort...

even the UVs never change

They do not change from drawcall to drawcall. But in the end your vertex shader gets called for every single vertex, and they change from vertex to vertex. The pipeline thus needs to know how to associate each pass's vertex with its UV-values.

I don't see how you would be able to deal with that in the vertex shader alone.

Also, why do you want to do that? The amount of data that are being transferred here seem too small to me to be worth the effort...

even the UVs never change

They do not change from drawcall to drawcall. But in the end your fragment shader interpolates the UV value for the current fragment from the vertices of the current triangle. And those values can change from pixel to pixel. The shader thus needs to associate the UV values with the vertices of the current pixel's triangle.

Usually, the fragment shader takes the UV value for the current fragment as an input from the vertex shader:
Vertex Shader:

out vec2 UV;

void main(){
...

    UV = vertexUV;
}

Fragment Shader:

in vec2 UV;

uniform sampler2D myTextureSampler;

void main(){

    color = texture( myTextureSampler, UV ).rgb;
}

I don't see how you would be able to deal with that in the fragment shader alone. You provide 4 UVs and look at 3 vertices for each triangle. How would you figure out what UVs to use? In the end that is what the combination of vertex and fragment shader are for, isn't it?

Also, why do you want to do that at all? The amount of data that are being transferred here seem too small to me to be worth the effort...

Post Undeleted by Djindjidj
tidying, clairifying
Source Link
Djindjidj
  • 406
  • 2
  • 8
Loading
Post Deleted by Djindjidj
Post Undeleted by Djindjidj
Post Deleted by Djindjidj
Source Link
Djindjidj
  • 406
  • 2
  • 8
Loading