Questions tagged [shaders]
a computer program that runs on graphics hardware and provides a high degree of control over how scenes are rendered
2,004
questions
111
votes
2
answers
41k
views
How can I create a "see behind walls" effect?
Divinity: Original Sin 2 has a beautiful see-through system. When I go behind walls, a splash mask will appear, and when I move around the game, it changes. It's like a dissolve shader, and has a ...
76
votes
1
answer
24k
views
How can I make a "wet surface"/"shallow puddle" shader in Unity?
In my game I need to create dynamic water puddles but I cannot find a tutorial that shows how I can make such an effect (an example of which is shown below). How can I do it?
69
votes
1
answer
12k
views
How can I replicate Quantum Break's distortion particle effect?
Quantum Break has this fantastic particle effect, it's a distortion effect like broken glass. I want know how I can replicate this effect? You can see it below, and a full video is available on ...
64
votes
6
answers
70k
views
What are the pros and cons of HLSL vs GLSL vs cg? [closed]
What are the pros / cons of the three?
59
votes
4
answers
87k
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 ...
56
votes
1
answer
41k
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 ...
56
votes
7
answers
81k
views
How can I draw outlines around 3D models?
How can I draw outlines around 3D models? I'm referring to something like the effects in a recent Pokemon game, which appear to have a single-pixel outline around them:
53
votes
2
answers
20k
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 ...
45
votes
2
answers
10k
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 ...
43
votes
1
answer
10k
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 ...
39
votes
4
answers
9k
views
What is a fragment in 3D graphics programming?
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 ...
33
votes
4
answers
23k
views
Difference between Material and Shader
In games, materials often only influence the visual appearance of objects. The visual appearance is effected by shaders. So regarding to terminology is there a difference between materials and shaders?...
30
votes
12
answers
33k
views
What are some good resources for learning HLSL? [closed]
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 ...
28
votes
5
answers
74k
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 ...
27
votes
3
answers
6k
views
How many active shaders at one frame in the game should I typically use? 5 or more like 100?
How many shaders are usually active, at the same time in one scene, in modern games? I know that multiple shaders are being used, with the games switching between them in each frame, and it's common ...
27
votes
3
answers
18k
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 ...
26
votes
3
answers
30k
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 engine ...
26
votes
1
answer
16k
views
What are Hull, Domain and Geometry shaders used for?
I've done my fair share of 3D game programming for my (former) employer, and also in my own custom engines for my own indie games.
Initially, I started with Direct3D 9, and D3DX9, which pretty much ...
24
votes
1
answer
6k
views
How can I create an exclusive asset for multiple clients who all want basically the same thing?
This is more of a legal question than for example a coding question, but I hope that it's allowed as well. I recently started working as a freelance VFX Artist and do a lot of work with shaders and ...
24
votes
2
answers
25k
views
What can I do with the 4th component of gl_Position?
When I set gl_Position I usually assign it such as gl_Position = vec4(in_position, 1.0) where ...
23
votes
3
answers
8k
views
Why is H (blinn) used instead of R (phong) in specular shading?
I can't find a good reason for this anywhere. The reflection vector used in phong has a simple basis in physics. But the half vector used in blinn seemingly has no rational basis, and does not ...
23
votes
2
answers
16k
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 ...
23
votes
3
answers
6k
views
How can I implement a short-cut grass effect?
I've been looking at some screenshots from games like Rocket League and FIFA:
and I started wondering one would achieve the short-cut grass effect.
Is it a shader? Is it actual geometry? Or just ...
20
votes
2
answers
6k
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 ...
20
votes
3
answers
9k
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 ...
20
votes
7
answers
11k
views
Modern Shader Book? [closed]
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 ...
19
votes
2
answers
45k
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 ...
19
votes
1
answer
4k
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 from ...
19
votes
1
answer
4k
views
How do I render my 3D game in ASCII art?
I'm trying to create an Easter egg for a 3D game in Unity3D. I want to render my game momentarily in ASCII art.
My first idea is to create a shader to do that, but I'm not sure if it's the right way.
18
votes
7
answers
23k
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 ...
18
votes
1
answer
4k
views
How can I fade player character when he goes inside or outside of the area?
I want to fade the player when he goes out of the area.
For example, suppose a person enters a building. When a person is outside of the building, he shouldn't be seen, but when he enters he ...
18
votes
2
answers
36k
views
GLSL Shader Effects: How to do motion blur?
I have a full 2D environment, with sprites going around as landscape, characters, etc.
To make it more state-of-art looking, I want to implement a motion blur effect, similar to modern FPS games (i.e....
18
votes
1
answer
8k
views
Game Engine Design – Ubershader - Shader management design [closed]
I want to implement a flexible Ubershader system, with deferred shading. My current idea is to create shaders out of modules, which deal with certain features, such as FlatTexture, BumpTexture, ...
18
votes
1
answer
48k
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:
18
votes
1
answer
6k
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, ...
18
votes
2
answers
5k
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 ...
17
votes
1
answer
3k
views
Phong lighting - there is something very strange with specular lighting
I implemented Phong lighting. Everything seems to work - torus and spheres are lighted as expected, etc. But I notices something strange regarding specular lighting of directional light.
Here are two ...
17
votes
2
answers
1k
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 ...
17
votes
2
answers
16k
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 (...
17
votes
4
answers
16k
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 ...
16
votes
4
answers
7k
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: ...
16
votes
2
answers
13k
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
1
answer
3k
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 ...
16
votes
1
answer
2k
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 ...
16
votes
1
answer
2k
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 ...
16
votes
7
answers
4k
views
How to make unit selection circles merge?
I would like to know how to make this effect of merged circle selection. Here are images to illustrate:
Basically I'm looking for this effect:
How the merge effect of the circles can be achieved ? I ...
16
votes
1
answer
1k
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
5
answers
10k
views
What rendering techniques would I use to draw a drop shadow effect for cards in a card game?
What type of shading algorithm might be used to create shadows like these?
the one I'm making is similar but it is all done with a 2D drawing API powered by OpenGL so there is no Z coordinate.
In ...
15
votes
2
answers
21k
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 ...
15
votes
2
answers
4k
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 ...