A programming language for OpenGL shaders.

learn more… | top users | synonyms

1
vote
0answers
16 views

Best way to find line segment intersection

I am working with an OpenGL ES 2.0 shader and need to find the point of intersection between two line segments in 2D space. I receive them in terms of both coordinates of both lines. Because they are ...
0
votes
0answers
65 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 ...
0
votes
0answers
29 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; ...
0
votes
0answers
24 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
votes
1answer
24 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
118 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
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 ...
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
46 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?
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 ...
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
74 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
96 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 ...
4
votes
1answer
93 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 ...
2
votes
0answers
48 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 ...
0
votes
1answer
36 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 ...
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 ...
6
votes
1answer
150 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
1answer
169 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 ...
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
27 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
77 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
0answers
92 views

dFdx and dFdy implementation details

I've been trying to understand the details of dFdx and dFdy since I'm trying to implement MSAA on a compute shader. The best description I've found is here: dFdx and dFdy on the cpu //T is any ...
1
vote
0answers
41 views

Consistent Shadow Map Filtering

I want to filter my shadow map generated by PSSM, but the problem is that I have a inconsistent filter size. The problem is that the shadow map sources rotate to find the best fit for the camera ...
1
vote
1answer
107 views

Pixelation shader explanation?

I was looking for a pixelation shader for my postprocessing and came across this shader snippet - Works pretty well! - Not a whole lot of explanations on how it works except for "Pixelation is process ...
1
vote
1answer
41 views

sf::Shader not working properly on texture

I'm having trouble getting my sf::Shader to work on an sf::Texture that I've drawn myself. The vertex shader is pretty standard (I think it's just a copy of the example from SFML's page). The fragment ...
4
votes
2answers
63 views

Displaying smooth borders given a coarse grid-based map

I've been messing around with different algorithms trying to make a grid based map look smooth, I have tested with various shader based methods and wrote a few of my own but none of them look right. ...
1
vote
1answer
48 views

Shader and Texture Scrolling depending on Direction

I am trying to scroll a texture using its uv in Unity but I don't get the result I need. The aim is to have two components, the speed and the direction. I would like to define the direction in ...
2
votes
0answers
39 views

Virtual infinite plane in shadow map

I have a WebGL deferred rendering pipeline, where I'm rendering shadow map with VSM technique. The goal is that the scene, or model, is hovering in space, and in addition to casting shadow on itself, ...
2
votes
1answer
57 views

Directional Light shadow mapping error - opengl

i need some help with shadow mapping (directional light) in opengl 3.3 and GLSL. The problem is that the shadows are not displayed correctly over de 3d models and primitives: This is the code that ...
3
votes
1answer
55 views

GLSL uniforms are returning -1, but they are being used in output

I have looked this up, and found some answers and people said that if uniforms aren't important to the final output than they get thrown away by the compiler. However, in my case they are being used ...
1
vote
1answer
123 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
vote
1answer
52 views

why doesnt this function work? glsl opengl c++

Im trying to move a transformation matrix onto the gpu, and I managed to find this code to help me on the way: vertex.shader: #version 410 core layout ( location = 0 ) in vec3 vertex_position ; ...
2
votes
0answers
40 views

Understanding webgl min/mag filter texture artifacts in orthographic projection?

Summary Flickering and shimmering of image plotted on a geometry where the viewport exceeds the size of the screen. I am using an orthographic projection for the camera. In this case, it is tied to ...
2
votes
1answer
83 views

GLSL Unsigned Int Values Not Retrieved Properly

I have packed several values needed for shading a particular vertex into a single 32-bit uint. In the shader, it is unpacked like this: vec3 color; uint vertexData = data; float sunlight, ...
0
votes
1answer
124 views

Help me understand this vbo/rotation, and how its done opengl c++

Im pretty new to opengl, and I just cant figure out how to rotate this vbo/vao in 2d space. This is how I bind my coordinates: float points[] = { 0.0f, 0.10f, 0.0f, -0.10f, -0.10f, 0.0f, ...
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 ...
0
votes
0answers
36 views

Invalid GLSL on some machines

I'm writing a game engine using OpenGL 4.3 using gcc 5, mainly to teach myself graphics programming. Initial development was on my Surface Pro 3 using mingw-w64 and worked like a charm. I've decided ...
1
vote
1answer
51 views

View Matrix to Texture Matrix

I'm converting view coordinates to texture coordinates for both my shadow maps and Screen space reflections. I keep seeing this conversion in examples: var T = new Matrix { ...
1
vote
1answer
125 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 ...
0
votes
2answers
52 views

Shader value remap - Blend Falloff

I would like to know if there's a way to remap a value that goes from 0 to 1 constantly like this. Into those values (those are examples). This might be some function transformation but I can't ...
0
votes
2answers
247 views

Textures rendering upside down and small with Pixel Shader in Mono Game but not XNA

I'm new to HLSL, attempting to use MonoGame to do some simple post processing effects. Here is my HLSL file, taken from one of rbwhitaker's xna tutorials (I would post the link, but can't post more ...
1
vote
0answers
53 views

Converting glsl shaders

I need to convert these shaders from #version 400 core to #version 130 successfully but for some reason when I do it my models are not rendering properly when I load more then one type and I cant find ...
3
votes
1answer
156 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 ...
2
votes
1answer
92 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 ...
0
votes
0answers
65 views

Color bleed ZX Speccy style

When having fun writing an imitation shader of attribute clashing on the ZX Speccy in OpenGL 3 and some fancy shaders, but I can't seem to think of an eficcient way for creating the attribute block ...
1
vote
1answer
121 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 ...
0
votes
1answer
40 views

Modify Element of Struct Array

I have this struct array in GLSL. struct Test { vec2 value1; vec3 value2; float value3; } uniform Test u_test[5]; How can I modify the elements of this array one at a time? I know that ...
0
votes
0answers
27 views

Pass custom data rather than vertices/indices to GPU?

(For reference, I'm using OpenGL 3.3, core profile.) I'm attempting to render a decent number of 2D quads on the screen. Each quad is different, and a GLSL shader does all of the work of rendering ...