shaders

RGB filters for different forms of color blindness

My father is color blind and given that I work in games where the visuals are important, I've always wanted to write a filter for screen shots (or even some type of shader) that emulated different forms of color blindness. I've seen plenty of references but never have been able to track down algorithms. Any algorithms would be apprec...

At what point do MaxTextureRepeat limitations come into play?

When executing a pixel shader under Direct3D, do the limits on texture coordinates imposed by MaxTextureRepeat only become an issue during calls to texture lookup functions such as Tex2D(), or do they come into play anytime the texture coordinates are accessed within the shader? I wish to know whether it's possible to avoid the MaxTextu...

glProgramStringARB causing GL_INVALID_OPERATION....or Help with fragment programs

I am trying to write a fragment program that will take a texture and clamp the texels between two values. That is, if the min value is say 0.2 and the max value is 0.6, any texel less than 0.2 will become 0, any texel greater than 0.6 will become 1.0, and all values in between will be mapped from 0 to 1.0. My call to glProgramStringARB ...

Jogl Shader programming

I just started Shader programming(GLSL) and created a few with RenderMonkey. Now I want to use this Shaders in my java code. Are there any simple examples of how I do that? ...

How to efficiently render and process video streams using GPU?

I plan to develop a tool for realtime video manipulation using C++, Qt and OpenGL. Video overlay isn't an option since shaders should be used for frame processing. At the moment I imagine a following sequence of steps: Decode video (CPU) Preprocess it (optional, CPU) Transer it to video memory (GPU using DMA) Further process it using v...

Graphics card for OpenGL shader development

I need some hardware for high bandwidth video processing using GLSL. Could anyone recommend me the best GPU for the job? My requirements (most to least important): fits into laptop good fragment shaders support (high instruction limit etc) pixel buffer object extension quality opengl windows driver low price :) ...

OpenGL ES 1.x Shaders

Hello, I am trying to find examples of how to implement a simple shader for OpenGL ES 1.x (specifically for the iPhone). I have never worked with shaders before, but I do understand what they are used for. I think that once I am able to load a simple shader in the simulator I will be able to take it from there and do what I need to do....

GLSL fragment shader newb question

the following simple fragment shader code fails, leaving me with an uninformative message in the log (ERROR: 0:1: 'gl_Color' : syntax error syntax error): void main() { vec4 myOutputColor(gl_Color); gl_FragColor = myOutputColor; } while the following one works: void main() { glFragColor = gl_Color; } This boggles my mind, as ...

Stacking Cg shaders

In my engine I load Cg shaders from pairs of vertex/pixel shader files. I would like to be able to stack shaders to combine them (lighting + material, etc.). Short of breaking up the shaders into separate functions and then creating a single shader script string from those, do you know of any good ways of stacking different shaders in Cg...

Help with Pixel Shader effect for brightness and contrast

What is a simple pixel shader script effect to apply brightness and contrast? I found this one, but it doesn't seem to be correct: sampler2D input : register(s0); float brightness : register(c0); float contrast : register(c1); float4 main(float2 uv : TEXCOORD) : COLOR { float4 color = tex2D(input, uv); float4 result = color; ...

WPF PixelShaders: How to create a Temporary Register dependency property?

Hi, I've run out of the 8 possible constant registers in a wpf pixelshader effect. I need access to temporary registers, which I believe are available 6 on a DX 8.1 level gfx cards. Question is: How to create a temporary register dependency property in C# code? Constant registers are created like this: public static readonly Depende...

Drawing circles on a sphere

I'm trying to draw lots of circles on a sphere using shaders. The basic alogrith is like this: [1] - calculate the distance from the fragment (using it's texture coordinates) to the location of the circle's center (the circle's center is also specified in texture coordinates) [2] - calculate the angle from the fragent to the center of t...

What options are there for GLSL shader development on OS X?

Apple's Shader Builder is not terribly advanced. I was wondering if there are any better choices for OS X other than running something under bootcamp. ...

Converting a depth texture sample to a distance

I'm currently reading from a depth texture in a postprocess depth of field shader using the following GLSL code: vec4 depthSample = texture2D(sDepthTexture, tcScreen); float depth = depthSample.x * 255.0 / 256.0 + depthSample.y * 255.0 / 65536.0 + depthSample.z * 255.0 / 16777216.0; And then converting the ...

wpf shader template

I used the shader templates given through Greg Schechter's blog: http://blogs.msdn.com/greg_schechter/archive/2008/08/11/a-visualstudio-buildtask-and-project-and-item-templates-for-writing-shadereffects.aspx It was all simple to add the wpf shader templates and create the project. I'm also able to see that the shader is working through ...

XNA SpriteBatch and BasicEffect not compatible?

I would like to control ambient lighting for a 2D SpriteBatch rendered set of graphics on a global scale. I realise I can do this by blending the color passed into SpriteBatch.Draw but I'd rather do this globally. The BasicEffect shader contols fixed function pipeline style lighting in XNA for simple scenes. Is the BasicEffect shader ...

Is it possible to use a shader to find the "difference" between two textures? (XNA/HLSL)

I have made a simple webcam based application that detects the "edges of motion" so draws a texture that shows where the pixels of the current frame are significantly different to the previous frame. This is my code: // LastTexture is a Texture2D of the previous frame. // CurrentTexture is a Texture2D of the current frame. // Differenc...

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...

WPF pixelshader on writeable bitmap

Hey, While experimenting with pixel shaders in WPF I decided to draw some pixels onto a fullscreen image through writeable bitmaps based on the MSDN sample http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.writeablebitmap.aspx I used a blur shader on the image. To have a continuous effect I took the image back from t...

Hooks for Direct3D 6.1 to replace EMBM with shaders

I am writing Windows Hooks for DirectX 6.1. I want to intercept calls for EMBM (Environment Mapped Bump Mapping) and pass the data to own bump shader, so application which depend on EMBM will work correctly. The only problem is that DX 6.1 don't allow shaders at all. I can't simple replace Direct3DDevice3 with class from newer SDK, becau...