A programming language for OpenGL shaders.

learn more… | top users | synonyms

2
votes
2answers
1k views

GLSL Motion blur on mobile.. possible at acceptable framerates?

I have been struggling to implement a simple linear motion blur effect on mobile (Android, OpenGLES 2.0) but it just seems to destroy my framerate. I'm rendering to texture (FBO) then applying a ...
2
votes
1answer
433 views

How to solve artifacts caused by vertex lighting in my voxel engine?

My current lighting system bakes the light amount based on ray-tracing from the light source to the 8 corners of the block (so per-vertex) and the distance to the light on the blocks. It works ...
0
votes
1answer
265 views

How to get a smooth dimming with SSAO?

I implemented SSAO in my game based on the tutorial at gamerendering.com. But the results I get are disappointing. Instead of a smooth effect as seen in the nvidia demos, my implementation causes ...
0
votes
2answers
244 views

LWJGL Game crashes on some other machines [closed]

I just tried running my game on a friend's laptop, but for some reason it crashes. The exported .jar runs fine on my machine, and some others too. I can see that is has something to do with the ...
4
votes
3answers
719 views

Voxel engine artifacts

There are white little dots between blocks at random places, mainly at very near blocks. They disappear when I move the mouse and change the view direction. I use Vertex Arrays with ...
1
vote
1answer
182 views

OpenGL VBO Additional Attributes

If I have a buffer with my vertices, normals and texture coordinates, and I use glDrawArrays to draw the VBO to the screen, how can I send attributes per vertex that I placed in an array to the shader ...
4
votes
2answers
681 views

Do opengl games tend to use multiple shaders? [duplicate]

For any given object that you want to render, there may be a whole bunch of things that need to be considered for rendering (Material, Texture, Lighting, Blending etc). But, you may also have some ...
2
votes
1answer
1k views

glsl 150 struct in uniform buffer object

Can I do this in opengl 3.2 / glsl 150? glsl shader: struct LightSource { vec4 ambient; vec4 diffuse; vec4 specular; vec4 position; vec4 direction; }; ... layout(std140) uniform ...
2
votes
1answer
249 views

How to transform a shadow map to camera view?

I'm making a rendering engine as a hobby to learn more about 3D. I have a deferred renderer with the G-buffer (color, normal and depth). I also have a lighting controller that uses only spotlights at ...
-5
votes
3answers
345 views

in the shadow of a sphere [duplicate]

(Related, but somewhat different, to my previous question) How can I determine in a fragment shader if a fragment is in the shadow of a sphere? That is, if it is occluded by the sphere and is past ...
5
votes
1answer
915 views

What is the recommended way to output values to FBO targets? (OpenGL 3.3 + GLSL 330)

I'll begin by apologizing for any dumb assumptions you might find in the code below since I'm still pretty much green when it comes to OpenGL programming. I'm currently trying to implement deferred ...
0
votes
1answer
2k views

Simple pass-through geometry shader with normal and color

I've written a very simple pass-through geometry shader. My input and output primitives are points. I also want to forward the color and normal from vertex shader to fragment shader through geometry ...
1
vote
1answer
281 views

Using two FBOs results in the second FBO having nothing drawn to [closed]

I'm writing a deferred renderer, and I use two FBOs: the first one for G-buffer (color, normal, depth) and the second one for lighting (light output), so the first one has three textures bound and the ...
4
votes
2answers
672 views

Jagged transparency when rendering translucent textures (OpenGL 3.2 + GLSL)

Like most others, I'll start off mentioning that I'm still a beginner when it comes to OpenGL and GLSL programming. So bear with me on any dumb mistakes you may spot in the code ahead. I'm basically ...
-1
votes
1answer
443 views

GLSL code is very slow…why? [closed]

I know this is a very difficult thing to simply modify without the full project code, but I am having a massive performance problem with GLSL code that seems to be very efficient to me. I am stuck at ...
1
vote
1answer
262 views

My game works on the emulator and the PSVita, but crashes on Android

I made a game on PSM, ported from a previous iOS/Android game. I test it on the emulator and PSVita and runs fine. However, as I test it on a PlayStation Certified Android device, it crashes on load. ...
3
votes
1answer
895 views

