0
votes
1answer
200 views

Why i can not load a simple pixel shader effect (. fx) file in xna?

I just want to load a simple *.fx file into my project to make a (pixel shader) effect. But whenever I try to compile my project, I get the following error in visual studio Error List: Errors ...
9
votes
1answer
336 views

How do I implement 2D shadows cast between layers?

How could I implement 2d shadows that are cast by objects in a different layer? NOT like the dynamic lighting in the well known tutorial from Catalin Zima : But like the shadows of the pipes in ...
1
vote
2answers
62 views

Defining lines from a heightmap

To a pixel shader of a 2D game, I'm passing a 1-row heightmap that holds the height in UV coordinates of evenly distributed points throughout the texture I'm drawing, but as for n points there will ...
0
votes
1answer
519 views

How to create a fog effect in XNA with PixelShaderFunction?

I developped a small XNA games in 3D. I would like to add a "fog of war" on my models instantiated with an effect in my (.fx) file. The problem is, I do not know how to change the function ...
1
vote
2answers
516 views

How to set multiple times, in a single spritebatch, the same pixel shader parameter

I make a test with Effect class in XNA and I want to set multiple times the same parameters (MyParameter in below code). My code is : [...] //In Engine class Effect ShaderEffect = ...
0
votes
2answers
187 views

The saturate function is not working in my pixel shader

I wrote a pixel shader for my game and when I tried to compile it an error occurred: ID3DXEffectCompiler::CompileEffect: There was an error compiling expression When I removed all the saturate ...
0
votes
2answers
232 views

How to implement input-texture limited alphablending of 2 textures with HLSL?

I try to implement a HLSL shader the does the normal Alphablend with premultiplied colors (just as XNA4 does) but depending on some existing colors. One can think of adding a glow to a 2D terrain ...
1
vote
1answer
850 views

XNA HLSL 2D outline shader

I have gotten into quite a bit of trouble getting my rendering correct in my tile based 2D game. This kind of shader is surprisingly annoying to write, I've heard (we used it in one of our 3D ...
0
votes
2answers
811 views

HLSL shader optimization [closed]

The following HLSL shader (without preprocessing) results in 65 arithmetic operations (see below). Can the same effect achieved with <=64 operations? // Center of "light" float x; float y; // ...
1
vote
1answer
845 views

2D Mask antialiasing in xna hlsl

I have two texture2d , one of these is a mask texture and have 2kind color and i use that for mask (filter) second texture2D something like float4 tex = tex2D(sprite, texCoord); float4 bitMask ...
1
vote
0answers
507 views

Sprite visual effect in XNA?

Suppose I have a character sprite and I want to apply some animating effect that overlay its color, how would I do it? What I desire is something along this line: (From final fantasy tactics) It is ...
2
votes
1answer
232 views

isometric tile - How would I apply effect on only specific part of a sprite?

How would I apply a mask for pixel shading effect to restrict it only to some part of image? For example I have a height tile: Now I want to apply the effect only on the tile-shape of this ...
2
votes
1answer
277 views

Applying effects to an existing program that uses BasicEffect

Using the finished product from the tutorial here. Is it possible to apply the grayscale effect from here: Making entire scene fade to grayscale Or would you basically have to rewrite everything? ...
6
votes
1answer
269 views

How do texture lookups for trig functions work?

I have a pixel shader that calculates a mandelbrot fractal. It uses the standard formula: z = z2 + c I'd like to extend it so the power z is raised by varies. To do this i have the following ...
1
vote
1answer
1k views

XNA - Getting HLSL pixel of current render target?

I'm setting a render target in XNA using the following lines of code: Game.GraphicsDevice.SetRenderTarget(physicsTexture); Game.GraphicsDevice.Clear(Color.White); ...