Questions tagged [geometry-shader]

Geometry shader should not be mixed up with [vertex-shader], but are shader programs executed after vertex shaders. They take as input a whole primitive like point, line or triangle.

Geometry shaders are the 3rd type of GPU shader programs after and and process whole primitives like points, lines or triangles.

Resources

232 questions
1
vote
1 answer

Grouping data from Vertex Shader to Geometry Shader

Let's suppose I have some points p1,p2, p3 and p4. I need to apply some transformations to each them in the Geometry Shader phase based on its successor, so my GS would require having access to the pairs (p1, p2), (p2, p3), (p3, p4). How can I…
1
vote
0 answers

How to get correct screen space coordinates in OpenGl for vertex in front of near clip plane?

I'm trying to make wide line with width > 10px using this topic as example https://forum.libcinder.org/topic/smooth-thick-lines-using-geometry-shader. But i'm stuck with a problem: trivial perspective division gl_Position =…
1
vote
0 answers

Concatenate geometry shader output

I have a problem with geometry shader output vertices concatenation. I'm using openGL 3.3 and QT 5.6. I'm using lines_adjacency layout for GS and I make rectangles via each line. Like that: line strip to rectangles But the problem is I can't…
George
  • 11
  • 1
1
vote
1 answer

OpenGL Transform Feedback with dynamic Geometry

I am currently trying out Transform Feedback with a Geometry Shader. The Geometry Shader takes a Triangle, makes a Prism out of it and also puts a tetraeder on top of it (Think of it like an Obelisk but only with 3 instead of 4 sides). I get the…
Le olde Wire
  • 79
  • 1
  • 8
1
vote
1 answer

How to transform vertices in vertex shader to get a 3D billboard

I'm trying to implement vertex shader code to achieve the "billboard" behaviour on a given vertex mesh. What I want is to define the mesh normally (like a 3D object) and then have it always facing the camera. I also need it to always have the same…
Carles Araguz
  • 1,157
  • 1
  • 17
  • 37
1
vote
1 answer

gl_VertexID always zero in any useful geometry shader

I am using indexed rendering and a geometry shader. If I pass gl_VertexID to the geometry shader, it works fine as long as I do not emit any vertices; if I emit one or more vertices, gl_VertexID (passed as any name) is zero. Why? Using the shaders…
Mick
  • 11
  • 4
1
vote
1 answer

CG/Unity: Toy Shader For Duplicating Object

I'm new to writing shaders and I'm working on a practice geometry shader. The goal of the shader is to make the "normal" pass produce transparent pixels such that the object is invisible, while the "geometry" pass will take each triangle, redraw in…
Valevalorin
  • 390
  • 1
  • 3
  • 18
1
vote
1 answer

Unity Geometry Shader: Dynamic Grass

So, I have a functioning voxel engine that creates smoothed terrain in chunks of 1x1x1 meter in a 1024 radius around my player. I wanted to create a geometry shader that not only continues to texture the ground appropriately, but also creates grass…
guitar80
  • 716
  • 6
  • 19
1
vote
0 answers

A shader for implicit rendering of curves

I tried to create a shader for implicit rendering of curves. Unfortunately, it malfunctions (problem most likely lies in the geometry shader), displaying merely a clear screen. Apologies for possibly wrong terminology. Instead of aproximating a…
Ylfaue
  • 131
  • 1
  • 7
1
vote
0 answers

Unexpected behavior of geometry shader using line adjacency input

I am trying to write a simple shader to draw 3D line with thickness just to learn geometry shader in unity. However I am facing problem with the output from the shader when setting the input of the geometry shader to lineadj topology, which i…
gin
  • 286
  • 3
  • 15
1
vote
1 answer

Voxel rendering optimization with geometry shader

I programming with C++ + SDL2 + GLEW + Opengl 4.1 a small voxel game a little bit like Minecraft. I am trying to optimize the voxel rendering where I can. I slide the world into chunks and this chunks into blocks. Each chunk contains 16x16x16…
1
vote
0 answers

Sphere from point on the GPU

I have a mesh that consists of line lists (pairs of vertices). I would like to create a sphere on the GPU for every even vertex, centered on that vertex. Resolution of the sphere is not immediately important. Would a geometry shader be the way to do…
1
vote
1 answer

Confusion about maximum output from Geometry Shaders

The OpenGL-Wiki states on the output limitations of geometry shaders: The first limit, defined by GL_MAX_GEOMETRY_OUTPUT_VERTICES​, is the maximum number that can be provided to the max_vertices​ output layout qualifier. [...] The other limit,…
theV0ID
  • 4,172
  • 9
  • 35
  • 56
1
vote
1 answer

Calculate per-fragment normals for light in modern OpenGL

I want to know how to calculate per-fragment normals to be able to add light to the scene! I read in a texture generated from libnoise library - http://libnoise.sourceforge.net and create a terrain by calculating stuff in geometry-shader as seen…
Kahin
  • 455
  • 2
  • 9
  • 21
1
vote
0 answers

Geometry shader and MVP matrices issues

I'm working with openGL's Geometry Shader, and doing some tests to get the hang of it before I move on to more complex tasks. I wrote some code to transform inputted GL_POINTS into GL_TRIANGLE_STRIPs, and I apply the MVP matrix transformation in the…
Alex Coats
  • 115
  • 2
  • 16