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)

2
votes
1answer
224 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
281 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
159 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
633 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
539 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
949 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
123 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
509 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
228 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
234 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
236 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
61 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
104 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
67 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
140 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
196 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
123 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
140 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
141 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
263 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
102 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
657 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
650 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
450 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
858 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
861 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
108 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
341 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
189 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
542 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
569 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
172 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
1k 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
250 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
172 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
341 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 ...
2
votes
3answers
2k views

Decompile an FX shader

Is it possible to decompile a .xnb file? I've lost my shader code, but only have my .xnb file left.
2
votes
1answer
2k views

I cannot update a shader constant via a constant buffer in DirectX 11

I've tried everything I can think of, but I cannot get a constant buffer to update a variable in my shader in DirectX 11. I followed the examples on msdn. I read and re-read the articles on constant ...
2
votes
1answer
241 views

pixel shader and vertex shader problem in visual studio 2008

I have just installed XNA for VB2008 professional, now i try to run my first game development and i get this error, any way around this, am using windows xp sp3 my system configuration Host Name: ...
2
votes
2answers
3k views

How do I create a sky box with OpenGL ES 2.0?

Can you give me hint to any good sky box example in OpenGL ES 2.0? I have found only OpenGL and does not work for me. I am doing it this way: Initialization: glUseProgram(m_programSkyBox.Program); ...
2
votes
1answer
257 views

Bluring behind something then drawing text?

I want to basically make a blur shader in glsl and use it like Windows 7 does for Windows. I want to for example draw something and then blur a rectangle, then draw text over it. If someone could ...
2
votes
2answers
103 views

Water silhouette shader using GLSL

I have this problem to solve using Cocos2d-x 3.x: In my game there is water represented by rectangle texture, modified by the code on the go. I also have a character moving around, rotating etc. I ...