shader

Setting a texture in a pixel shader and making it the render target?

I was wondering, if I render a scene using a shader to which I pass in a texture that also happens to be the render target for that scene will it cause any unwanted behaviour? So basically: texture t; shader->SetTexture("texture",t); device->SetRenderTarget( 0, t->surface ); shader->Begin("effect") // do some more shader stuff devi...

GL fragment shaders 101

I want to add a GLSL fragment shader to a program of mine, however I have been unable to find comprehensive documentation related to the C language (not C++ or C#). Anyone has examples or steps to get the ARB extension for shaders, or some sort of "hello world" template? I don't need help on the shaders themselves, just how to get them ...

How does this work in computing the depth map?

From this site: http://www.catalinzima.com/?page%5Fid=14 I've always been confused about how the depth map is calculated. The vertex shader function calculates position as follows: VertexShaderOutput VertexShaderFunction(VertexShaderInput input) { VertexShaderOutput output; float4 worldPosition = mul(input.Position, World)...

WPF ShaderEffect with PS 3.0 shaders

Where could I find examples of PS 3.0 shaders used as ShaderEffects for WPF 4? I'm looking for tutorials, presentations, any resource on this matter. ...

Fragment shaders: output variables

Reading the GLSL 1.40 specification: Fragment outputs can only be float, floating-point vectors, signed or unsigned integers or integer vectors, or arrays of any these. Matrices and structures cannot be output. Fragment outputs are declared as in the following examples: out vec4 FragmentColor; out uint Luminosity; ...

Shader files for hue\saturation\brightness

I am new to write a shader files(.fx), how can i write shader file to set hue\brigtness\contrast. ...

Basic samples for shader in Managed DirectX

I am new write a pixel shader and use in my managed directx project, where i can get some basic sample to start it. ...

Is it possible to use a pixel shader inside a sprite?

Dear all, Is it possible to use a pixel shader inside a sprite? I have create a simple pixel shader, that just writes red color, for testing. I have surrounded my Sprite.DrawImage(tex,...) call by the effect.Begin(...), BeginPass(0), and EndPass(), End(), but my shader seems not to be used : My texture is drawn just normally. ...

How to change a GLSL shader parameter in Processing

I'm playing with shaders in openGL using Processing. I'm pretty noob at this and a bit lost. I found this thread that has an example on how to use GLSL shaders in Processing. I'm just trying to the change LightPosition parameter in the shader I'm using. I don't know how to access it though. Here's my code so far: import processing.o...

2D rendering with per-pixel lighting/normal map - directX

hiya. I'm looking for the simplest, easiest and fastest technique to render 2D textured quads with per-pixel normals. what i mean is a 3D world where the camera is fixed and all the texture quads are facing to the same direction (the camera), and between them there will be light points, and i want the textures to have per-pixel normal va...

Making Photoshop-like drop shadows in a game

I'm making a game where the game's size varies, so I want to make my own shadows. The api i'm using can fill rectangles, make ellipses, horizontal lines etc. And supports rgba. Given this, how could I make a drop shadow? I tried making a black to white gradient and setting the alpha to 20%, but it didnt look very good... I'm not sure how...

IronPython: Trouble building a WPF ShaderEffect

I'm trying to build an extensible program where users, among other things, can build their own shader effects. Google searching got me this far; class Test(ShaderEffect): inputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", type(Test()), 0) But I still get the error; TypeError: cannot access protected me...

Using 3D Studio Max DirectX shader in XNA problem

UPDATE 2: It now appears this is more of a modelling issue than a programming one. Whoops. I'm new to XNA development, and despite my C# experience, I've been stuck at one spot for going on two days now. The situation: I've created a model in 3D Studio Max 2010 which uses two materials, both are of type DirectX Shader. The model export...

Cocoa and OpenGL, How do I set a GLSL vertex attribute using an array?

I'm fairly new to OpenGL, and I seem to be experiencing some difficulties. I've written a simple shader in GLSL, that is supposed to transform vertices by given joint matrices, allowing simple skeletal animation. Each vertex has a maximum of two bone influences (stored as the x and y components of a Vec2), indices and corresponding weigh...

polygon tessellation in opengl shader

want 20k+ 2D polygons to be rendered in opengl with outline & fill some polygons are concave is it possible to do this using shaders? thx! ...

GPU Manual Mipmap Generation [OpenGL 2.x]

i want use a specific customized algorithm to generate mipmaps for some renderable textures (R16F & RGBA16F). All needed textures' mipmaps are pre-enabled by using glGenerateMipmapEXT(). The biggest problem so far is to render into 1+ mipmap levels. More precisely, this works like a charm: ... glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); g...

Direct3D Line thickness

How do I change the thickness of lines when drawing line lists using Direct3D? This post says that line width is not supported and goes on to provide a workaround. Other options? While we are on this topic, do shaders allow one to draw lines with dash patterns? ...

Need help with Shallow Water Ripples effect in XNA

hello everyone. I need to create a water-like surface in XNA, viewed from above. Like this : http://www.youtube.com/watch?v=Nr42AG1aPAY Can someone point me to some examples? I don't know where to start. Thanks, SW. ...

Can you have multiple pixel (fragment) shaders in the same program?

Hopefully this is an easy question. I like things being organised, so I would like to have two pixel shaders; the first doing one thing, and then the next doing something else. Is this possible, or do I have to pack everything into the one shader? Thanks. ...

GLSL problem with fragment shader renders only black GL_POINTS

Hi! I am trying to add some shaders to my old OpenGL program that draws a lot of GL_POINTS and some GL_LINES. I created these two shaders: Vertex shader: void main() { vec4 v = vec4(gl_Vertex); v.z = v.z + sin(v.x*v.x + v.y*v.y)/10.0; gl_Position = gl_ModelViewProjectionMatrix * v; } Fragment shader: #version 120 vo...