A programming language for OpenGL shaders.
1
vote
0answers
14 views
Somehow, my call to the glsl function texture() crashes my shader
I'm having a little bit of an issue here. I'm trying to access a depth texture while in a particle's geometry shader. When I try to sample from the texture, no particles ever get created, and ...
0
votes
1answer
27 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
57 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
76 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 ...
0
votes
0answers
18 views
sample distribution shadow map - how to correctly blur a shadow map
I implemented the sample distribution shadow mapping and I want to use the exponential variance shadow mapping as a filtering technique. I'm looking for a way to blur a shadow map. A standard blur ...
3
votes
1answer
51 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 ...
1
vote
0answers
26 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
18 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 ...
1
vote
1answer
30 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 ...
4
votes
1answer
89 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
111 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
53 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
25 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
71 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
61 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
37 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
78 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
32 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
58 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
40 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
52 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
53 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 ...
0
votes
1answer
89 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
51 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
27 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
74 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
100 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,
...
14
votes
1answer
2k views
Phong lighting - there is something very strange with specular lighting
I implemented Phong lighting. Everything seems to works - torus and spheres are lighted as expected, etc. But I notices something strange regarding specular lighting of directional light.
Here are ...
0
votes
0answers
33 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
44 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
92 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
49 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
191 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
51 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
114 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
84 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
63 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
94 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 ...
0
votes
0answers
20 views
Opengl - atomicMin/atomicMax issues
I have my compute shader and it compiles fine, but when linking I get an error stating "too many uniforms are used in this shader". Weirdly enough when i remove two lines of the code the shader ...
1
vote
1answer
40 views
Bloom only colors with at least one value equal to 1,
I want to bloom/blur any color that has a 1 in it,
like (1,0,0) and (1,0,1) etc.
The script bellow blooms any color over a threshold,
but what I want blooms only specific colors.
'Selective bloom'
...
3
votes
1answer
60 views
Do shader compilers typically know not to look up unused texture channels?
I have a texture that's from the color attachment of an FBO in OpenGL ES 2.0, so I have limited control over the number of channels in the image.
Suppose I only need the color from the R channel of ...
2
votes
1answer
105 views
GLSL: #define vs const
What is the difference between #define NAME VALUE and const int NAME = VALUE in GLSL 410 core?
As far as I can see, they both create a constant integer.
0
votes
1answer
76 views
Draw cube in glsl shader
I am working on a voxel engine. Currently my cubes are rendered as vbos. I thought, it may be better to load only the cooridinates of voxels to the shader and make it draw a cube itself. Can someone ...
5
votes
1answer
117 views
Dual paraboloid shadows on GLSL
I'm trying to port an XNA example to OpenTK + OpenGL, I found it here http://graphicsrunner.blogspot.com.es/2008/07/dual-paraboloid-shadow-maps.html
But I'm having a really hard time, I think my maps ...
3
votes
1answer
85 views
Underwater Shader Animation Help
I found an underwater (distort) effect and I got it to work but somehow I cannot make it animate given the offset here:
Fragment Shader code:
uniform sampler2D fbo_texture;
uniform float offset;
...
3
votes
1answer
74 views
Strange depth map projection
I'm trying to implement depth-only SSAO and for that, I render a depth map into a texture and pass it to my SSAO shader which then uses it.
The problem is that when I try to output the depth map ...
1
vote
0answers
52 views
Set Render Target usage
I am using Unity and I have some difficulties about understanding the way Set Render Target works and how it can behave with the shaders.
Is it possible to render a shader pass in multiple render ...