Questions tagged [vertex-shader]

Vertex shaders are executable programs that execute as part of the programmable geometry pipeline in modern graphics APIs such as e.g. Direct3D or OpenGL. Vertex shaders are usually hardware accelerated on consumer hardware nowadays. The vertex shader processes one vertex at a time, followed by primitive assembly, optionally geometry shader and transform feedback, clipping, and finally rasterization and fragment processing.

Vertex shaders were introduced as an extension to OpenGL 1.3 and as a feature of Direct3D 8.0 around 2001. They were the first step in making part of the render pipeline on consumer hardware freely programmable as opposed to hardwired functionality like the TnL stage or register combiners which until then were at best configurable in some limited way.

The vertex shader is typically the first programmable part of the pipeline. The scope of a vertex shader is a single vertex without any information about the connectivity between vertices or any other vertices and any state set as "uniform", i.e. data that is constant across everything in the current draw call. A vertex shader cannot create vertices nor discard them, and a vertex shader has no local memory or other way that can be used to communicate data from one vertex to another.

After vertices have been transformed by the vertex shader, they are assembled into primitives and optionally processed by a geometry shader, which runs on the scope of all vertices within a single primitive (such as a triangle) and optionally the surrounding vertices.

Resources:

911 questions
-1
votes
1 answer

Vertex Shader and Color of the Original Model

I am currently building a vertex shader to perform a very simple rotation around z-axis over a 3-D model. The 3-D model is originally well colored. But after I add the shader I wrote, it screw up the original color. I have no idea why, because I…
Cherish
  • 187
  • 1
  • 2
  • 13
-1
votes
1 answer

What range of values does my vertex shader need to output?

I'm using openGL, and trying to draw a cube, but it won't show up. I used transform feedback and found out my vertex shader is outputting these values [0] -0.500000000 float [1] -0.500000000 float [2] -3.54020095 float [3]…
barbiedude97
  • 83
  • 1
  • 5
-2
votes
1 answer

Three.js - How to Rotate Shader Material?

My problem is trying to get the sky to rotate on its z-axis. For example if I rotate the sky by 180 degrees the shadow from the sun light should display in the opposite direction. The code sandbox:…
-2
votes
1 answer

WEBGL: How to Color a Fractal Design within the Fragment Shader

I am looking to color a fractal within my fragment shader in an WebGL project. Within my fragment shader, I have a vec3 called Color that contains the RGB values from 0.0-1.0. To make a fractal design similar to but in black and white, what…
-2
votes
2 answers

How to calculate world_position in Shader

I want to program a shader and I have the position of a vertex and 3 matrices: mat4 model-view-projection matrix mat4 world transformation of the model mat3 world transformation for normals The output has to be vec3 world_position How can I…
Peter111
  • 803
  • 3
  • 11
  • 21
-2
votes
2 answers

How to make visible uniform variable in both shaders?

I have variable in vertex shader "uIsTeapot". uniform float uIsTeapot; Vertex shader work with it very well, but fragment shader don't see it. If I use if (uIsTeapot == 0.0) then an error occured "uIsTeapot": undeclared identifier but I defined…
Log
  • 433
  • 4
  • 19
-2
votes
1 answer

Why is there the need for the index argument in glEnableVertexAttribArray?

Using glVertexAttribPointer the opengl implementation already knows to which attribute location/index in vertex shader Vertex Attribute Object is bound, so why is there the need to provide attribute index in glEnableVertexAttribArray again? I think…
Shuji
  • 624
  • 1
  • 8
  • 24
-2
votes
1 answer

render two images to the screen separately

I want to render two textures on the screen at the same time at different positions, but, I'm confused about the vertex coordinates. How could I write a vertex shader to meet my goal?
-2
votes
1 answer

about VTF(vertex texture fetch)

I'm studying clipmap algorithm, and I want to get elevations by VTF. But I've got a problem when using vertex textures. I don't know what's wrong. the related code is like this: int width=127; float *data=new float[width*width]; for(int…
Qingsong
  • 51
  • 1
  • 7
-2
votes
1 answer

Vertex shader (GLSL) strange behaviour; Does not draw

I'm trying to implement skeletal animation using my vertex shader. I pass the indices and weights of my vertices as attributes, and upon drawing I pass the animation matrix for every bone as an array to my shader. Now for some reason when I add the…
Perry
  • 98
  • 7
-2
votes
1 answer

Not sure how to solve shader errors?

Error: ERROR: 0:1: 'basicVertex120' : syntax error parse error Code: #version 120 attribute vec3 position; attribute vec2 texCoord; varying vec2 texCoord0; uniform mat4 transform; void main() { gl_Position = transform * vec4(position,…
Zeveso
  • 1,274
  • 3
  • 21
  • 41
1 2 3
60
61