A programming language for OpenGL shaders.
1
vote
0answers
5 views
GLSL shader with light colors wrong on nvidia optimus
So, I built some code to draw a spinning cube with a red light on the right side, and a blue one on the left.
I run it on my laptop with optimus graphics, and on my desktop with nvidia. On the laptop, ...
2
votes
0answers
50 views
Schlick Fresnel Shader
I hope you are all doing ok. I have an issue with my Fresnel shader that doesn't allow the Fresnel to change as my camera moves around. I'm not sure what i'm doing wrong. I'm using glsl with the ...
0
votes
0answers
35 views
Black Screen when using High-Performance NVIDIA Processor
I have an issue where my program renders a black screen on other computers. I narrowed it down to when a different graphics card is being used. When I run the program using Integrated Graphics ...
1
vote
0answers
24 views
Physically-based BRDFs
I'm starting to implement a real-time PBR shading pipeline in one of my projects and had a few questions that I thought folks around here could help clarify.
1) Is it fair to say that in a PBR ...
0
votes
1answer
29 views
GLSL Shader not compiling (Android & LibGDX) and no log available
I'm trying to get a "ripple"-shader working for OpenGL ES 2.0+ (using LibGDX).
However, I can't get it to compile, and for some reason ShaderProgram.getLog() returns an empty string even though the ...
3
votes
0answers
50 views
Screen tearing in fragment shader on R9 380 GPUs
two players are encountering an issue with my game where the screen is tearing when it uses a fragment shader but it only seems to be doing this for players with a R9 380 GPU. Here is what it looks ...
1
vote
1answer
103 views
GLSL strange if statement problems
I'm trying to use if statement in my fragment shader.
I want to compare my in int finalLightType[4];
Here is my vertex shader code and fragment shader code:
Vertex:
#version 400 core
in vec3 ...
0
votes
1answer
59 views
Projection Matrix Breaks My Rectangle
This is my vertex shader, shown below.
#version 330 core
in vec3 a_position;
in vec4 a_colour;
// FOV = 70, near plane = 0.1, far plane = 1000
const mat4 u_projection = mat4(
1.428148, 0.0, ...
0
votes
0answers
36 views
SSAO attenuation problem
I followed this tutorial and I'm getting incorrect results for SSAO.
My gBuffer seems valid. Here is a picture showing Ambient Occlusion, Normalized Depth, Normals in View Space and Position.
...
1
vote
1answer
67 views
Best way to find line segment intersection
I 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 line segments I would also need to know if ...
0
votes
0answers
71 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
32 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
27 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
30 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
217 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
121 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
41 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
54 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
35 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
62 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
37 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
84 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
101 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
113 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
61 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
49 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
39 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
190 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
238 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
65 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
29 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
86 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
107 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
43 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
138 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
47 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
65 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
44 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
58 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
58 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
145 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
53 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
52 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
90 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
138 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
37 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
66 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
164 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 ...