Cook Torrance model implementation : black specular light

I am trying to implement the Cook-Torrance model, and this is how I calculate the parameter Rs: float Rs(float m,float F,vec3 N, vec3 L,vec3 V, vec3 H) { float result; float NdotV= ...
1
vote
1answer
529 views

How to rotate a direction

I'm working a spotlight for my deferred renderer and I'm having trouble with matching the mesh to the visual representation of the light. Right now my mesh is a cone, the apex of the cone is at ...
2
votes
1answer
140 views

Fragments never falling into spot light's cone

I am using GLSL version 1.20 with OpenGL 2.1 . I am trying to compute when a fragment falls into the area of a spot light. I have already set all the light values with glLightfv and glLightf, also ...
2
votes
1answer
543 views

Gaussian blur filter and “shimmering”

I have a fairly bog-standard Gaussian blur filter (seperable) I'm using to make a glow effect in my pipeline. At the moment I'm rendering it only to 256x256 texture and then doing a very simple ...
0
votes
3answers
345 views

Phong lighting model unrealistic result

I am using OpenGL 2.1 and GLSL 1.20 . I am trying to compute the fragment color applying the Phong lighting model. This is the formula I have (the original formula has a summation, but since the ...
1
vote
1answer
322 views

What book/guide should I follow for GLSL [closed]

I searched a lot on the web without coming to a real solution and if I ask this it's because I really have difficulties getting an answer. I need to learn well GLSL 1.20 with OpenGL 2.1. I have ...
0
votes
1answer
358 views

vec4 for vec3 multiplication while calculating the specular value

I'm following this tutorial to calculate the specular color of a vertex. I use OpenGL 2.1 with GLSL version 120. This is the formula that I apply: spec= (R*eye)^s * Ls * Lm With: ...
0
votes
1answer
142 views

deferred rendering and a few shading functions

How to use a few shading functions together with deferred rendering (for example some objects are shaded based on a lighting equation, other get a fixed color) ? I draw a full screen quad when ...
16
votes
1answer
2k views

Why does this geometry shader slow down my program so much?

I have an OpenGL program, and I'm rendering a terrain mesh. I displace the vertices in the vertex buffer and don't really color them in the fragment shader yet. I'm adding a geometry shader one part ...
2
votes
0answers
843 views

2D water shader in SFML

I want to implement the algorithm for a 2D water surface described here and here. Before somebody finds out, beats me up and deletes this, I'm gonna say it myself. I posted this question over at ...
2
votes
0answers
459 views

Shader Maker version 130 is not supported [closed]

I am trying to compile a vertex shader with Shader Maker and if I try to use the version 130 it says: Compiling Vertex Shader ERROR: 0:3: '' : version '130' is not supported Compiling ...
0
votes
1answer
172 views

OpenGL RTT FrameBuffer question and Rendering to texture while sampling it

What i need to do: Blur the selected texture and pass the texture to another effect for postprocessing. Notice that i want one texture passed all over. How do i want to do this: Bind the FBO ( ...
2
votes
1answer
246 views

Would I perform one pass per effect in Deferred Shading?

I'm implementing deferred shading the first time. Doing so I came up with a conceptual question. First I render the geometry in a framebuffer with muptiple rendering targets for depth, normals, and ...
4
votes
1answer
1k views

OpenGL GLSL skinning problem

This time I've decided to ask a question related to my skinning problem. Two earlier ones were not really related to my problem and I've deleted them. Ok, first of all, I'm using OpenGL 3, 3ds max, ...
2
votes
1answer
276 views

mat3x4 in webGL shaders

I am porting the IQM bone animation format to Javascript and have run into a problem... The vertex shader is failing to compile and the only error message I get out is 'mat3x4' : syntax error on the ...
3
votes
1answer
188 views

Texture prefetching in GLSL

I have a fragment shader which needs lots of semi-random access to 32x32 texture patch. Fortunately, the patch is constant for each poly, so there should be no issue storing the whole thing to the ...
1
vote
1answer
364 views

How to have qt5 work on desktop like on mobile devices (es2, correct glsl version)?

I am looking for help/information concerning this issue : My work: I have an opengl es2 render engine that works on an iOS app. I almost managed to make it work by calling the same openGL rendering ...
0
votes
2answers
470 views

GLSL light coloring blocked surfaces

I have created a very simple lighting shader. It currently only supports point lights, but it lights up surfaces that are completely blocked from the light. I know why, but I want to know how I can ...
4
votes
1answer
136 views

Forcing early-z with raytracing

I'm working on a GLSL raytracer, and I need to be able to edit gl_FragDepth in the FS. However, doing so disables early-z culling. The scene is rendered front-to-back and the FS can only push points ...
1
vote
0answers
443 views

shader-based particle systems

I have a classic particle system where each particle is represented by a quad and, each time step, I move each particle. My target is webGL which means I don't have instancing, attribute divisors nor ...
1
vote
1answer
301 views

Multisampled Texture

i have some doubts with multisampled textures. In fragment shader, how to pass multiple samples? We use glTexImage2DMultisample instead of glTeximage2D. so, how to upload texture data? I want to ...
2
votes
1answer
179 views

How does GL_INT_2_10_10_10_REV work for color data?

Can anybody tell me how exactly to use GL_INT_2_10_10_10_REV as type parameter in glVertexAttribPointer()? I am trying to pass color values using this type. What is the significance of "REV" suffix ...
5
votes
1answer
181 views

Blend multiple regions from same texture atlas

I'm representing terrain in my game as a grid with at each node a composition, for example 100% rock, or 50% grass, 50% soil. I'd like to use this composition vector to blend textures together. I'm ...
3
votes
1answer
151 views

Queries regarding Geometry Shaders

I am dealing with geometry shaders using GL_ARB_geometry_shader4 extension. My code goes like : GLfloat vertices[] = { 0.5,0.25,1.0, 0.5,0.75,1.0, -0.5,0.75,1.0, ...
3
votes
1answer
415 views

how to organize rendering

I use a deferred rendering. During g-buffer stage my rendering loop for a sponza model (obj format) looks like this: int i = 0; int sum = 0; map<string, mtlItem *>::const_iterator itrEnd = ...
2
votes
1answer
172 views

Shadow cubemapping?

I am working on a game with C++ and OpenGL 3.2. I have successfully implemented directional shadow maps and now I'd like to upgrade them to shadow cube maps (for point lights). I've done some Googling ...
3
votes
1answer
2k views

How are vertex shader outs sent as inputs to the fragment shader?

I'm learning some OpenGL 3.2 way of doing things and I think it's quite great, I'm actually understanding more of shaders and non-fixed pipeline in 1 week rather than those 2 years I tried to learn ...
1
vote
1answer
535 views

Light following me around the room. Something is wrong with my shader!

I'm trying to do a spot (Blinn) light, with falloff and attenuation. It seems to be working OK except I have a bit of a space problem. That is, whenever I move the camera the light moves to maintain ...
1
vote
1answer
274 views

fragment shader with SNORM textures

I want to apply SNORM texture by using GL_TEXTURE_3D as a target, what will be the fragment shader for the same? Also, what should be the data type of texture data?
2
votes
1answer
666 views

Low-level GPU code and Shader Compilation

Bear with me, because I will raise several questions at once. I still feel, though, that overall this can be treated as one question that may be answered succinctly. I recently dove into solidifying ...
1
vote
2answers
272 views

Deferred rendering order?

There are some effects for which I must do multi-pass rendering. I've got the basics set up (FBO rendering etc.), but I'm trying to get my head around the most suitable setup. Here's what I'm ...
4
votes
0answers
982 views

OpenGL problem with FBO integer texture and color attachment [closed]

In my simple renderer, I have 2 FBOs one that contains diffuse, normals, instance ID and depth in that order and one that I use store the ssao result. The textures I use for the first FBO are RGB8, ...
11
votes
1answer
1k views

Toon/cel shading with variable line width?

I see a few broad approaches out there to doing cel shading: Duplication & enlargement of model with flipped normals (not an option for me) Sobel filter / fragment shader approaches to edge ...
1
vote
1answer
1k views

Problems implementing a screen space shadow ray tracing shader

Here I previously asked for the possibility of ray tracing shadows in screen space in a deferred shader. Several problems were pointed out. One of the most important problem is that only visible ...