Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [glsl]

GLSL is the OpenGL shading language. Use this tag for questions which are specifically about shaders written in this language. For generic shader questions use [shader] instead.

2
votes
0answers
95 views

GLSL broken access operator

I've been following a guide to learn OpenGL, and I'm now learning how to do post-processing. In particular, I'm trying to apply a blur to my rendering through the following kernel: $\frac{\begin{...
4
votes
2answers
423 views

Why do we multiply vertex from left side in vertex shader with matrices?

I have been learning OpenGL 3.3 and I saw this expression: gl_Position = projection * view * model * vertex I am confused because I read in some book that if the ...
1
vote
1answer
2k views

Dynamic Array in GLSL

Is it possible to have a dynamic array in a GLSL shader? For instance, what if I have something like this in my GLSL Shader: ...
2
votes
1answer
79 views

How can deal with batch rendering when the elements in the batch changed every frame?

Since I am using batch rendering, so I should pack every render units can be batched into one big VBO. But, what if I am in a case where render units are dynamically changed, some new units are added ...
5
votes
1answer
297 views

Screen Space Ambient Occlusion Issues

I'm having problems with Ambient Occlusion. I've tried to follow both John Chapman's improvements over the Crytek AO and LearnOpenGL's tutorial of it when I failed to properly obtain the correct ...
4
votes
1answer
143 views

GLSL function parameters

In GLSL: Common Mistakes it states: Functions parameters must be declared with the in, out, or ...
12
votes
1answer
466 views

Confused with PBR implementations

