A programming language for OpenGL shaders.

learn more… | top users | synonyms

2
votes
0answers
93 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
94 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
44 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
399 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: http://iquilezles.org/www/articles/distfunctions/...
0
votes
1answer
574 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
71 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
33 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
105 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; ...
2
votes
0answers
48 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
314 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
52 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
67 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
110 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 ...
3
votes
0answers
54 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
61 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
69 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
215 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 Screen-...
1
vote
1answer
58 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
76 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
124 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
220 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, ...
16
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 ...
1
vote
1answer
59 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
108 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
236 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 post-process)...
0
votes
2answers
84 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 ...
1
vote
2answers
410 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
69 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 ...
4
votes
1answer
276 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
120 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
70 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
208 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
41 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
29 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
31 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
51 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
93 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
488 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
134 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
186 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
161 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
93 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
66 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 ...
0
votes
2answers
239 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: ...
1
vote
3answers
308 views

OpenGL, GLSL, Modify Background Fill via Fragment Shader

I have noticed that fragments rendered by the glClearColor() method do not pass through shaders. However, I'd like to modify these fragments using my fragment shader. Is there any way of forcing them ...
2
votes
1answer
285 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
2answers
50 views

Problem passing variables in fragment shader

I'm trying to pass a point light from an array to a CalcLight function in a fragment shader. It works when I hard code in the value, but not when I use a loop. Here's the code: #define TOTAL_LIGHTS ...
2
votes
1answer
195 views

Stencil buffer VS conditional discard in fragment shader

I have a continuous height-mapped mesh to represent landscape. I also have 1 to let's say 10 wells on this landscape represented by additional models. What I want to achieve is to create an illusion ...
1
vote
3answers
312 views

GLSL shaders work when hardcoded, not when loaded from file

I am trying to learn OpenGL. I have a main.cpp where I create the vertex and fragment shaders as strings, compile and link and it works fine. When I try to load the identical shaders from text files, ...
4
votes
0answers
90 views

Raymarching tangents

I've recently started to experiment with raymarching over on shadertoy.com. It seems common to find the normal for a distance field like so: vec3 scene_normal(vec3 p) { vec3 e = vec3(0.001, 0.0, ...