A programming language for OpenGL shaders.

learn more… | top users | synonyms

38
votes
6answers
17k views

What are the pros and cons of HLSL vs GLSL vs cg? [closed]

What are the pros / cons of the three?
38
votes
2answers
4k 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 ...
37
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 ...
24
votes
4answers
20k 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 ...
22
votes
4answers
6k 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 ...
17
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 ...
16
votes
2answers
7k views

Is there a successor to RenderMonkey? [closed]

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?
14
votes
1answer
3k views

How do Raymarch shaders work?

I have been looking at shaders found here shadertoy.com and most of the cool ones have noise and raymarch in common. I do not understand the source code at all but I really want to. How do these ...
14
votes
1answer
9k 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 ...
13
votes
1answer
2k 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 ...
13
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 ...
11
votes
6answers
12k 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. ...
11
votes
2answers
8k 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 ...
10
votes
2answers
5k 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 ...
10
votes
3answers
2k views

Go pure OpenGL or GLSL? [closed]

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
903 views

How do I create good looking plasma explosion effects?

Is this just a billboard quad with a bloom shader?
10
votes
2answers
1k views

Refractive glass shader

I have an infinite hexagonal floor, generated by tessellating a point grid in a tessellation shader pair: Note that this is a flat wireframe - the "shadows" are a lighting trick: Now, I'd like ...
10
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, ...
10
votes
1answer
541 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
3answers
1k 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 ...
9
votes
3answers
867 views

How can I create a glitter effect?

I am trying to create a glittering effect for my realtime shader but I don't know how. Here is one example, and another example. What technique can I use to implement this?
9
votes
1answer
8k 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 ...
9
votes
2answers
2k 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 ...
9
votes
4answers
5k 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 ...
9
votes
2answers
1k views

Deferred tiled shading, tile frusta calculation in OpenGL

I'm trying to do deferred tiled shading in OpenGL using the compute shader but I have hit a snag when trying to create the frustum for each tile. I'm using AMD's Forward+ demo (written in D3D) as a ...
8
votes
2answers
542 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
3answers
4k 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 ...
8
votes
1answer
6k 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 ...
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 ...
8
votes
4answers
491 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 ...
8
votes
1answer
22k 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 ...
8
votes
1answer
301 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 ...
8
votes
1answer
235 views

How can I reliably implement GPU skinning in Android?

I'm trying to get character skinning working on Android. The idea is quite vanilla: I have my skinning matrices, and along with each vertex, I send up to four matrix indices and four corresponding ...
7
votes
2answers
267 views

Diffuse Reflection confusion

From what I've read, with a simple directional light, the color of a point, if you only take diffuse reflection into account (intensity = 1), should be color = color_of_point * color_of_light * ...
7
votes
2answers
12k 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): ...
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
2answers
6k views

GLSL Shader - Change Hue/Saturation/Brightness

I'm trying to change the hue of an image using a GLSL fragment shader. I want to achieve something similar to Photoshop's Hue/Saturation Adjustment layer. In the following image you can see what I've ...
7
votes
2answers
2k views

Billboard rendering 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, ...
7
votes
1answer
1k 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. ...
7
votes
1answer
1k views

Optimizing performance of a heavy fragment shader

I need help optimizing the following set of shaders: Vertex: precision mediump float; uniform vec2 rubyTextureSize; attribute vec4 vPosition; attribute vec2 a_TexCoordinate; varying vec2 tc; ...
6
votes
3answers
513 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
277 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
4answers
1k 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
779 views

How would one draw many objects using the same VBO

I'm kind of stuck with this question for some time now, maybe because I don't know exactly what to search for, it might be a term I have not heard of yet as most tutorials ends after drawing one ...
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
612 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 ...
6
votes
1answer
580 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
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 ...
6
votes
2answers
3k 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 ...
6
votes
4answers
1k 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 ...