I'm discovering the wonderful world of math and I'm hitting a huge wall with PBR and naming so I have a few questions: As far as I understand BRDF describe how a material react to light (incoming ...
-4
votes
1answer
282 views

Multiple shader passes to the same texture?

o7 I am unable to find an answer to my question, because apparently it's not well enough defined to separate itself from a similar one. So I have to ask here. My problem is quite simple. I have ...
4
votes
1answer
688 views

Phong shading in OpenGL: line of light from the center of the world

I implemented a Phong shader in GLSL, but there is a bug. What you are (supposed) to see down below: A point light source rotating around the center of the world, with a radiance of (0, 100, 0) A ...
1
vote
2answers
3k views

Send Texture to Shader

I've been following the LearnOpenGL tutorials and I've come across a piece of code I don't understand. ...
5
votes
2answers
152 views

Strange behaviour in vertex shader with divisions

This is the vertex shader code: ...
5
votes
1answer
216 views

Special Texture Stretching without deformation

I am trying to achieve a special texture stretching effect in my shader. Here is how I define my uv before sampling my texture, nothing really special. ...
4
votes
1answer
105 views

NormalMap problems: bumps work, but shade does not

I've been trying to figure this out for a few days now, but I just can't get it right. I've read multiple tutorials and possible explanations, I even watched a java tutorial without finding the ...
3
votes
1answer
208 views

Easing curves on the GPU?

I was thinking that I could pass a timestamp in (from requestAnimationFrame) to the vert shader, and just have my easing curves in the GPU instead of using (for example) Tween.js from the outside. Is ...
3
votes
0answers
70 views

Artifacts (numerical errors?) in rasterisation renderer

This might be not laser precision question but this issue appeared a long time ago when first trying to render some scene with 3D models in rasterisation renderer and apply some lighting, ...
2
votes
0answers
60 views

Implementation of the paper “unified texture management of arbitrary meshes”

I briefly read the paper and I think I got the basic idea of it. The paper doesn't really go into implementation details though so my question is mostly on that. In the paper, needed tiles are ...
1
vote
1answer
151 views

My (ADS) shader doesn't render the light direction correctly

This is what I'm doing: vertex shader: ...
1
vote
1answer
260 views

Am I passing the correct matrices for my shader? openGL/C++

On page 89 of David Wolff - OpenGL 4.0 Shading Language Cookbook book, it suggests a way to set up up a Phong shader in the fragment stage. It lists some different matrices to pass via uniform, and I ...
1
vote
0answers
159 views

Subdivision vertex normal interpolation

I'm using GLSL 4.0 to write a subdivision routine that divides the triangles on an object through a geometry shader. I'm not using barycentric co-ordinates but vector arithmetic to output the triangle ...
1
vote
1answer
376 views

What framework shoud I use to implement the RAISR upscaling algorithm on the GPU?

I recently ran across the paper RAISR: Rapid and Accurate Image Super Resolution and thought it seemed like an interesting technique for scaling up images. However, I haven't seen any implementation ...
8
votes
2answers
543 views

What is a good approach for handling uniforms in modern OpenGL?

I'm creating a renderer using modern OpenGL (3.1 and up) and now I'm trying to create an efficient but flexible way of handling uniforms. I've been reading up on uniform buffer objects and on what a '...
4
votes
0answers
187 views

How to output a 32 floating value in a render buffer with fragment shader

I would like to downsample my depth buffer and my normals. For that, I take in input of my shader, the corresponding textures (depth, normal), and I write my new values in a multi render target. I ...
5
votes
1answer
1k views

What are Jittering and Dithering

I've heard a lot about jittering and dithering but I would like to know more about those techniques, especially when used to avoid visible sampling in a fragment shader. What are the differences ...
2
votes
0answers
114 views

If statements in shaders - implications and consequences [duplicate]

I've heard a lot that in shader development, you absolutely need to avoid branching and so if statements. But why? Does this have a real impact on performances on old and modern hardware or is it ...
4
votes
1answer
755 views

Unable to pass custom Matrix4 to GLSL as a uniform

I am fairly new to graphics programming and I am trying to pass a custom Matrix4 (non-glm) to my vertex shader by using a uniform. ...
4
votes
1answer
320 views

Benchmark GLSL fragment shader

How can I benchmark a fragment shader? What my shader does is basically lots of floating point operations, since it's doing some procedural stuff.
2
votes
0answers
113 views

GLSL shader debugging [closed]

Is there any tool available for debugging GLSL shaders? I have nvidia geForce 940m GPU which doesn't support Nvidia NSight and RenderDoc is great but it doesn't support GLSL shader debugging. I am ...
5
votes
1answer
196 views

Texture coordinates are not updating according to the vertex divisor specified

I want to draw a string of text with a single draw call (Instancing). I am reading a bitmap for each character texture. I want to pass the texture coordinates for each vertex of a quad (a single ...
6
votes
1answer
296 views

Binary scene voxelization using imageStore - problem

This problem has been haunting me for some time but I was busy with other things. I can't finish my GI technique (specifically occlusion step) without solving it. I made a binary scene voxelization ...
6
votes
2answers
161 views

What is the correct way to put different textures on different parts of an object?

I tried passing a variable from the vertex shader to tell the fragment shader whether or not I wanted part of an object textured. That way I could write another shader for the other parts of the ...
5
votes
1answer
411 views

Exponential shadow maps sampling with PCF for sampler2DShadow instead of sampler2D

I am trying to make use of free hardware PCF sampling with sampler2DShadow and extend it to more samples. So far I am sampling shadow map (...
5
votes
1answer
802 views

Attribute Location in Multiple Shader Programs

I'm trying to switch between the rendering of two different scenes as fast as possible using OpenGL. For all my OpenGL related stuff I wrote a wrapper-class which provides a quite easy way of adding ...
5
votes
3answers
339 views

Texture coordinates projection

I have some classic texture coordinates and as a normal behaviour they follow the mesh's transformations. I am trying to use the same texture coordinates behaviour but without being affected by the ...
8
votes
2answers
648 views

Eye Parallax Refraction

I am trying to implement the Parallax Refraction effect explained by Jorge Jimenez on this presentation: http://www.iryoku.com/downloads/Next-Generation-Character-Rendering-v6.pptx and I am facing ...
2
votes
1answer
588 views

Bezier Curve Tool Controlled by Mouse

So I have recently learned about Bezier Curves (quadratic & cubic) and have a thorough knowledge of how they work. In my graphics engine in DirectX I wanted to implement a Bezier Curve Tool ...
5
votes
2answers
241 views

Special directional light type

I am currently trying to implement a specific directional light type. This light type has been used in the game INSIDE and is called orthogonal spotlight (aka local directional light). I assume that ...
2
votes
1answer
346 views

Transforming fragment-to-camera to tangent space for parallax occlusion mapping

I'm trying to implement POM using this tutorial. As stated, I need to transform fragment-to-camera to tangent space and then pass it to a function. tangent space is computed using Assimp. Well I ...
5
votes
3answers
2k views

What is the difference between a Sampler and an Image variables in GLSL?

Reading through some code about voxelization I found the following line in the fragment shader ...
4
votes
2answers
425 views

OpenGL: Purpose of transform matrix in Vertex shader where transform*vertex

I'm trying to understand OpenGL by using Processing OpenGL ES. If I have an example Cube to render. I've read that a vertex shader will be run once for each Vertex. The fragment shader will be run (...
7
votes
1answer
2k views

OpenGL specular shading- Gradient banding issues

I use Phong shading as my lightning model. Nevertheless, The specular shading produces gradients in the light cone: Hopefully you can see the gradients starting from the lower left corner expanding ...
3
votes
1answer
252 views

Bug: Overly Sharp Highlights in PBR

I'm still working on my BRDF equations. Theoretically, all equations are correct, but the hilights are super sharp. I'm not sure if this is a result of me not using Image-Based Lighting (I currently ...
4
votes
1answer
204 views

I dont understand how a GPU computes and branches, could you please help me fix this shader preformance

I have been working on how the GPU does parellel processing, and branching. However I am not yet to the point where I know how to make this shader more efficent. Essentially I dont know enough about ...
5
votes
1answer
585 views

GLSL - Merge two textures

I would like to display arbitrary 3d meshes with black edges (black outline, black ridges, etc.). Thereby I have created two different textures: One color texture and one anti-aliased edge texture. ...
2
votes
2answers
142 views

Can I use the same vertices to render multiple things?

I'm passing my vertex shader a bunch of vertices and color data. I would like to first render the triangles and then render a point at each vertex. The triangles render fine, but I can't think of a ...
5
votes
1answer
279 views

mapping 3d texture on view frustum (or part of it)

I'm implementing volumetric fog in my OpenGL renderer. First I inject color into 3D texture using compute shader, atomic operations and shadow map visibility check. The information I use to compute ...
7
votes
2answers
245 views

Is there a objective reason for matrix naming conventions?

I'm probably going to screw this up but.... In all the graphics libraries I've seen various matrices are often called something along the lines of ...
6
votes
1answer
680 views

Creating an “ink spread” effect with a glsl fragment shader

I have dealt with glsl before, but I still have problems with my understanding of how to achieve certain kinds of effects with per-pixel processing. What I am looking to do is use a fragment shader to ...
5
votes
1answer
2k views

Why is my fragment shader not showing any colors?

I am basically following this tutorial about diffuse lighting in OpenGL. I did some modifications but the idea is the same, at least that's what I think. However, my fragment shader is not showing any ...
1
vote
1answer
352 views

Why does substracting -1 in shader fail for a float data type?

I am loading a texture in a WebGL fragment shader (GLSL version 1.00). This is my working code: ...
6
votes
1answer
67 views

Why cant I use `#include` after upgrading my driver

After updating my graphics driver and trying to run this example from John Chapman's blog I got this error ...