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
0
votes
1 answer

GLSL Shader - Shadow with transparency (glasstable effect)

I´ve created a shader that is able to rotate an image about 180° and overlay it with a black gradient but now I want to create real transparency instead of using black as my background color. This is what I got so far: // Vertex Shader uniform highp…
seveves
  • 1,282
  • 4
  • 17
  • 37
0
votes
2 answers

Mixing different Program3Ds results in some objects not rendering

I have encountered something unexpected working with Stage3D. I have made two different shader programs for my objects. One of the programs is for using textured bitmaps and uv data. The other simply uses color data. The two objects are very…
jpwrunyan
  • 530
  • 5
  • 22
-1
votes
1 answer

How can I implement the Thin Plate Spline algorithm in a GLSL vertex shader?

I would like to make a GLSL shader for warping an image/texture using the TPS algorithm. How would I write the GLSL vertex shader for that?
coding-dude.com
  • 758
  • 1
  • 8
  • 27
-1
votes
1 answer

Vertex gradient shader rotation?

I have a shader that allows me to create and rotate a 2 or 3 color gradient. My problem was that it was very heavy on the GPU, so I moved this part of the code from the fragment shader to the vertex shader: fixed4 frag (v2f i) : SV_Target …
-1
votes
2 answers

UV Sphere - Getting Rid of join/vertex "dots"

I am creating a UV sphere (similar to an Earth globe divided into lines of latitude). I am doing this by: Calculating all of the vertices around each each parallel latitude circle (e.g. 72 points per circle) Using GL_TRIANGLE_STRIP to fill in each…
SparkyNZ
  • 6,266
  • 7
  • 39
  • 80
-1
votes
1 answer

How to fix shader invert y on IOS

This is shader to make UI blur. This shader work fine with android, but the y is invert on IOS device. I try to search for an answer but I don't understand how to implement it. Because it is using MainTex, but in my case I use grabpass. This is the…
Tengku Fathullah
  • 1,279
  • 1
  • 18
  • 43
-1
votes
1 answer

create array of ubo and present each at a time to its shader

i want to create array of ubo object in my cpu update it and then upload it to the gpu in one call like that. (for the example lets say i have only two objects). std::vector ubo(m_allObject.size()); int index = 0; …
Ori Yampolsky
  • 125
  • 13
-1
votes
1 answer

GLSL sparking vertex shader

I am trying to tweak this ShaderToy example for vertices to create 'sparks' out of them. Have tried to play with gl_PointCoord and gl_FragCoord without any results. Maybe, someone here could help me? I need effect similar to this animated…
VVK
  • 435
  • 2
  • 27
-1
votes
1 answer

How to update array of matrices to glsl shader

I'm currently working with skeletal animation and I'm really close to getting it working. Currently, I have a struct that has a matrix with 100 spots ( this is so that I can max have 100 joints ) like so : struct skelShader { glm::mat4…
Haplue
  • 70
  • 9
-1
votes
1 answer

How are colour-values interpolated in a Gouraud-shaderscript?

The gouraud-shader computes lighting at the corners of each triangle and linearly interpolates the resulting colours for each pixel covered by the triangle. How would you program this certain interpolation (in GLSL-code) ? Do you even have to code…
user1511417
  • 1,880
  • 3
  • 20
  • 41
-1
votes
1 answer

OpenGL - parameterized meshes

Given a human 3D model, I want to change its shape by giving parameters, like height, waist, bust etc. From what I gathered, the 3D model should have some 'hooks' around the areas I can change. Any pointers for this would be very helpful through…
spiralarchitect
  • 880
  • 7
  • 19
-1
votes
1 answer

Opengl program not recognizing second vertex input

I was reading about shaders and colors, how can they be defined as a vertex input. So i folowed the tutorial and came with a mess because the program was just reading forward and not going into next rows: GLfloat vertecies[] = { //vertices …
Alenprintf
  • 143
  • 1
  • 7
-1
votes
1 answer

OpenGL ES2.0: What's wrong with these shaders?

I'm trying to follow a FreeType2 tutorial here but I cannot get the shaders to link. Is there something wrong with these shaders? Vertex shader: attribute vec4 coord; varying vec2 texcoord; void main() { gl_Position = vec4( coord.xy, 0, 1 ); …
SparkyNZ
  • 6,266
  • 7
  • 39
  • 80
-1
votes
1 answer

Fragment Shader IN variable causes nothing to appear

I'm trying to send a variable from my vertex shader to my fragment shader, but when I include a specific the in variable in an if statement, it causes nothing to show up. Removing the if statement causes everything to appear and work normally.…
Daniel
  • 2,435
  • 5
  • 26
  • 40
-1
votes
1 answer

OpenGL Shader failed to work

I tried to use my own vertex shader and fragment shader in my OpenGL project. Both the program itself and the shader programs were compiled and linked successfully but neither the vertex shader nor the fragment shader worked. I managed to make some…
Grillnov
  • 13
  • 4
1 2 3
60
61