A programming language for OpenGL shaders.

learn more… | top users | synonyms

0
votes
1answer
21 views

Modifying UV's origin on shader (OpenGL)

Is there a way to change the UV's origin (bottom-left) on shader?
1
vote
1answer
37 views

OpenGL tesselation doesn't change geometry shape

I implemented tessellation control and evaluation shaders in OpenGL, but the effect it has on my terrain was not what I expected. I expected that the low poly-count curves and shapes on the terrain ...
0
votes
0answers
21 views

FFP Alpha Test shader - function decleration

I'm trying to use FFP_Alpha_Test RTSS from ogre on GLES2 platform. I added the relevant files and built everything but got an error: No matching function for call to 'FFP_Alpha_Test' Fragment Program ...
3
votes
1answer
115 views

Procedural Hatching

I know that it is possible to make a shader that uses procedural hatching instead of pre-designed tonal art maps. But is it possible to make that procedural hatching in the fragment shader? I would ...
0
votes
1answer
15 views

Aggregation of value in GLSL loop results in 0

I'm banging my head against a wall trying to understand why this code is giving me some reasonable results with some visible colors on parts of the screen... #version 130 in vec2 vTex; // must match ...
0
votes
0answers
38 views

World-space position from logarithmic depth

After changing my current deferred renderer to use a logarithmic depth buffer I can not work out, for the life of me, how to reconstruct world-space depth from the depth buffer values. When I had the ...
0
votes
0answers
41 views

Is this 2D light implementation with shaders good enough?

After some days reading and programming shaders in GLSL (and Allegro 5) I came up with the stages I will be using to render the lights in my 2D test game. My first goal is to reach something like what ...
1
vote
1answer
66 views

Texture coordinates projection

I have some classic texture coordinates and as a normal behaviour they follow the mesh's transformations. I am trying to use the same texture coordinates behaviour but without being affected by the ...
0
votes
2answers
27 views

How to use texelFetch

I'm trying to switch from using the GLSL texture() function in my shader to using texelFetch() because I want very little processing of the texture pixels (no smoothing), and I want to use pixel ...
-5
votes
1answer
47 views

Why isn't this glsl program working? [closed]

Why isn't this glsl program working ? #shader vertex #version 430 layout (location = 0) in vec4 position; layout (location = 1) in vec3 normal; layout (location = 2) in vec2 texture_coordinate; ...
0
votes
1answer
25 views

Formula for range based attenuation

I am trying to implement a simple shader for point lights, but I am struggling with the attenuation function. I know that normally you would use three coefficients (constant, linear, and quadratic), ...
0
votes
0answers
10 views

Reading from SSBO causes black screen and lag

I tried porting my OpenCL raycaster to GLSL compute shaders. Only I'm having trouble with shader storage buffers. How I initiaize the buffer (constructor of class BufferGL): GLBuffer::GLBuffer(GLint ...
0
votes
1answer
67 views

Eye Parallax Refraction Shader

I am trying to implement the Parallax Refraction effect explained by Jorge Jimenez on this presentation: http://www.iryoku.com/downloads/Next-Generation-Character-Rendering-v6.pptx and I am facing ...
0
votes
1answer
34 views

Fine tuning light shader mechanics

I'm currently trying to implement the lighting technique described in this article. I've done pretty much exactly what is done in the article. My technique is the same, and my shader is the same. ...
1
vote
1answer
192 views

Implementing Valve's checkerboard rendering technique

I've been trying to implement Valve's VR checkerboard rendering technique (original document) and was wondering which way would be the best to proceed. The thing is that I need to "abort" the ...
3
votes
3answers
95 views

Can I make color data not render as gradient?

I would like for the color between my vertices to not be rendered as a gradient, but as a hard break. Is there any way to accomplish this in OpenGL/GLSL?
4
votes
1answer
115 views

Why do we multiply perspective * modelview * point?

A common line in vertex shaders is: gl_Position = projection_matrix * model_view_matrix * object_space_vertex; I've seen this a lot, why isn't it written like gl_Position = object_space_vertex * ...
4
votes
1answer
112 views

Directional light type

I am currently trying to implement a specific directional light type. This light type has been used in the game INSIDE and is called orthogonal spotlight (aka local directional light). I assume that ...
6
votes
1answer
181 views

