shader

DirectX post-processing shader

I have a simple application in which I need to let the user select a shader (.fx HLSL or assembly file, possibly with multiple passes, but all and only pixel shader) and preview it. The application runs, the list of shaders comes up, and a button launches the "preview window." From this preview window (which has a DirectX viewport in it...

DirectX 9: Vertex shader attribute source

That's about DirectX 9. In typical case of rendering with vertex shader, there's one or more stream sources set in device, and format of the source data is defined using vertex declaration. Now, if a vertex shader used need some attribute (for example, one with D3DDECLUSAGE_NORMAL and UsageIndex 1 or 2), but vertex declaration that's p...

How to use shader uniforms in general?

Shaders can have lots of different uniform names + attributes. How can I make a system which works in general case so that I do not have to know each shader uniform's name beforehand and hardcode it to code to get its location. I use OpenGL. ...

OpenGL texture base internal format to a shader

I am trying to mimic the behavior of OpenGL glTexEnv with a shader. It is quite complex function but should be doable. The only problem is that the function works differently depending on the texture base internal format. How can I get that information out of a texture? The texture base internal format is given with glTexImage2D function...

Deferred Shading DirectX demos?

I've been reading a lot about deferred shading and want to try and get into it. Problem is I can't find a sample which demonstrates how deferred shading can support so many lights simultaneously - I found one demo which was very simple with a single light in Code Sampler and an nVidia HDR sample butnothing beyond that. Would anyone know...

ATIX550 Can‘t use HardwareShadowMap in Cg?

sorry about my English. I am not good at English. Exactly the same code,in the GF7600GT, Tex2Dproj can return the correct value. But the X550 return to the depth of texture samples, ATI graphics card is not fully support the NV of Cg? ...

What are all the different HLSL sampler types for?

I'm working with DX9/SM3 at the moment, and the MSDN documentation on HLSL samplers seems to be sorely lacking in explaining how to use the different sampler types. What's worse is they try to cover DX9 and DX10 in a single article, so they jumble together all the keywords: sampler Name = SamplerType { Texture = <texture_variable>; [...

Qt MDI app with OpenGL: how to grab a valid screenshot?

I have an MDI app written in Qt. Some of the subwindows include QGLWidgets, i.e., OpenGL contexts. The most salient of these use OpenGL vertex and fragment shaders to visualize their data. I need to programmatically capture a screenshot of the application's main window, including of course all the subwindows that happen to be visible. S...

Calculating 3D tangent space

In order to use normal mapping in GLSL shaders, you need to know the normal, tangent and bitangent vectors of each vertex. RenderMonkey makes this easy by providing it's own predefined variables (rm_tangent and rm_binormal) for this. I am trying to add this functionality to my own 3d engine. Apparently it is possible to calculate the tan...

Problem with HLSL looping/sampling

I have a piece of HLSL code which looks like this: float4 GetIndirection(float2 TexCoord) { float4 indirection = tex2D(IndirectionSampler, TexCoord); for (half mip = indirection.b * 255; mip > 1 && indirection.a < 128; mip--) { indirection = tex2Dlod(IndirectionSampler, float4(TexCoord, 0, mip)); } return in...

How many render targets do low end Pixel Shader 2.0 supporting video cards support?

MRT allows for rendering to multiple texture targets in the pixel shader, but I'm not sure how many targets that is. I'm currently using 3 render targets but I may need as much as 5 (though probably just 4). I think the Radeon 9500s are pretty much entry level ps/vs 2.0 cards but I'm really not sure how many render targets it actually s...

HLSL Pixel Shader - Change Image Color For Specific Hue

I'd like to write a pixel shader that takes an input image, and converts all of the colors of one Hue range (i.e. HSV) into another Hue Range. My motivation is simple: I want to color a bunch of different textures differently, but i don't want to color the entire texture, just the portion with a hue in a specific range. That way, I can...

Loading a dds in C#

I am translating code from tutorial 7 in MS DirectX SDK to C#. I reached this line of code: // Load the Texture hr = D3DX10CreateShaderResourceViewFromFile( g_pd3dDevice, L"seafloor.dds", NULL, NULL, &g_pTextureRV, NULL ); if( FAILED( hr ) ) return hr; Can someone please help tell which SlimDX wrapper is equivalent to the functio...

Fragment shader rendering to off-screen frame buffer

Hi! In a Qt based application I want to execute a fragment shader on two textures (both 1000x1000 pixels). I draw a rectangle and the fragment shader works fine. But, now I want to renderer the output into GL_AUX0 frame buffer to let the result read back and save to a file. Unfortunately if the window size is less than 1000x1000 pixel...

Are there any libraries for loading and processing/disassembling Direct3D shader bytecode?

Are there any libraries for loading and processing/disassembling the Direct3D (10,11) shader bytecode files generated by fxc? I know that many developers (and hardware vendors) have internal tools to load and process the D3D shader bytecode formats, but since the shader bytecode format is private and binary-only as of D3D10, I wonder wh...

Debugging directx pixel/vertex shaders?

I'm trying to figure out how to debug pixel and vertex shaders in DirectX, I've tried using Pix for Windows but find it to be quite buggy and effectively non-operational. Is there an alternative that would allow me to debug these shaders inside my own application? ...

WPF pixel shader with HDR (16-bit) input?

I'm trying to build an image viewer for 16-bit PNG images with WPF. My idea was to load the images with PngBitmapDecoder, then put them into an Image control, and control the brightness/contrast with a pixel shader. However, I noticed that the input to the pixel shader seems to be converted to 8 bit already. Is that a known limitation ...

How to get pixel shaders version from .NET?

I am writing a WPF application and need to show info about video card installed in the system. I've faced a problem that I can't get pixel version supported by current video card. How can I do this using .NET? (importing of external code, may be DirectX libs, is also a suitable solution). ...

Can I use a vertex shader to display a models normals?

I'm currently using a VBO for the texture coordinates, normals and the vertices of a (3DS) model I'm drawing with "glDrawArrays(GL_TRIANGLES, ...);". For debugging I want to (temporarily) show the normals when drawing my model. Do I have to use immediate mode to draw each line from vert to vert+normal -OR- stuff another VBO with vert and...

inverse FFT in shader language?

Hi, does anyone know an implementation of the inverse FFT in HLSL/GLSL/cg ... ? It would save me much work. Best, heinrich ...