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)

3
votes
2answers
408 views

Screen effects and antialiasing

I have been working on a game for a while using glut for basic window creation. I was rendering to an offscreen buffer so that I could implement various effects like screen bulging, motion blur, ...
2
votes
2answers
941 views

Optimizing gaussian blur with linear filtering

There's a few (here, and here) gaussian blur tutorials out there suggesting that you can essentially cut the number of texture lookups in a gaussian blur shader in half by exploiting the GPU's ...
2
votes
3answers
2k views

Why even use shaders?

assuming I want my game to have a Cel-shaded look. There are plenty of tutorials how to implement Cel-shading in hlsl f.e. But what is the point? If I am creating my assets with Blender or 3d-max I ...
2
votes
3answers
803 views

Rain effect using DirectX 9 capabilities

Is it possible to achieve something similar to nVidia's rain demo using only shader model 3.0 capabilities? If yes, could you point out a few documents/web resources that are suitable candidates and ...
2
votes
1answer
229 views

What are the factors that determine the default frequency of a shader call?

After i have been played for some days with various vertex and fragments shaders seems clear to me that this programs are called by the GPU at every and each rendering cycle, the problem is that I ...
2
votes
2answers
2k views

Updating texture memory via shader?

What the title says.Is it possible to update a texture via a glsl shader ? Something like : //Read vec4 Pixel = texture2D(TextureID,gl_TexCoord[TextureIndex].st); //Write to texture memory ? vec4 ...
2
votes
2answers
2k views

2d metaballs with shader to give blobs of water effect?

I want to simulate blobs of water in a 2d game in Unity3d. One possible way of doing it is to use 3d metaballs moving in a 2d plane though this is very processor intensive. Do you think it would be ...
2
votes
2answers
309 views

How can I remove branches from a fragment shader function?

I have a fragment shader, when I've carefully managed to remove most branching decisions, as I have found out through research here that they are bad. But I have one function that I just can't work ...
2
votes
2answers
164 views

Are global shader variables slower than texture look ups?

I want to send quite a bit of data to the GPU, the data will never change (or will change very rarely) after it has been created. Is there a performance impact to using global shader variables or ...
2
votes
1answer
658 views

How can I pass an array of floats to the fragment shader using textures?

I want to map out a 2D array of depth elements for the fragment shader to use to check depth against to create shadows. I want to be able to copy a float array into the GPU, but using large uniform ...
2
votes
2answers
541 views

Lighting problems with Terrain

