a computer program that runs on graphics hardware and provides a high degree of control over how scenes are rendered
7
votes
3answers
806 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
5answers
2k 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 ...
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
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
1answer
1k views
Sprite sheets with buffer objects and shaders
What is the "best" way to handle sprite sheets with shaders and buffers? In immediate mode it is easy to modify a sprite's texcoords when it is drawn, but I don't know how to do this with modern ...
7
votes
1answer
573 views
What is a rim shader used for?
What does a rim shader do and what is it used for? In what cases would it make sense to utilize a rim shader?
7
votes
1answer
243 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
2answers
432 views
Does use of simple shaders improve performace/battery life?
I'm making OpenGL game for Android. Till now i've used only fixed function pipeline, but i'm rendering simple things.
Fixed function pipeline includes a lot of stuff i don't need. So i'm thinking ...
7
votes
3answers
1k views
Rotating a vector by another vector in shader
I have a terrain surface with a normal for each point on the terrain.
I have a second detail normal map to be applied to the terrain.
These normals are in 3-space.
The Y value of both normals is
...
6
votes
3answers
1k views
What are the big advantages of shaders ? What is doable with them, and what can't be done without them?
I don't really know when vertex and/or pixel shaders became available for consoles and computers, but what could we do without them ? I don't really understand what is achievable with shaders and what ...
6
votes
4answers
847 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
2answers
609 views
Rendering collections of light sources
I have a small test environment where small point lights are scattered. Players should able to collect them.
The collectible lights are rendered using a simple billboard technique where two triangles ...
6
votes
3answers
814 views
Is it possible to load shader files from a DLL?
I have a few HLSL files that I'd like to add into a DLL project so that I don't have to keep adding these same shader files into a new Content project every time I want to use them. Is this possible, ...
6
votes
1answer
660 views
Any good books on graphics programming?
I've been looking for a book that takes a bottom-up approach for graphics programming. So something that starts with 2d filtering, maybe moving into normal mapping, then ambient occlusion, etc.
I ask ...
6
votes
1answer
691 views
XNA Sprite Flash Effect
I'm looking for a way to render every non-transparent pixel in a sprite solid white (to 'flash' the sprite white when the player takes damage etc). This is on Windows Phone 7.
I was using a very ...
6
votes
1answer
321 views
Huge 2d pixelized world
I would like to make a game field in a indie-strategic 2d game to be some a-like this popular picture.
So every "pixel"(blocks) changes it's color slowly, sometimes a bright color wave happens, etc, ...
6
votes
1answer
688 views
Adding a simple mix() destroys the framerate
I have a very simple shader and added linear fog via mix like this:
finalColor = mix(finalColor, vec3(0.5, 0.8, 0.95), vUVoutAndViewZ.z);
Note that the view Z distance is in the variable that also ...
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
2answers
496 views
What is a good alternative to Unified Shader for Shadows?
Most shadow systems I have seen use a unified shader system for shadowing techniques, resulting in an uber shader for the projects.
What alternatives do you find work well or is the unified shader ...
6
votes
2answers
969 views
Looking for an example of glass with XNA or DirectX 9
Any good pointers on how to get the refractive look of glass? I'm looking to create a think piece of glass type of look, sort of the type that you'd have on bathroom shower doors.
6
votes
3answers
809 views
How to handle multiple effect files in XNA
So I'm using ModelMesh and it's built in Effects parameter to draw a mesh with some shaders I'm playing with. I have a simple GUI that lets me change these parameters to my heart's desire. My question ...
6
votes
2answers
777 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 ...
6
votes
1answer
1k views
Atmospheric Scattering
I'm trying to implement atmospheric scattering based on Sean O`Neil algorithm that was published in GPU Gems 2. But I have some trouble getting the shader to work. My latest attempts resulted in: ...
5
votes
2answers
719 views
Different number of lights => different shader
I have a shader that computes lighting for each light.
PointLight PointLights[10];
uniform const float NumPointLights;
for(int i = 0; i < NumPointLights; i++)
{
lightVec = ...
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
1k views
How is this glowing with colors radiating outward 2D effect accomplished?
I'm currently totally at a loss as to how this effect is done:
http://www.youtube.com/watch?v=zp8MHUNp7Cg
The glowing on the ship and the changing color. I want to do this effect in XNA 4.0 any ...
5
votes
1answer
262 views
Changing water color based on depth
I'm looking to make a water shader that colors the water based on its depth. Up until now my water shader that I've used has basically been extremely reflective and only looked somewhat blue because ...
5
votes
3answers
314 views
Finding out what pixel on the screen the fragment falls on
In my 2D game, I render tiles. I want to do lighting without needing an extra buffer the size of the screen.
Either in glsl or hlsl, what could I feed to the shader each time I render a bitmap so ...
5
votes
1answer
260 views
What is the point of this hard-coded vector when calculating luminance in glow/bloom effects?
I have looked at two different vertex shaders that calculate luminance and both use a "magic" vector that I'm not sure the meaning of the the actual values. For instance:
const mediump vec3 ...
5
votes
2answers
417 views
Which are the most futureproof languages for graphics (shader) programming?
I have written some GLSL and Cg shaders a couple years back. I am starting another graphics engine project and I want to choose my technologies carefully so that my code will be accessible years down ...
5
votes
1answer
4k 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 ...
5
votes
3answers
768 views
Vertex Shader Fundamental Workings
I understand that water ripples (e.g. stone thrown into a pond) are often handled with vertex shaders. My first question is: are the ripples nothing more than an algorithm that is the function of ...
5
votes
1answer
184 views
HLSL Circle all white
I have been trying to get my shader code (HLSL) to draw a simple circle but after a day and a half I am getting nowhere. It seems people are using the x^2 + y^2 = r^2 and remap texcoords but I only ...
5
votes
1answer
370 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
629 views
How can I acheive a smooth 2D lighting effect?
I'm making a tile based game in XNA.
So 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 ...
5
votes
2answers
309 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
1answer
305 views
Partial Shader Signatures HLSL D3D11 C++
I had been debugging a problem I was having in a single shader file with 2 functions in it. I'm using DirectX 11, vs_5_0 and ps_5_0. I have stripped it down to its basic components to understand what ...
5
votes
1answer
742 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
3answers
418 views
XNA shader compiler error in release mode
I'm having a hard time figuring out if I'm doing something wrong, or if there is a bug with Visual Studio.
I want to pass a float into my pixel shader, clamp it to a value, and then return it as part ...
5
votes
1answer
424 views
Dealing with alpha for 2D per pixel lighting
Right now I've got a simple light shader. Every bitmap I draw goes through it to make up the scene. I only draw quads.
texture tex;
sampler2D s = sampler_state {
texture = <tex>;
...
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
3answers
578 views
Can anyone recommend a 3D model viewer with shading?
I am looking for a simple real-time OpenGL based render engine to show a 3D model on screen.
I prefer using 3DS Max's 'shader' materials (real-time materials) for editing.
Do you know any good ...
5
votes
1answer
1k views
How to manage shaders?
I've done some shader programming some time ago but only simple stuff. I'm especially interested in how do you manage shaders? Do you just write one of each kind, or do you need more of them? If so, ...
5
votes
2answers
991 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
269 views
Performance of pixel shaders vs. SpriteBatch: XNA
Precondition: I read this question/answer about using shaders, or spritebatch, to render and mark a sprite.
I need to do something like that. I also have a 2D lighting PoC which I need to write. The ...
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 ...
5
votes
1answer
2k views
gl_PointCoord always zero
I am trying to draw point sprites in OpenGL with a shader but gl_PointCoord is always zero.
Here is my code
Setup:
//Shader creation..(includes glBindAttribLocation(program, ATTRIB_P, "p");)
...
4
votes
1answer
1k views
How do I pass vertex and color positions to OpenGL shaders?
I've been trying to get this to work for the past two days, telling myself I wouldn't ask for help. I think you can see where that got me...
I thought I'd try my hand at a little OpenGL, because ...
4
votes
2answers
610 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 = ...
4
votes
2answers
483 views
What does the term 'photorealistic' really mean?
I was wondering about the term 'photorealistic' in regards to rendering and was wondering how this is used.
Is it used to describe a shader (or set of) that have certain quantifiable features? Or any ...