A programming language for OpenGL shaders.

learn more… | top users | synonyms

3
votes
1answer
152 views

deferred tiled lighting

EDIT I have discovered that it does not seem to be the lighting calculation but the culling code because when i draw the lights without the culling it works perfectly. I have been attempting to ...
0
votes
1answer
35 views

Transforming normals along with vertex? (GLSL)

So, I got a model matrix (Via uniform variable) in the shader, is there any way to use the model matrix to transform the normal of a vertex that has been transformed with glm::transform/rotate? If ...
0
votes
2answers
129 views

How to wrap textures inside shader GLSL

I'm trying out GLSL and one of the problems I'm facing is wrapping a random texture sampler in the shader. Searching for answers on the web first, this leads me to using these commands: ...
0
votes
0answers
60 views

Modern OpenGL and SpriteBatching

I tried to find tutorials regarding SpriteBatch done in Modern OpenGL 3.0+, but failed to find any good resources so far. So can anybody please provide me a good resource/tutorial to achieve ...
1
vote
2answers
358 views

2D Hidden Object Silhouette Shader

Right now I am not using any depth information in my engine, but I just found out that it would be neat to be able to render the silhouette of important game objects that are "behind" something with a ...
0
votes
0answers
28 views

Issue with Use SSBO OpenGL

Students that use OpenGL. Do not speak English well. So please understand. There is currently a problem C++ Code Setup() : glGenBuffers(1, &ssboHandle); GLuint ssbo_binding_point_index = 0; ...
2
votes
1answer
142 views

equirectangular panorama rendering?

I want to render my scenes as equirectangular panorama frames. I can get the angular fisheye which is what I actually need by applying the rendered frame as a texture to a correctly UV mapped circle. ...
1
vote
1answer
252 views

Trying to implement Camera

I'm trying to implement a Camera class in order to walk and look on the world as follow: #ifndef _CAMERA_H_ #define _CAMERA_H_ #include <glm\glm.hpp> class Camera { public: Camera(); ...
1
vote
1answer
549 views

OpenGL Tessellation makes point

A little problem with my tessellation shader. I try to implement a simple tessellation shader but it only makes points. Here's my vertex shader : out vec4 ecPosition; out vec3 ecNormal; void ...
6
votes
1answer
142 views

How is Signed Distance Field Ray Marching implemented for a dynamic world?

