a computer program that runs on graphics hardware and provides a high degree of control over how scenes are rendered

learn more… | top users | synonyms (1)

36
votes
6answers
14k views

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

What are the pros / cons of the three?
36
votes
2answers
3k 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 ...
35
votes
1answer
3k 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 ...
21
votes
4answers
15k 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 ...
20
votes
2answers
2k views

After a succesful glLinkProgram, should I delete / detach my shaders?

After I have a linked program, and thinking about defensive programming, should I delete and detach the shaders used to link this program? If yes, is that going to free any resources? Or do these ...
19
votes
3answers
5k views

For voxel rendering, what is more efficient: pre-made VBO or a geometry shader?

Given a fairly static voxel array, what is more efficient: using the CPU to pre-generate a VBO to render the voxel faces (ignoring more advanced forms of rendering like marching cubes for now) or ...
18
votes
2answers
921 views

How would one construct a realistic “infrared vision” effect?

How would you go about constructing a realistic infrared vision effect with shaders? By realistic I mean one that looks realistic, like this example. I have an idea about making a texture to ...
18
votes
12answers
6k views

What are some good resources for learning HLSL?

The last time I tried learning HLSL, I made a few shaders and mostly understood what I was doing, but I still felt like I was stumbling in the dark. Most of what I learned I got from various blog ...
16
votes
2answers
6k 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?
16
votes
3answers
6k views

outline object effect

How can I achieve an outline effect similar to the ones found in League of Legends or Diablo III? Is it done using a shader? How? I would prefer answers that are not tied up to any particular ...
16
votes
1answer
844 views

What is the math behind the light effect in krakatoa?

I'd like to know the math behind the light effect in krakatoa (click here for an example). Light source is traveling with particles, but how is shading done? Is it something simple, like Phong ...
15
votes
2answers
512 views

OpenGL: Where shoud I place shaders?

