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.

Filter by
Sorted by
Tagged with
3
votes
1answer
233 views

GLSL function parameters

In GLSL: Common Mistakes it states: Functions parameters must be declared with the in, out, or ...
14
votes
1answer
763 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 ...
-3
votes
1answer
359 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 ...
3
votes
1answer
1k 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
7k 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. ...
4
votes
2answers
193 views

Strange behaviour in vertex shader with divisions

This is the vertex shader code: ...
4
votes
1answer
333 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
119 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
269 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 ...
2
votes
0answers
76 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
62 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
192 views

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

This is what I'm doing: vertex shader: ...
1
vote
1answer
363 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
234 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
550 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
911 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 '...
3
votes
0answers
237 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 ...
4
votes
1answer
2k 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
147 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
2k 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. ...
3
votes
1answer
459 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.
3
votes
0answers
241 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 ...
4
votes
1answer
283 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 ...
5
votes
1answer
422 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 ...
5
votes
2answers
179 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 ...
4
votes
1answer
562 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 (...
4
votes
1answer
1k 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 ...
4
votes
3answers
429 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 ...
7
votes
2answers
1k 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
784 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
249 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
2answers
859 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 ...
7
votes
3answers
3k 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
633 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 (...
8
votes
1answer
2k views

OpenGL specular shading - Gradient banding issues

I use Phong shading as my lighting model. Nevertheless, the specular shading produces gradients in the light cone: Hopefully you can see the gradient starting from the lower left corner expanding ...
3
votes
1answer
317 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 ...
5
votes
1answer
227 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
1k 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
205 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
408 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 ...
6
votes
2answers
366 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 ...
5
votes
1answer
1k 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 ...
4
votes
1answer
4k 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
369 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: ...
5
votes
1answer
69 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 ...
21
votes
1answer
3k views

Why does my Perlin Noise look “blocky”?

I tried to implement Perlin Noise by myself using just the theory (following flafla2.github.io/2014/08/09/perlinnoise.html). Unfortunately I was unable to achieve the look of the "original" Perlin ...
5
votes
1answer
95 views

gamma transform in webGLSL: when already done or yet to be done?

Color spaces issues are such a pain, especially when you create color data at the middle of the chain, and a pile of libs and apps separate this to the display... Here I only worry about gamma ...
4
votes
1answer
898 views

Guidance with Sphere-Map calculation in GLSL

I'm trying to achieve the same effect in OpenGL/GLSL as what Blender does when you add a texture, set to "Reflection" This ultimately is a way to fake specularity, or "metallicness" if I get it right....
4
votes
2answers
521 views

Clearing but not drawing objects

I was trying to draw a plane and cubes in a framebuffer but nothing is drawing in that framebuffer besides clearing it with a color. Here's the code... ...
11
votes
1answer
4k views

Loop performance in a shader

I am wondering what's the best way to integrate a dynamic loop function in a shader? First, it seems that dynamic arrays are not possible. So, is it better to create a maximum size array and only ...