I think I understand the basics of Signed Distance Field Ray Marching. You model your scene with a bunch of distance fields (such as these: ...
0
votes
0answers
22 views

LWJGL 3 GLSL normal problem

I have a pretty strange problem today. I started to make a 2d game yesterday, and everything was right until now. I wanted to make a lighting system, wich required me to send the vertexnormal from ...
1
vote
1answer
121 views

Raymarching on a Hi-Z buffer in GLSL

So I'm trying to implement Screen Space Reflections using a Hierarchical z-Buffer in GLSL. I'm following the approach from GPU Gems 5 and the Frostbite presentation linked here ("Stochastic ...
-1
votes
1answer
23 views

OpenGL/GLSL matrix in uniform block confusion

I'm a bit confused about the proper way to send a matrix from my code (C++) into a GLSL shader. My matrix object is stored in row major format in memory. If I use the following shader code it works ...
-1
votes
1answer
111 views

Will Vulkan Kill the use of GLSL? [closed]

After reading this link I am still unclear as to the shading language support in Vulkan. Is GLSL being phased out? If someone were just starting and wanting to master shading languages and computer ...
0
votes
1answer
750 views

OpenGL Shader Storage Buffer Objects array length problem

Ok guys, I think I have a very strange problem. I have an old laptop, but its HD 6370M currently supports opengl 4.4, so i decided to learn how to use some new features of this platform, so after ...
0
votes
2answers
119 views

Why does rotating my quad appear to move it farther away?

I have created a 3x3 matrix class which is then passed over to OpenGL Vertex Shader for transform my Quad. I have been trying to rotate my Quad around Z-Axis. Rotation is working but the Quad getting ...
1
vote
1answer
55 views

Strange artifacts when using gl_FragCoord to access texels

I ran into a problem with using gl_FragCoord variable to access texels. The problem can be illustrated by following example: First I render a textured quad into texture of size (W, H) where W and H ...
23
votes
1answer
12k views

How do Raymarch shaders work?

I have been looking at shaders found here shadertoy.com and most of the cool ones have noise and raymarch in common. I do not understand the source code at all but I really want to. How do these ...
2
votes
2answers
971 views

How to do directional per fragment lighting in world space?

I am attempting to create a GLSL shader for simple, per-fragment directional light. So far, after following many tutorials, I have continually ran into the issue: my light is specified in world ...
0
votes
1answer
35 views

OpenGL: strange thing with depth and text rendering

TL;DR I render a scene with M,V,P matrices as always. Than I render something (in this case - text) without any matrices and using separate shaders pair on coordinates with Z = -1. Somehow it's ...
0
votes
0answers
45 views

Unity - _LightMatrix0 and Directional Light

I am trying to access the _LightMatrix0 in a forward base pass to calculate some light point of view coordinate but it seems that the _LightMatrix0 is empty with directional light. Any idea how can I ...
-1
votes
1answer
32 views

GLSL shaders in a program

I obviously don't want the client to be able to view/modify my glsl code. Does this leave me with only one option, and that's to hardcode it in my cpp files? How do you deal with this issue?
3
votes
1answer
112 views

How to deal with overlapping black parts of Light mask textures?

I am using this masking texture for a dynamic lighting effect in my game: It looks beautiful until two lights begin to overlap: This is obviously because the textures are overlapping when I draw ...
15
votes
1answer
2k views

Phong lighting - there is something very strange with specular lighting

I implemented Phong lighting. Everything seems to work - torus and spheres are lighted as expected, etc. But I notices something strange regarding specular lighting of directional light. Here are two ...
43
votes
6answers
22k views
-1
votes
1answer
149 views

Encoding Float to RG/RGBA and Blending

Encoding a float value inside a RG or RGBA texture is very interesting and useful but it is also become quite useless when you use blending as the result and the values might be altered because of ...
4
votes
4answers
1k views

Passing array to uniform in glsl error

Here is my attemps to pass array to uniform array: struct Vector{ float x,y,z; } float threshold[2] = { 0.5, 0.25 }; Vector *kernel = new Vector[_kernel_size]; // _kernel_size==16 // fill kernel ...
0
votes
2answers
79 views

Passing data into a vertex shader for perspective divide

In OpenGL and GLSL, I am just learning about perspective projection and the vertex shader. However, I am a little confused about what data actually needs to be passed to the vertex shader, and what ...
0
votes
1answer
32 views

Using one GLSL shader program for textured and untextured rendering?

Rather than have two separate shaders in my OpenGL code (one for when a texture is bound, one for when none is bound) I usually go for one shader program which handles both. This is my usual fragment ...
3
votes
0answers
71 views

How do 2D volumetric lights work?

Context So in my current project (written in Java using LWJGL / OpenGL, so GLSL for shaders) I added lighting quite a few months ago, which was already an interesting challenge, having never done ...
4
votes
1answer
95 views

How do I do selective water surface rendering?

I have a shader that renders the "texture" of a very realistic water on a tile in the 3D world using a Frame Buffer. The problem is that, for example, I only want to render the part that isn't below ...
2
votes
1answer
91 views

Tiled deferred rendering light culling

I'm trying to implement tile based light culling in opengl using a compute shader. I am using this as a guide. The lighting calculations work fine but the point light culling doesn't seem to work any ...
4
votes
1answer
88 views

Rotate billboard towards camera

I'm trying to create a particle system in OpenGL, and as such I need to use billboards. I need these billboards to face the camera at all times. The tutorials I've been following only rotated the ...
9
votes
1answer
12k views

OpenGL/GLSL: Render to cube map?

I'm trying to figure out how to render my scene to a cube map. I've been stuck on this for a bit and figured I would ask you guys for some help. I'm new to OpenGL and this is the first time I'm using ...
3
votes
1answer
1k views

GLSL Core Functionality Geometry Shader examples

I'm doing some research on geometry shaders and am having problems finding code examples/tutorials that does not use one of the extensions introduced before it was core functionality of OpenGL 3.2. ...
3
votes
2answers
4k views

computing gl_FragDepth

I am trying to draw spheres using a billboard, so I have a normal map with a z component that I am sampling in my fragment shader. I just need to add this z component to the depth of my fragment to ...
6
votes
1answer
5k views

GLSL if-else statement unexpected behaviour

This question is related to this other one I asked a few days ago. Because I have finally get to the bottom of the issue, I have rather preferred to open a new question with a more detailed ...
19
votes
1answer
3k views

Why does this geometry shader slow down my program so much?

I have an OpenGL program, and I'm rendering a terrain mesh. I displace the vertices in the vertex buffer and don't really color them in the fragment shader yet. I'm adding a geometry shader one part ...
2
votes
0answers
45 views

Texture coordinates for custom geometry in SceneKit ios9

I am trying to texture the a custom plane shape I created in scenekit on iOS9. I need the texture to spread out and stretch over the entire surface. I have a vertex and fragment shader on an ...
2
votes
1answer
37 views

(GLSL) Lighting code outputting a black quad

So, ive been transitioning to modern opengl recently and it's going rather well. But alas, something must go wrong. As the titel says, all I'm getting is a completely black quad. (Ive double checked ...
3
votes
1answer
972 views

Alpha Blending: use the pixel with the smallest alpha

I'm writing a transparency shader where I need any intersecting textures to, wherever they overlap, take the texture pixel with the smallest alpha value and render only that, discarding the other ...
0
votes
1answer
98 views

OpenGL Shaders Ignored

I have been following this tutorial to try and start learning OpenGL. However, upon compiling my code, my triangle turns out to be black. At first I thought that there was something wrong with the ...
0
votes
1answer
165 views

Terrain shader from heightmap opengl GLSL

I generated a terrain from a heightmap and now I'd like to apply shader on it which can contain different textures, based on height but I can't adapt any online code to my project. This is the ...
1
vote
1answer
122 views

FAST position reconstruction from depth

I'm struggling a lot with reconstructing the world space position (or alternatively the view space position) from depth (by reading the depth buffer) in a performant way (in a full-screen ...
4
votes
1answer
215 views

How to handle the birth and death of particle without reading from the buffer

I've implemented a simple particle system where each particle has a position, velocity, age and lifespan stored in different SSBOs. Most of the data including all the position, velocity and age is ...
4
votes
1answer
63 views

Shaders: packing 4 textures into a single RGBA - slower?

I'm experiencing something really strange on an iOS mobile device. I have 4 textures, and after some profiling it seems, that doing four separate grayscale texture reads is faster, than reading the ...
1
vote
1answer
26 views

How can I move the camera directly under a certain plane?

I am attempting to render a "reflection" of a scene for water: To create this illusion, I need to render the scene from below, and then ignore all geometry below the water line. As such, I need ...
2
votes
1answer
75 views

How to blur image using glsl shader without squares?

I want to blur image with Gaussian blur algorithm. And I use the following shaders: Vertex shader attribute vec4 position; attribute vec4 inputTextureCoordinate; const int GAUSSIAN_SAMPLES = 9; ...
1
vote
1answer
120 views

OpenGL 3.3+ Problem with ortho projection for UI/HUD

I have to a little bit of a problem with drawing HUD elements on top of my 3d world using a ortho projection. My 3D world keep getting render but there is nothing showing of my UI. I wrap the code ...
3
votes
1answer
833 views

How do I create a jet engine exhaust effect with a shader?

How would I create a jet engine exhaust effect, as shown in the image from Fzero GX below. GLSL and OpenGL examples/solutions are prefered, though other resources are also welcome. Requirements ...