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)

6
votes
1answer
396 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
965 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
578 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
1answer
110 views

Tessellation vs Geometry Shader

Correct me if I'm wrong, but both the Geometry Shader and the Tessellation Shader jobs are to generate vertices in the Graphic Pipeline. What I would like to know is how they are different and when ...
6
votes
1answer
543 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 ...
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
1answer
2k 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, ...
6
votes
2answers
1k 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
1k 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
907 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
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");) ...
5
votes
2answers
900 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
3answers
5k views

What happened to .fx files in D3D11?

It seems they completely ruined .fx file loading / parsing in D3D11. In D3D9, loading an entire effect file was D3DXCreateEffectFromFile( .. ), and you got a ID3DXEffect9, which had great methods ...
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
3answers
581 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
281 views

Where to store shaders

I have an OpenGL renderer which has a Scene member variable. The Scene object can contain N SceneObjects. I use these SceneObjects for storing the vertex position and any transforms. My question is, ...
5
votes
1answer
356 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
580 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
402 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
3answers
884 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
2answers
599 views

What range of values can HLSL's tex2D function return?

When using the tex2d function in a HLSL shader, as so: float height = tex2D(heightMap, IN.texCoord).r; What range of values can be returned to the height variable? Is it always a number between ...
5
votes
2answers
1k views

Should the modelview and projection matrices be calculated in the shader or on the CPU?

At minimum I would have a camera with rotation and world position; projections parameters such as angle of view and perspective vs. orthographic; and meshes with scale, angle, and world position. ...
5
votes
2answers
731 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
736 views

GLSL shader without a vertex array

Ok so I have a idea for a neat GPU driven curve renderer, and I realised that the vertex shader can be hardwired to generate points of the curve segment (to be rendered as a line strip) without ...
5
votes
3answers
735 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
342 views

Multipass shaders and switching between passes

As mentioned here Effects should be avoided in DX11. If I understand correctly, that includes techniques and passes defined in *.FX files. So when doing a multipass shader (like the always-mentioned ...
5
votes
1answer
453 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
3answers
732 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
2answers
1k 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
3answers
326 views

How do I send multiple matrices to a vertex shader?

I'm practising animations using bones/skinning. I am trying to send the shader one matrix per vertex. I can think of these two approaches. Method 1 I have one uniform handle for each bone matrix ...
5
votes
1answer
374 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
2answers
693 views

Detect Mip mapping level in the shader?

Is there a way to do this in pixel shader 2.0/3.0? I've got on or off transparency so when the mipmapping level is different the transparency can take up too much of the texture and make it ...
5
votes
3answers
1k views

Multiple render targets and gamma correctness in Direct3D9

Let's say in a deferred renderer when building your G-Buffer you're going to render texture color, normals, depth and whatever else to your multiple render targets at once. Now if you want to have a ...
5
votes
1answer
295 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
243 views

How can I optimize a parallax effect consisting of multiple transparent layers?

I have a parallax effect in MonoGame consisting of multiple semi-transparent layers of textures. The effect is simple, but rendering multiple transparent layers on top of each other is rather slow. ...
5
votes
3answers
934 views

Does Unity's “Transparent Bumped Specular” translate to “semi-shiny must be semi-transparent”?

Unity's documentation for the "Transparent Bumped Specular" shader/material-type is simply a concatenation of each of the descriptions for its Transparent and Specular Shaders (and also Bumped, but ...
4
votes
1answer
4k 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
749 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
639 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 ...
4
votes
2answers
424 views

What Shading/Rendering techniques are being used in this image?

My previous question wasn't clear enough. From a rendering point of view what kind of techniques are used in this image as I would like to apply a similar style (I'm using OpenGL if that matters): ...
4
votes
2answers
515 views

Programatically replace color gradient on sprite

Say I have the following image: I want to tint the yellow parts on this sprites shoulder/arms by a random color. In other questions on this site, they suggest using a chroma key and replacing the ...
4
votes
1answer
685 views

Shader effect similar to Metro 2033 gasmask

I was thinking about effects in games the other day and I was reminded of the Gasmask effect from Metro 2033. Once you put the gasmask on it blurred a bit in the corners and could ice up and even get ...
4
votes
3answers
2k views

Loading and using an HLSL shader?

I've been looking everywhere and all I can find are tutorials on writing the shaders. None of them showed me how to incorporate them into my scene. So essentially: Given an hlsl shader, if I were to ...
4
votes
2answers
189 views

Shadowmap first phase and shaders

I am using OpenGL 3.3 and am tryin to implement shadow mapping using cube maps. I have a framebuffer with a depth attachment and a cube map texture. My question is how to design the shaders for the ...
4
votes
1answer
761 views

Bitwise operators in DX9 ps_2_0 shader

I've got the following code in a shader: // v & y are both uints nPixel = v; nPixel << 8; nPixel |= y; and this gives me the following error in compilation: shader.fx(80,10): error ...
4
votes
2answers
336 views

How can I use shaders to make a square have a waving effect?

I'm new to using shaders to do some fancy effects and I'm struggling with them. I'm using DirectX 11 and HLSL. I have this square in the middle of the screen: It's just a square that I've created ...
4
votes
1answer
844 views

variable number of lights in a glsl shader?

I want to render an arbitrary number of lights in my fragment shader. I do not understand how you can properly pass them into the shader though. For example, I want something like this: uniform int ...
4
votes
1answer
2k views

Access vertex data stored in VBO in the shader

If I wanted to store extra data in a VBO for skinning (indices for indexing into an array of matrices of bones and floats for applying weights to those bones) How would I go about accessing that data ...
4
votes
1answer
956 views

Multiplication for MVP matrices: Any benefits to doing so within the vertex shader?

I'd like to understand under what circumstances (if any) it is worth doing MVP matrix multiplication inside a vertex shader. The vertex shader is run once per vertex, and a single mesh typically ...
4
votes
1answer
583 views

My GLSL shader isn't compiling even though it should. What should I investigate?

I'm porting an iOS game to Android. One of the shaders I'm using wouldn't compile until I reduced the number of uniform variables. Here are the uniform definitions: uniform highp mat4 ...