GLSL is a programming language for OpenGL shaders.
35
votes
1answer
2k 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 ...
31
votes
6answers
9k views
30
votes
2answers
2k views
How to render realistic ice?
I am trying to write an ice shader in Unity that looks good and at least semi-realistic.
If the following shot (found on Google) was CG, what would its shader include? (the foreground cave). I might ...
18
votes
4answers
4k views
Why is programmable pipeline( GLSL ) faster than fixed pipeline?
So I'm teaching myself GLSL and am trying to figure out why it's suppose to be faster than the fixed function pipeline.
The reason I am having a problem is that from my understanding , the shaders ...
16
votes
4answers
8k 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 ...
14
votes
1answer
4k views
Is there a successor to RenderMonkey?
I'm starting with GLSL shader programming and have been looking into RenderMonkey. Sadly, AMD no longer supports it. Why? Is there a successor to it?
12
votes
1answer
730 views
Should I distribute shaders in a compiled form or in plain text?
Having an application that uses shaders that have been wrote in GLSL, what is the best strategy for the distribution in the real world and for the desktop and mobile?
I'm aiming to distribute this in ...
12
votes
1answer
470 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 ...
11
votes
1answer
541 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 ...
10
votes
3answers
1k views
Go pure OpenGL or GLSL?
I got interested in studying graphic programming so the obvious entry point was to learn OpenGL. But gathering scattered information around forums and sites, it seems that a pure OpenGL implementation ...
10
votes
1answer
618 views
How do I create good looking plasma explosion effects?
Is this just a billboard quad with a bloom shader?
10
votes
1answer
418 views
Special relativity shader in GLSL
I'm trying to implement a GLSL shader which helps understanding special relativity Lorentz Transformation.
Let's take two axis-aligned inertial observer O and O' . The observer O' is in motion w.r.t ...
9
votes
6answers
7k views
OpenGL ES 2.0: Repository of Quality Shaders
Could I kindly ask, to suggest me a repository of high quality OpenGL (OpenGL ES 2.0) vertex and fragment shaders, please?
I am looking for pixel based ligting shaders (such as phong) and simmilar. ...
9
votes
1answer
5k 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 ...
8
votes
2answers
2k 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 ...
8
votes
2answers
331 views
Sharing functions across multiple shaders
Simple question:
In GLSL, is there a way to share functions across multiple shaders, or do I have to define all functions in every shader that needs them?
8
votes
4answers
2k views
Debugging Shader Code?
I'm writing a game engine, and when I use a perspective camera I get a black screen. I am not going to ask exactly why this is because there would be a lot of code to share and, frankly, I think ...
7
votes
3answers
803 views
Deferred shading - how to combine multiple lights?
I'm starting out with GLSL and I've implemented simple deferred shading that outputs G-buffer with positions, normals and albedo.
I've also written a simple point light shader.
Now I draw a sphere ...
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. ...
7
votes
1answer
2k views
in/out keywords in GLSL
I don't really understand how to use the in / out keywords in GLSL, and google is being uncharacteristically unhelpful.
What exactly do they do? How would I use them if, for example, I want to pass a ...
7
votes
2answers
2k 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
427 views
What types of effects or shaders would you teach in a rendering class? [closed]
I am looking for a list of topics that would be fun to learn and not too complicated to implement with a prototyping tool like FX Composer or Rendermonkey for an intermediate class of real-time ...
7
votes
1answer
242 views
Overview/showcase of shader techniques/uses for games
I am looking for resources that can provide me with a better understanding of what kind of things shaders are used for in games, what they can do, and maybe even more importantly, what they cannot. I ...
7
votes
1answer
4k views
OpenGL/GLSL: Render to cube map?
I'm trying to figure out how to render my scene to a cube map. I've been stuck on this for a bit and figured I would ask you guys for some help. I'm new to OpenGL and this is the first time I'm using ...
6
votes
1answer
6k views
GLSL - one-pass gaussian blur
It is possible to implement fragment shader to do one-pass gaussian blur?
I have found lot of implementation of two-pass blur (gaussian and box blur):
...
6
votes
3answers
381 views
shadowing billboards
I have a lot of billboarded 3D spheres (they have a heightmap so work properly with depth and penetration; although each is made of just a quad (with slight distortion), they look and feel and are ...
6
votes
1answer
171 views
GLSL vertex shaders with movements vs vertex off the screen
If i have a vertex shader that manage some movements and variations about the position of some vertex in my OpenGL context, OpenGL is smart enough to just run this shader on only the vertex visible on ...
6
votes
2answers
2k views
First time shadow mapping problems
I have implemented basic shadow mapping for the first time in OpenGL using shaders and I'm facing some problems. Below you can see an example of my rendered scene:
The process of the shadow mapping ...
6
votes
4answers
841 views
Spell Effects/Shaders
I want to be able to achieve spell effects that cause a fragmenting/discoloring effect on the sprite. The first couple seconds of this video http://www.youtube.com/watch?v=HNCFh7mkvuc shows what I ...
6
votes
1answer
423 views
Fast and simple attenuation from a flaming torch
I have a single point light-source which is a flaming torch. I compute the distance from the light accurately.
I am not trying to have a particularly realistic torch effect, but I will be moving the ...
6
votes
1answer
2k 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 ...
6
votes
2answers
1k views
Billboard shader without distortion
I use the standard approach to billboarding within Unity that is OK, but not ideal: transform.LookAt(camera).
The problem is that this introduces distortion toward the edges of the viewport, ...
6
votes
1answer
947 views
Not getting desired results with SSAO implementation
After having implemented deferred rendering, I tried my luck with a SSAO implementation using this Tutorial. Unfortunately, I'm not getting anything that looks like SSAO, you can see my result below.
...
6
votes
1answer
8k views
GLSL: How Do I cast a float into an int?
In a GLSL fragment shader I am trying to cast a float into an int. The compiler has other ideas. It complains thusly:
ERROR: 0:60: '=' : cannot convert from 'mediump float' to 'highp int'
I am ...
6
votes
4answers
446 views
Impact of variable-length loops on GPU shaders
Its popular to render procedural content inside the GPU e.g. in the demoscene (drawing a single quad to fill the screen and letting the GPU compute the pixels).
Ray marching is popular:
This means ...
6
votes
2answers
775 views
Casting a shadow over a whole scene with GLSL in 2D?
I'm making a (non-isometric) side scrolling 2D game and I want each fragment that I draw to cast a small drop shadow when it is near another object. What sort of algorithms are used in fragment ...
5
votes
1answer
3k views
What do the components of gl_TexCoord[0] mean?
What are the differences between gl_TexCoord[0].s, gl_TexCoord[0].t gl_TexCoord[0].p and gl_TexCoord[0].x, gl_TexCoord[0].y gl_TexCoord[0].z ?
I understand that gl_TexCoord[0].x, gl_TexCoord[0].y ...
5
votes
1answer
363 views
GLSL subroutine not being used
I'm using a gaussian blur fragment shader. In it, I thought it would be concise to include 2 subroutines: one for selecting the horizontal texture coordinate offsets, and another for the vertical ...
5
votes
2answers
305 views
Geometry shader for multiple primitives
How can I create a geometry shader that can handle multiple primitives? For example when creating a geometry shader for triangles, I define a layout like so:
layout(triangles) in;
...
5
votes
3answers
2k views
how to add water effect to an image
This is what I am trying to achieve: A given image would occupy say 3/4th height of the screen. The remaining 1/4th area would be a reflection of it with some waves (water effect) on it.
I'm not sure ...
5
votes
1answer
366 views
How to do simple bump mapping
I'm trying to do bump mapping, and I'm getting fairly close at achieving my goal. I miss one crucial piece of my puzzle to have bump mapped effect in my scene; I need to transform the normals from my ...
5
votes
1answer
717 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, ...
5
votes
1answer
112 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 ...
5
votes
2answers
713 views
Sorting objects before rendering
I'm trying to implement a scene graph and in all the articles i've come across there is talk about object sorting. So you'd sort your objects by "material" for example. Now untill i sat down and ...
5
votes
2answers
2k views
Using a GLSL fragment shader to draw a texture in the middle of a quad
I'm not sure how possible this is, but I'm trying to use a fragment shader to draw a portion of a texture in the middle of a quad. This is all 2D. The quads consist of four vertices from (0, 0) to ...
5
votes
2answers
712 views
How'd they do it: sphere effects in Osmos
I'm curious how the sphere effects were done in Osmos from Hemisphere Games. Any ideas how the resolution independent zoom in was achieved?
Edit, more specifics on questions:
How do you render the ...
5
votes
2answers
983 views
OpenGL equivalent of .fx files in GLSL or Cg?
There's a lot of learning material in the DirectX world that uses .fx files to manage shaders, and .fx seems to be well integrated with 3D packages such as Maya and 3D Studio Max
What do larger ...
5
votes
1answer
341 views
Raymarching artifacts
I was playing with raymarching using distance fields in GLSL sandbox and got stuck with a strange problem with artifacts.
Click here and take a look at the spheres generated in corners, they have ...
5
votes
1answer
263 views
How can I test shaders for nVidia on an ATi system?
I and our other devs have ATi graphics cards. However we have encountered that some shaders that compile without warnings on ATi don't compile at all on nVidia. The problems are trivial to fix, but ...
4
votes
2answers
609 views
Optimising the modelview transformation in GLSL for 2D
So, the standard way to transform vertices and then pass to the fragment shader in GLSL is something like this:
uniform mat4 u_modelview;
attribute vec4 a_position;
void main() {
gl_Position = ...
