A programming language for OpenGL shaders.

learn more… | top users | synonyms

35
votes
1answer
4k views

How can I reduce aliasing in my outline glow effect?

I'm trying to replicate the glowing outline effect in the Left 4 Dead game. The effect causes an objects outline to glow, even when the object is occluded. Here is a screenshot of the effect: I'm ...
9
votes
1answer
2k views

GLSL, all in one or many shader programs?

I am doing some 3D demos using OpenGL and I noticed that GLSL is somewhat "limited" (or is it just me?). Anyway I have many different types of materials. Some materials have ambient and diffuse color, ...
2
votes
2answers
339 views

GLM Velocity Vectors - Basic Maths to Simulate Steering

UPDATE - Code updated below but still need help adjusting my math. I have a cube rendered on the screen which represents a car (or similar). Using Projection/Model matrices and Glm I am able to ...
5
votes
1answer
2k views

Morph a sphere to a cube and a cube to a sphere with GLSL

I'm getting started with GLSL with quartz composer. I have a patch with a particle system in which each particle is mapped into a sphere with a blend value. With blend=0 particles are in random ...
11
votes
2answers
7k views

How can I create an efficient bloom shader with GLSL?

I have searched the net for resources related to rendering a bloom effect using GLSL, but haven't found anything. Although the tutorial at Philip Rideout's website is a good one, it performs very ...
4
votes
2answers
1k views

interpolating frames in a vertex shader

My models are stored as a set of meshes, each with a vertex list and normal list per key-frame, and indices for GL_TRIANGLES which is shared for all frames. Each frame I lerp between two adjacent ...
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 ...
23
votes
4answers
17k views

Using multiple shaders

I'm currently studying opengl shaders but I can't figure out something: how to apply different shaders to the objects, for example, a teapot rendered using toon shader and another one in the same ...
3
votes
1answer
2k views

Skyboxes using glsl Version 330

So I am trying to get a skybox working with OpenGL 3.3 and glsl Version 330. After scouring the web for a while, I could not find a completely modern OGL skybox tutorial anywhere, so I found an older ...
8
votes
2answers
3k views

GLSL Shader Editors for Linux

Are there any good IDE's for linux that lets us edit GLSL shaders and visualize their effect? Note : Shader Designer By Typhoon Labs is a good option but I am looking for alternatives as this ...
7
votes
4answers
1k views

glsl demo suggestions?

In a lot of places I interviewed recently, I have been asked many a times if I have worked with shaders. Even though, I have read and understand the pipeline, the answer to that question has been no. ...
10
votes
2answers
4k views

OpenGL: VBO or glBegin() + glEnd()?

I recently was given this link to a tutorial site from someone who I gave the original OGL Redbook to. The third header down says distinctly to forget glBegin() & glEnd() as the typical render ...
3
votes
1answer
3k views

GLSL if-else statement unexpected behaviour

This question is related to this other one I asked a few days ago. Because I have finally get to the bottom of the issue, I have rather preferred to open a new question with a more detailed ...
6
votes
1answer
2k views

How to invert background pixel's color

I'm writing a game and map editor using Java and jMonkeyEngine. In the map editor, I've got a brush done by wireframed sphere. My problem is: I want to make it visible everywhere, so I want to invert ...
6
votes
1answer
4k views

GLSL - Rewriting shaders from #330 to #130

I recently created a game (LD21) that uses a geometry shader to convert points into textured triangles/culling. Since I was under the impression that the support for #330 was widespread I only wrote ...
5
votes
1answer
2k views

GLSL pack floats into an RGBA texture

I want to compose conventional triangle-based models and particles with a ray-traced scene at a reasonable frame-rate. webGL does not let you write the gl_FragDepth in the fragment shader. You ...
4
votes
1answer
376 views

OpenGL FBO not being drawn to

In my project I'm trying to implement a deferred rendering system, problem is, I can't seem to get a second FBO to work. UPDATE 1 Here is the FBO initialization code: /// G-Buffer FBO GLuint ...
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 ...
4
votes
1answer
2k views

Access vertex data stored in VBO in the shader

If I wanted to store extra data in a VBO for skinning (indices for indexing into an array of matrices of bones and floats for applying weights to those bones) How would I go about accessing that data ...
2
votes
1answer
282 views

Alpha Blending: use the pixel with the smallest alpha

I'm writing a transparency shader where I need any intersecting textures to, wherever they overlap, take the texture pixel with the smallest alpha value and render only that, discarding the other ...
2
votes
1answer
2k views

How to detect GLSL warnings?

After compiling a shader with glCompileShader, I can call glGetShaderiv with GL_COMPILE_STATUS to check if the shader compiled successfully. I can also call glGetShaderInfoLog to get information about ...
2
votes
1answer
1k views

Pygame water ripple effect

I have Googled for it but there are no ready scripts - as opposed to the same effect on Flash. I have checked the algorithm on The Water Effect Explained and also tested an implementation of the ...
5
votes
1answer
418 views

Cheap ways to do scaling ops in shader?

I've got an extensive world terrain that uses vec3 for the vertex position attribute. That's good, because the terrain has endless gradations due to the use of floating point. But I'm thinking about ...
3
votes
2answers
912 views

scaling point sprites with distance

How can you scale a point sprite by its distance from the camera? GLSL fragment shader: gl_PointSize = size / gl_Position.w; seems along the right tracks; for any given scene all sprites seem nicely ...
2
votes
2answers
602 views

Is this a reliable method of parsing glGetShaderInfoLog()?

I want to get a list of errors and their line numbers so I can display the error information differently from how it's formatted in the error string and also to show the line in the output. It looks ...
2
votes
3answers
1k views

Passing POD arrays to shader?

How do I pass to my vertex shader an array of N elements? From what I see I can only pass float arrays of 3|4 elements, vectors 2|3d and matrices, but I want to pass a POD array and use it like this: ...
2
votes
2answers
1k views

Multiplatform GLSL shader validator?

Im working on a multiplatform (Pc,Mac,Linux) game that uses shaders quite extensively. Since we do not have any funding, it is pretty hard to test our game on all possible hardware configurations. ...
1
vote
2answers
293 views

Ward model implementation: specular component too weak

I'm trying to implement the Ward shading model, the anisotropic, computationally efficient version: This is how I made it: float alphaX=0.5, alphaY=0.5; // asinotropic roughness float ...
1
vote
1answer
1k views

Volumetric Fog Shader - Camera Issue

I am trying to build an infinite fog shader. This fog is applied on a 3D plane. For the moment I have a Z-Depth Fog. And I encounter some issues. As you can see in the screenshot, there are two views. ...
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 ...
0
votes
1answer
57 views

GLSL to Cg fragment shader

I have found very useful resource on the Swiftless website on OpenGL. Unfortunately, I cannot manage to adapt a GLSL fragment shader to my project, which uses Cg. Here it is: uniform sampler2D ...
0
votes
1answer
94 views

How does OpenGL determine different outputs with shaders?

Lets say I have this GLSL code: #version 330 out vec4 outputColor; void main() { float lerpValue = gl_FragCoord.y / 500.0f; outputColor = mix(vec4(1.0f, 1.0f, 1.0f, 1.0f), ...
0
votes
1answer
436 views

OpenGLES GLSL Shader attributes always bound to 0

So I have a very simple vertex shader as follows #version 120 attribute vec3 position; attribute vec3 inColor; uniform mat4 mvp; varying vec3 fragColor; void main(void){ fragColor = inColor; ...
-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 ...