I'm in the process of learning Open GL and am having issues with lighting on my Terrian, I don't know if the issue is related to how I calculate my normals or the shader itself (I am using the shader ...
2
votes
1answer
964 views

Shader optimization - Cg/HLSL pseudo and via multiplication

HLSL/Cg do not allow texture fetching inside conditional blocks. To get around this I am first checking a variable and performing some computations, afterwards I set a float flag to 0.0 or 1.0, ...
2
votes
3answers
3k views

2D shader to draw representation of rotating sphere

I want to display a 3D textured sphere, and then rotate it in one direction. The direction will never change, and the camera will never move. One way is to actually create a spherical mesh, map a ...
2
votes
1answer
124 views

How does the GPU know how to form triangles for a given mesh?

I have just begun learning shader programing. What I learned is that the rasteriser groups three vertices to form a triangle for doing further operations. If that's true how does the rasteriser ...
2
votes
2answers
643 views

Shader that “cuts” hole through all geometry

How can I create a shader that "cuts" through all geometry, only rendering the clearing background in Unity? An example: That's a prism in a huge white box-shaped room. The surface of the prism is ...
2
votes
1answer
234 views

GLSL Multiple Uniform Structs

I'm developing a lighting system for my voxel game, and I have to send multiple (alot, say up to 200) lights to my shader program. Those lights contain the following data: Position (vec3) Color ...
2
votes
2answers
171 views

State propagation in modern OpenGL

When last I dabbled in game development, I managed my geometry in a tree. Every node would call the render method on it's children, prior to resetting it's transformations, thus allowing the ...
2
votes
1answer
3k views

Unity custom shaders and z-fighting

I've just readed a chapter of Unity iOS Essential by Robert Wiebe. It shows a solution for handling z-figthing problem occuring while rendering a street on a plane with the same y offset. Basically ...
2
votes
1answer
235 views

Graphic hardware texture formats shaders relational speed

I'm interested to know, is there a direct correlation to the speed that a shader will run based on the bit depth of a texture upon which it is running. For example: If I have a 2 bit stencil texture ...
2
votes
1answer
238 views

Basic knowledge for 2d gaming and images?

Can anybody refer me some pdf or ebook that i should follow for basic 2d programming and texture ,shaders and other gaming elements details in depth.By which i can easily get through the 2d game ...
2
votes
2answers
1k views

Multiplatform GLSL shader validator?

Im working on a multiplatform (Pc,Mac,Linux) game that uses shaders quite extensively. Since we do not have any funding, it is pretty hard to test our game on all possible hardware configurations. ...
2
votes
1answer
1k views

How to make a custom semantics HLSL shader for the pixel shader

I'm pretty sure it's possible but i have no idea how. Could anyone tell me how to make a custom semantic for a pixel shader. Thanks
2
votes
2answers
157 views

How to implement Fog Of War with an shader?

Okay, I'm creating a RTS game and want to implement an AgeOfEmpires-like Fog Of War(FOW). That means a tile(or pixel) can be: 0% transparent (unexplored) 50% transparent black (explored but not in ...
2
votes
2answers
65 views

Palette reduction to pre-defined palette

I'm writing a bunch of GLSL effects for fun, but I can't wrap my head around this. Basically, I want to reduce a texture's palette into a pre-defined set of colors. For example, a post-processing ...
2
votes
1answer
110 views

How can I compile a Direct3D 9 effect from a file?

I started working with shaders recently in DirectX9. I noticed that there is a D3DXCompileShaderFromFile function for IDirect3DVertexShader9 and pixel shader. Which compiles the shader and gives you ...
2
votes
1answer
72 views

XNA 4.0 - Strange edges with multilight shader

I am generating a light, a depth and a normalmap to calculate the lightning at each pixel with multiple lights. On both rendertargets, i set the preferredMultiSampleCount parameter to 16 samples ...
2
votes
2answers
155 views

Does GLSL copy function arguments by value?

My question is about passing variables to GLSL shader. I'm not sure how that works and what are the performance implications. Say I got a function that accepts a "vec4" variable. The question is - is ...
2
votes
2answers
206 views

Where should shaders and lights be in a component-based entity system?

Where should I put the shader and the light / shadow calculation? Should that be a component too? And should the rendering system know how to handle them or should there be a separate light system? ...
2
votes
1answer
129 views

How do we apply different textures to different faces generated via geometry shader?

I am trying to render a cube by starting of with one vertex into the shader, then geometry shader to expand into a cube, and then apply a different texture to each side. The part I am facing the issue ...
2
votes
2answers
141 views

Replacing 4 additive sprite layers with a single shader. Just can't get it right

I'm using directx9 and have 4 textures I want to draw on top of each other. if I do this: PDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA); ...
2
votes
1answer
164 views

Shader Variable Types

I have a simple question. what are the meaning of : half4 myHalf; myHalf.yyyy; myHalf.xxzz; // or myHalf.yw Thanks a lot !
2
votes
2answers
274 views

3D Distortion Effect

I'm trying to make a distortion effect similar to this: However I'm not making a 2d screen space effect. I'm applying it to a 3d scene and I want it to be placed IN the world, so it can be blocked ...
2
votes
1answer
105 views

What is a Fragment Pipe?

I remember someone saying "24 fragment pipes on nVidia 7800" in a presentation. Am I correct in saying that a fragment is the data that can generate a pixel in the frame buffer? Or are fragments the ...
2
votes
1answer
679 views

Low-level GPU code and Shader Compilation

Bear with me, because I will raise several questions at once. I still feel, though, that overall this can be treated as one question that may be answered succinctly. I recently dove into solidifying ...
2
votes
1answer
688 views

shader coding: calculate screen coordinates of fragment

Good morning, I'm new to shader coding and trying to implement some visual effects code in shaders using billboards. (Yes, I couldn't have picked anything harder to start with, but I'm lucky that way) ...
2
votes
1answer
451 views

Transformed Pretransformed coordinates?

I am creating a minecraft like terrain engine thing in XNA and C#, and I am trying to create a item/block selector tool. The thing is I would like to have 3D objects on the tool. So I thought for the ...
2
votes
2answers
871 views

implementing multi pass rendering in a game engine

I have done multi pass rendering before and understand how it works. I did a simple example which rendered a basic scene with shadows. This was all done in one file. Now I am trying to figure out is ...
2
votes
2answers
868 views

vertex/pixel shaders and “materials”

What relationship is there, if any, of "materials" and vertex/pixel shaders (or the "effects" that combine the latter two)? I have the impression that before the advent of HLSL, materials were ...
2
votes
2answers
114 views

Problem draw SkyBox behind my sun - XNA

I try to create a small and simple 3D games on XNA. I recently started to add a skyBox after added a sun in my game with the sample by Microsoft here ...
2
votes
1answer
362 views

Compute Shader Memory Sharing

Ok guys I have had some pretty good success on this site but I feel that this is a pretty complex question. I am trying to do tile based deferred lighting using DirectX 11 and the compute shader. ...
2
votes
1answer
194 views

Hemispherical Projection

I'm trying to implement a radiosity processor. I'm aware of many places online to find information about radiosity. I found a great source on NVidia's website is GPU Gems - Chapter 39 . On this page ...
2
votes
1answer
575 views

Writing to a structured buffer with a compute shader (D3D11)

I have some problems writing to a structured buffer. First I create a structured buffer that is filled with float values beginning from 0 to 99. Afterwards a copy the structured buffer to a CPU ...
2
votes
1answer
91 views

Why is it when I render a basic cube, my editor's grid changes too?

I have one HLSL file for DirectX11 that only has input layout for color and position. Then another HLSL file for the simple cube that has position, normal and textures. What I noticed is when I render ...
2
votes
1answer
608 views

Simple Optimized Blur Shader

I have a vertex-fragment shader that use the Unity3D GrabPass functionality (it grabs the screen). And I apply my GrabPass to have a transparent effect. GrabPass { "_GrabTex" } sampler2D ...
2
votes
1answer
173 views

How can I render the whole faces instead of only the vertices? [closed]

I'm doing my master thesis in comparing DX9 LoD with DX11 Tesselation LoD. Therefore I use a ShaderManager that calls either the shader for the DX9 implementation, where the model is exchanged by the ...
2
votes
1answer
2k views

How to draw a Bezier line with shaders?

I found a shader code to draw filled Quadratic Bezier in http://http.developer.nvidia.com/GPUGems3/gpugems3_ch25.html How can use something similar to draw a Bezier line that follows the same path? ...
2
votes
1answer
253 views

VBO and shaders confusion, what's their connection?

Considering OpenGL 2.1 VBOs and 1.20 GLSL shaders: When creating an entity like "Zombie", is it good to initialize just the VBO buffer with the data once and do N glDrawArrays() calls per each N ...
2
votes
1answer
173 views

Shadow cubemapping?

I am working on a game with C++ and OpenGL 3.2. I have successfully implemented directional shadow maps and now I'd like to upgrade them to shadow cube maps (for point lights). I've done some Googling ...
2
votes
1answer
351 views

Efficient manager/controller for uniform and/or attribute variables in a rendering engine

Most engines on the market have their drawbacks and it's difficult to find a simple/light-weight one that's open-source and doesn't have to put you through a rather complex learning process. Writing ...
2
votes
1answer
2k views

How to get the texture coordinate of a neighbouring pixel for a blur shader?

I'm still having some trouble to get my head around fragment shaders and doing some image processing on textures. The context is a 2D sprite: a simple texture painted on a quad. All done with OpenGL ...