What are screen space derivatives and when would I use them?

I see the ddx and ddy glsl functions and the hlsl equivalents come up in shader code every now and then. I'm currently using them to do bump mapping without a tangent or bitangent but I basically copy-...
0
votes
0answers
37 views

Opengl - Spotlight shadow clipping problem

I implemented a light system + shadow mapping. Everything works fine with point light / directionnal light, but when i come to do spotlight shadow mapping, its a little messy. Im pretty sure this is ...
0
votes
1answer
40 views

game maker - how to change color palette using shader and texture

how to change the color of the application surface, using the texture?? https://en.wikipedia.org/wiki/List_of_8-bit_computer_hardware_palettes https://en.wikipedia.org/wiki/List_of_8-...
1
vote
1answer
39 views

Using normal maps to output world-space normals

Im using deffered shading and here is my g-pass Vertex shader code: vec3 T = normalize(vec3(transform * vec4(tangent, 0.0))); vec3 N = normalize(vec3(transform * vec4(normal, 0.0))); vec3 B = cross(T,...
1
vote
0answers
30 views

Game Maker - Shader CGA - how to swap the palette

I created a shader that get the actual color of the surface and render it to the closer of a cga palette I have to change it to swap the palette in 4 colors but I don't know how secondary, I have to ...
0
votes
2answers
58 views

LIBGDX: Changing colors of a Sprite on the fly

I have found a great tutorial series on creating a simple 2D side scroller, Super Mario Brothers, in this case, and I believe I can adapt it fairly well to create a Megaman clone(something I am quite ...
1
vote
1answer
105 views

How to create realistic rainfall animation in modern OpenGL using shaders?

I see many examples of particle system in old style OpenGL with falling raindrops. Examples of rainfall that can interact with environment lighting and look realistic are hard to find. How to create ...
0
votes
1answer
60 views

Opengl - Glsl for loop array iteration bug

I am facing a really weird bug. On an old copy of my engine, i was doing a loop to render all the lights in my scene: for(int i = 0; i < numLights; i++){ finalColor += ApplyLight(lights[...
1
vote
1answer
54 views

Problem with RGBA sampled shadowmap

I'm having a problem with the generation of a shadowmap that is converted to RGBA. The following glsl code is used to put the depth into the depthbuffer : /** * float/rgba8 encoding/decoding so that ...
0
votes
0answers
45 views

GLSL - Signed Distance Field vs normal Loop

I am fairly new in GLSL and only recently discover Signed Distance Field. I am trying to figure out how SDF can perform so well when you use mod() function to repeat but badly when you use for loop ...
0
votes
0answers
21 views

GLSL dFdx() and dFdy() with Multiple UV Coordinates Clarification

I have a quick question about these two functions. My understanding is that these functions return the rate of change in the X or Y direction across the screen for a given value. Fragments are ...
0
votes
1answer
49 views

Opengl - Shadow mapping issue

I am currently trying to do a shadow map. Here is the depth map when drawn on a quad (Which looks good to me): And here is the final result when i try to cast the shadow in my fragment shader: As ...
0
votes
0answers
71 views

Opengl 4.3 - GLSL Bump mapping problem (Normal mapping)

I'm pretty new to advanced GLSL / OpenGL. I was able to make a small engine, load an object, render it, etc. I recently added the Phong-Reflection model for lighting (and it's working well). I ...
5
votes
2answers
280 views

My point light shader shows a strange behaviour

I follow the well known tutorial about lighting and model importing using Learn opengl, i copy paste the code from the site. The author claims that the shader works but when i compile the source code, ...
1
vote
1answer
31 views

Point Sprite Size and Coloring OpenGL ES 2.0

I am trying to render point sprites with with variable color, but they are all black. Before I added gl_PointSize = 5.0 they had color. The environment is Android with C++, I believe OpenGL ES 2.0. ...
1
vote
1answer
54 views

Calculating the weights of matrices/bones in opengl/glsl

I have a basic shape that I want to render. Nothing too complex, just a tall cube. And I want to attach 2 bones to it. Not only that, but I also want one of the bones/matrices to influence the cube ...
0
votes
1answer
59 views

Shader to render objects with distance independent size

I am trying to find a way to render certain objects in my 3d scene without the effects of the perspective projection. E.g. I want them to have the same pixel dimension independent of distance to the ...
5
votes
1answer
217 views

Is there any less expensive way to achieve this lighting effect?

I'm creating a game that is similar to Tibia on its projection: But I want it, under the hoods, to be 3D, and extremely dynamic - meshes generated on the fly, statues exploding and turning into smoke ...
7
votes
3answers
1k views

How to imrpove this shader's performance?

I have a scene with 150000 instances. I use glsl and opengl 4.0. Shader A is 2 times slower than shader B. I.e. with shader A I get 20fps, with shader B I get 40fps on average. What can I do to ...
0
votes
2answers
52 views

Simplst possible TBN-Matrix giving weird results

I'm implementing normal mapping and was trying different techniques of doing that. All seemed not to give me a correct result (e.g. the normals point in weird directions). To find the problem, I broke ...
0
votes
0answers
59 views

GLSL Shader - How to avoid zoom out render artifacts?

I have a pow of two 2Dtexture with some periodic data. When I render it with >= 100% zoom all is fine. but if i zoom out, artifacts appear. I'm using min mag nearest filtration mode. fragment shader ...
1
vote
1answer
29 views

LWJGL int vertex attribute not working in shader

I'm trying to send an integer attribute to my GLSL shader. The shader receives the attribute as follows: layout (location = 3) in int integer_value; I'm creating the attribute as follows: ...
0
votes
1answer
49 views

LibGdx, I moved ShapeRenderer projection matrix, but shadered waves did not move

I am use Libgdx with ShapeRenderer to draw rect and shaders passed to ShapeRenderer, to draw a waves. In game I made pseudo-parallax effect by changing projection matrix in SpriteBatches. But in ...
0
votes
1answer
74 views

OpenGL deferred rendering, multiple FBO targets

so for a game I am developing I am giving a go at deferred shading. I have only implemented entity rendering and an initial deferred shader and rendering the scene using OpenGLs FBO multiple render ...
0
votes
0answers
19 views

Control cubemap reflection amount from metallic and smoothness properties

I have a custom surface shader, and I want to use the reflections from the reflection/environment probe. In the default standard shader (for unity), the reflection amount is controlled by the "...
1
vote
0answers
46 views

Shadow Mapping, why does my shadow change size and position when I rotate my light?

I have looked far and wide for this and have not found any issue like this, so far. Basically, when my light is at a certain angle my shadows seem to be correctly positioned and scaled, yet if I ...
0
votes
2answers
75 views

GLSL: Issue replacing ternary operator with mix

I was expecting these two code snippets to do the same thing: return vec3( 1.0-b.r>=a.r ? 0.0 : 1.0-((1.0-b.r)/a.r), 1.0-b.g>=a.g ? 0.0 : 1.0-((1.0-b.g)/a.g), 1....
1
vote
2answers
50 views

Best way to test if some point on a line if in front of another point on the same line in 3D

I have a line in 3D defined by point P0 and direction vector D. For given input point P on a line defined as above, I want to test if P is in front of point P0. The code will be used in GLSL fragment ...
1
vote
1answer
97 views

Cycling UV-coordinates with instanced drawing c++/opengl/glsl

I'm trying to animate 2d sprites using glDrawArraysInstanced(), and I'm having trouble separating for each "cycle" ran through the pipeline. according to one of the tutorials I'm reading, it says: "...
1
vote
0answers
91 views

How to pass array of dozens of floats to OpenGL 3.0 vertex shader?

I use PyOpengl and Python 3. I have 50 thousand vertices. Position of each vertex could be calculated in vertex shader as #version 300 es uniform v_coefficients_weights[COEFFICIENTS_AMOUNT]; in ...
0
votes
1answer
43 views

Libgdx OpenGL ES pixel shader behaves differently on android and on desktop

I'm currently working on a mobile game that ressembles a snake game ; what I wished to do was use my limited glsl knowledge to write a pixel shader that could efficiently draw a curve with a certain ...
2
votes
0answers
36 views

Simple square vertex lifting shader

I am trying to rebuild the fur effect in Viva Pinata. Here each square becomes a pattern of fur I imagine the process to be like this... U lift one end of the triangles. Now I need to achieve "...