I'm trying to learn OpenGL ES 2.0 and I'm wondering what is the most common practice to "manage" shaders. I'm asking this question because in the examples I've found (like the one included in the API ...
15
votes
1answer
2k views

The practical cost of swapping effects

I use XNA for my projects and on those forums I sometimes see references to the fact that swapping an effect for a mesh has a relatively high cost, which surprises me as I thought to swap an effect ...
14
votes
7answers
10k views

What are some cool examples of procedural pixel shader effects? [closed]

What are some good examples of procedural or screen-space pixel shader effects? No code is necessary; I'm just looking for inspiration. In particular, I'm looking for effects that are not dependent ...
14
votes
3answers
1k views

Difference between Material and Shader

In a game a material does only influence the visual appearance of the object. The visual appearance is effected by shaders. So regarding to terminology is there a difference between materials and ...
14
votes
1answer
496 views

Rendering oily/polluted water?

Any shader wizards out there have an idea of how to achieve an oily/polluted water effect, similar to this: Ideally, the water would not be uniformly oily, but instead the oil could be generated ...
14
votes
3answers
1k views

What is a fragment?

What is a fragment in a fragment shader? Wikipedia says that: In general, a fragment can be thought of as the data needed to shade the pixel, plus the data needed to test whether the fragment ...
14
votes
6answers
3k views

Modern Shader Book?

I'm interested in learning about Shaders: What are they, when/for what would I use them, and how to use them. (Specifically I'm interested in Water and Bloom effects, but I know close to 0 about ...
13
votes
2answers
15k views

OpenGL ES 2.0: Setting up 2D Projection

This article describes in general, how to draw sharp OpenGL 2D graphics, using fixed function pipeline. http://basic4gl.wikispaces.com/2D+Drawing+in+OpenGL Because OpenGL ES 2.0 has some ES 1.x ...
13
votes
1answer
1k views

Shadow map artifacts

I want to try adding shadows to a 3D XNA game. I've set up some testing environment with one light and one camera. However, I'm running into artifacts with my approach. I'm using the shader code from ...
13
votes
2answers
10k views

GLSL Shader Effects: How to do motion blur, etc?

I am not sure how right it is to ask this question, but still here it goes. I have a full 2D environment, with sprites going around as landscape, characters, etc And to make it more state-of-art ...
13
votes
1answer
468 views

Suitability of ground fog using layered alpha quads?

A layered approach would use a series of massive alpha-textured quads arranged parallel to the ground, intersecting all intervening terrain geometry, to provide the illusion of ground fog quite ...
12
votes
3answers
680 views

Recreating this flat-shaded look

I'll keep it short. How does one achieve the effect depicted in the image below? Is it feasible to do in realtime? It looks deceptively simple, but it probably isn't. Are there any keywords I can ...
12
votes
3answers
15k views

Fastest way to draw quads in OpenGL ES?

I am using OpenGL ES 2.0 I have a bunch a quads to be drawn, would love to be able to have to pass only 4 vertices per quad as if I were using GL_QUADS, but basically I just want to know the best way ...
12
votes
3answers
3k views

Fastest way to render lines with AA, varying thickness in DirectX

So I'm doing some DirectX development, using SharpDX under .NET to be exact (but DirectX/C++ API solutions are applicable). I'm looking for the fastest way to render lines in an orthogonal projection ...
12
votes
1answer
1k 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
2answers
788 views

Do I lose/gain performance for discarding pixels even if I don't use depth testing?

When I first searched for discard instruction, I've found experts saying using discard will result in performance drain. They said discarding pixels will break GPU's ability to use zBuffer properly ...
12
votes
3answers
1k views

HLSL Translucent Plastic Shader

I'm trying to produce a shader to replicate a white plastic object with a colored light inside. Either by having a shader that will be translucent and if I put a light inside the object the light will ...
12
votes
3answers
631 views

How can I replicate the color limitations of the NES with an HLSL pixel shader?

So since 256 color mode is depreciated and no longer supported under Direct3D mode, I got the idea to use a pixel shader instead to simulate the NES palette of all possible colors so that fading ...
11
votes
4answers
3k views

Fixed-Function vs Shaders: Which for beginner?

I'm currently going to college for computer science. Although I do plan on utilizing an existing engine at some point to create a small game, my aim right now is towards learning the fundamentals: ...
11
votes
3answers
3k views

Why do pixel shaders not let us read directly from the framebuffer or the depth buffer?

Letting me sample the framebuffer or the depthbuffer in the pixel shader would be an extremely useful feature. Even just being able to know the depth or the color of whatever is behind the current ...
11
votes
3answers
594 views

Is there an alternative to decals that will let me put bullet holes on a complicated object?

I'm trying to figure out a way to do "bullet holes" but actually apply the texture at the shader level? If I'm dealing with a model which doesn't have a "flat" face I'd like to be able to wrap the ...
11
votes
1answer
4k views

How do I create a cel-shaded cartoon look?

I am interested in everything related to this kind of effect (modeling, game engine, animation). What sort of stuff is needed? Here are some sample images of what I mean:
11
votes
2answers
2k views

Realistic metal shader

How do you create a good metal shader? For different metals and say more or less eroded / rusty and so on. I know that one difference from ordinary materials is that metal should 'colour' the ...
11
votes
4answers
816 views

Is there any Shaders Directory? [closed]

There are many tutorials to learn GLSL, Cg, HLSL... with classical samples as bump mapping, toon-shading... But is there a shaders directory? a website where i can share my shaders search shader by ...
11
votes
2answers
1k views

Why are trees shining in background?

Currently I am creating a forest scene in the dark, and the trees are shining far away, but when I get close they are fine. I have the shaders set to "Nature/Tree Soft Occlusion [bark/leaves]", but ...
11
votes
2answers
1k views

Projective texture and deferred lighting

In my previous question, I asked whether it is possible to do projective texturing with deferred lighting. Now (more than half a year later) I have a problem with my implementation of the same thing. ...
11
votes
2answers
3k views

How can I debug shader programs?

I'm in the process of debugging GLSL vertex shaders and I can't shake the feeling that I'm doing it wrong. In general I have two strategies to make up for the lack of tracing I stuff values into a ...
11
votes
1answer
884 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
2answers
6k 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
4answers
2k views

How can I acheive a smooth 2D lighting effect?

I'm making a 2D tile based game in XNA. Currently my lightning looks like this. How can I get it to look like this? Instead of each block having its own tint, it has a smooth overlay. I'm assuming ...
10
votes
2answers
291 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
2answers
3k views

Efficient skeletal animation

I am looking at adopting a skeletal animation format (as prompted here) for an RTS game. The individual representation of each model on-screen will be small but there will be lots of them! In ...
10
votes
1answer
485 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
10k 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
4answers
970 views

Avoid if statements in DirectX 10 shaders?

I have heard that if statements should be avoid in shaders, because both parts of the statements will be execute, and than the wrong will be dropped (which harms the performance). It's still a ...
9
votes
1answer
562 views

What is Ramp Shading or Lighting?

What is ramp shading or lighting and how does it work? Is it different than toon shading or is it the same concept? How is specularity calculated differently for ramp shading versus blinn-phong or ...
9
votes
1answer
6k views

DirectX11, how do I manage and update multiple shader constant buffers?

Alright, I'm having a hard time grasping how constant buffers are bound to a pipeline stage and updated. I understand that DirectX11 can have up to 15 shader-constant buffers per stage and each buffer ...
9
votes
2answers
663 views

Handle many lights in a scene (with shaders)

I'm curious about how to handle many lights in a scene. Given a very big map in a role playing game, with dungeons (with lights in there) etc. I know about deferred lighting, but that only answers how ...
9
votes
1answer
638 views

Engine Rendering pipeline : Making shaders generic

I am trying to make a 2D game engine using OpenGL ES 2.0 (iOS for now). I've written Application layer in Objective C and a separate self contained RendererGLES20 in C++. No GL specific call is made ...