0
votes
0answers
17 views

XNA `tex2Dlod` always returns transparent black

I want to sample a texture in a vertex shader, so at first I just tried using float2 texcoords = ...; color = tex2D(texture, texcoords); But apparently I cannot use tex2D in a vertex shader, and ...
2
votes
2answers
114 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 ...
0
votes
0answers
44 views

XNA Shader deformation event driven

I’m working on this tutorial trying to figure out how i can modify the code in order to get the deformation along only one axis (for example Z axis) when I hit a button on my keybord. In other words, ...
2
votes
1answer
72 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 ...
1
vote
1answer
97 views

XNA Diffuse Shader Issue. Edge lighting problem. Image Attached

As you can see in this image the diffuse shading is working correctly in some places but in other places such as the the bottom of the sphere you can see the squares/triangles of the mesh. Any ...
0
votes
1answer
129 views

XNA and HLSL shaders - Instancing using World Matrix array

I have posted this question on StackOverflow and was directed here, so I'll just copy the question: I am attempting to improvise some sort of hardware instancing in my game. I wish to draw multiple ...
3
votes
1answer
338 views

Spritebatch Vertex shader world matrix change after each draw

I have a spritebatch where I draw some textures transformed in 3d space. The easy way was just Begin with the transformation matrix, draw, and end it right after. But that is silly, so I'm trying ...
5
votes
2answers
299 views

How can I optimize a parallax effect consisting of multiple transparent layers?

I have a parallax effect in MonoGame consisting of multiple semi-transparent layers of textures. The effect is simple, but rendering multiple transparent layers on top of each other is rather slow. ...
3
votes
1answer
222 views

Is multipass rendering possible with SpriteBatch?

I'm trying to implement a bloom effect. This requires three shader passes: a brightness threshold, a horizontal blur, and a vertical blur. It also requires resizes, but these are irrelevant to the ...
0
votes
1answer
137 views

HLSL postprocessing for day to night (DTN)

I am trying to implement a "day-to-night"-filter (as commonly used in cinema) for a 2D game (XNA) by using a full screen HLSL pixel shader. The aim is to transform any bright and colorful image into a ...
6
votes
2answers
270 views

Improving the efficiency of my bloom/glow shader

I'm making a neon style game where everything is glowing but the glow I have is kinda small and I want to know if there's an efficient way to increase the size of it other than increasing the pixel ...
8
votes
1answer
294 views

Fast lighting with multiple lights

How can I implement fast lighting with multiple lights? I don't want to restrain the player, he can place an unlimited number and possibly overlapping (point) lights into the level. The problem is ...
0
votes
1answer
211 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 ...
0
votes
1answer
81 views

XNA Shader has an unwanted tint

I'm working on a shader but it has a weird tint to it and I'm not sure why. Right now it's extremely simple, it just sets a rendertarget, draws to it, passes it as a texture to the shader then oututs ...
0
votes
2answers
302 views

Help on my glow shader!

I'm trying to create a glow shader for a neon style game but I'm having a little trouble with rendertargets. Right now all I want is something VERY simple where I change the rendertarget, draw to it ...
1
vote
1answer
129 views

XNA Strange Lighting, Shader

Hey guys, i have strange lighting problem. I've written my own "deferred lighting" shader and this happend: Pic: Normal-Map Pic: Light-Map As long as i only use one big mesh everything seems ...
2
votes
2answers
350 views

How do I rotate a single object in HLSL?

I have a World with a 3D model of a head in it and that World rotates, like such: protected override void Update(GameTime gameTime) { //other stuff angle += 0.00005f; //more other stuff ...
0
votes
0answers
62 views

XNA HLSL no model textures

I am using XNA and HLSL to render all the models in my game, so far there is only one, a flashlight. My flashlight model is a .fbx file type, and it loads the model in the game perfectly fine. ...
3
votes
1answer
211 views

Outlining external edges on a complex shape made of cubes?

A gallery of my problem can be found here. I had to do it this way as it won't let me post more than 2 links due to my reputation. I'm trying to use 3D cubes to generate an isometric cube world. I ...
2
votes
0answers
295 views

XNA 4.0 Pixel Shader 3.0 Exact Texture Lookup/Sample Issue

I am stuck on trying to solve this problem. I originally had some shaders written that worked for XNA 3.1, but after converting to XNA 4.0 they would no longer compile due to instruction counts, flow ...
1
vote
2answers
621 views

XNA HLSL Shader Glow

I have googled this to death, and I still don't quite understand it. I'm trying to create a glow effect in XNA using HLSL. A long time ago I was able to do it the way most people suggest which is by ...
4
votes
2answers
274 views

Refractive blur in XNA?

I'm writing a 2D hack-and-slash game using XNA. I really want to implement the blur-like, refractive effect of a sword or such moving really quickly, seen in such games as Dust: An Elysian Tail and ...
0
votes
1answer
133 views

Angle to Vector3?

I am working on getting my directional lights to match the sun in my atmospheric scattering shader. I have a float that ranges from 0 to 6.28 (TwoPi). How would I calculate a vector3 from this angle? ...
3
votes
0answers
163 views

SSAO Distortion [closed]

I'm currently (attempting) to add SSAO to my engine, except it's...not really work, to say the least. I use a deferred renderer to render my scene. I have four render targets: Albedo, Light, Normal, ...
0
votes
2answers
181 views

HLSL Pixel Shader Compile, Flow Control, Instruction Count, XNA Issue

im trying to find help with an issue im having moving from the XNA 3.1 framework to XNA 4.0. The shaders I wrote for my 2D game work fine in XNA 3.1, but wont even compile in 4.0. At first I got ...
4
votes
1answer
237 views

How can I handle the combination of multiple shader effects?

To be able to work efficiently with effects, is there a good way to combine multiple reusable "base" effects to achieve a more complex final result? For example, say I have an effect that handles ...
1
vote
2answers
182 views

HLSL Multitexturing with more than 4 textures

I've come up with an idea that should work in multitexturing a terrain with more than 4 textures, up to a 64 if a supported ShaderModel is used. I'm trying to use the RGBA color values as both values ...
2
votes
1answer
246 views

Pixel Shader gradient problems

I have pretty much zero experience working with shaders as my first couple phone games were just 2d games that didn't use any sort of shaders. Now I'm working on a PC game that has a day and night ...
0
votes
0answers
258 views

HLSL Triplanar texturing and multi texturing performance

I'm stuck for my terrain rendering shader code for DX9. I'm looking to implement triplanar texturing, a texture atlas, and blending between different textures. Right now it's working. The problem is ...
-4
votes
1answer
135 views

My 2d Shader in XNA falls apart the second I put it into Farseer [closed]

I wrote a simple light shader that I tested in a simple 2d spaceship shooter and it worked fine. Once I imported it into my friend's farseer project with rotatable shapes, it doesn't seem to work ...
3
votes
1answer
143 views

Switching to a vertex shader

TL;DR I need to switch from a vertex array passed to the pixel shader with a real vertex shader approach. In my prototype, the terrain is procedurally generated and I have the following result: ...
3
votes
0answers
755 views

Loading custom shader in Monogame [closed]

I have been trying to load this custom FX file into a Monogame project, and everything I try fails. (code taken from http://www.david-gouveia.com/scrolling-textures-with-zoom-and-rotation/) sampler ...
1
vote
3answers
1k views

Methods of procedural terrain generation that can work using DirectX 9 (SM2.0)?

I'm working on a simple game / fun project that I want to be largely procedurally generated. At first I started by using boxels (Similar to Minecraft, but not textured) for the terrain and it came out ...
1
vote
0answers
145 views

BasicEffect and SkinnedEffect treating WorldViewProj differently? [closed]

I made a ModelBatch class that batches and draw rigged/unanimated and skinned/animated models. For now, BasicEffect is assigned to rigged models (XNA Model Processor) and SkinnedEffect is assigned to ...
0
votes
2answers
237 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 ...
0
votes
1answer
262 views

XNA 3D custom shader/effect gives shakey rendering in the distance

I am rendering a simple flat plane + texture to use as the floor for a game. I'm rendering it using a custom effect I've written. The problem I have is that the ground in the distance gets a bit ...
8
votes
1answer
294 views

Curious Transparent Holes Render Artifact

So I'm trying to implement "smooth" terrain in my block engine by giving each surface block a heightmap. Basically, what I do to generate these "heightmaps" for each block is I generate the heights ...
3
votes
1answer
192 views

Why are some objects not rendering properly?

Here's a button I exported from Blender into a .x format: Now here it is in the game with BasicEffect applied to everything: And now with my custom shader: And there's the problem. While the ...
6
votes
1answer
419 views

Changing water color based on depth

I'm looking to make a water shader that colors the water based on its depth. Up until now my water shader that I've used has basically been extremely reflective and only looked somewhat blue because ...
3
votes
1answer
349 views

How do I make a more or less realistic water surface?

I want to make a similar water surface like in this picture: I need the water surface in the same view than in the picture. Is it possible to work without shaders? I want to develop a little game ...
1
vote
1answer
227 views

XNA Shader Texture Memory

I was wondering about texture optimization in XNA 4.0. Will the the contentmanager send the texturedata to the GPU directly when the texture gets loaded or do I send the texture data to the GPU when ...
2
votes
1answer
384 views

assigning values to shader parameters in the XNA content pipeline

I have tried creating a simple content processor that assigns the custom effect I created to models instead of the default BasicEffect. [ContentProcessor(DisplayName = "Shadow Mapping Model")] public ...
3
votes
1answer
710 views

Monogame/SharpDX - Shader parameters missing

I am currently working on a simple game that I am building in Windows 8 using MonoGame (develop3d). I am using some shader code from a tutorial (made by Charles Humphrey) and having an issue ...
12
votes
4answers
3k views

How can I acheive a smooth 2D lighting effect?

I'm making a 2D tile based game in XNA. Currently my lightning looks like this. How can I get it to look like this? Instead of each block having its own tint, it has a smooth overlay. I'm assuming ...
1
vote
1answer
2k views

How to make 2D water like in this video?

I wanna make water and waves for my little 2D PC game like in this video: http://www.youtube.com/watch?v=ooU6cTeirlQ I don't know how to write a similar shader. Does anybody know how to write a ...
1
vote
0answers
233 views

Outline Shader Effect for Orthogonal Geometry in XNA

I just recently started learning the art of shading, but I can't give an outline width to 2D, concave geometry when restrained to a single vertex/pixel shader technique (thanks to XNA). the shape I ...
5
votes
3answers
770 views

XNA shader compiler error in release mode

I'm having a hard time figuring out if I'm doing something wrong, or if there is a bug with Visual Studio. I want to pass a float into my pixel shader, clamp it to a value, and then return it as part ...
1
vote
1answer
661 views

how to modify shadow mapping in “3D Graphics with XNA Game Studio 4.0”? [closed]

So I've been following the tutorials from the book Sean James's "3D Graphics with XNA Game Studio 4.0", and have been doing fine until i reached the shadow mapping part. in this book it creates point ...
0
votes
1answer
203 views

Drawing at negative coordinates in XNA?

I am trying to make a 2D isometric RPG and I kind of hit a wall when it comes to lighting. I was thinking of using shaders, if I manage to understand them.The problem I am anticipating is the presence ...
4
votes
2answers
1k views

XNA 4.0 - Normal mapping shader - strange texture artifacts

I recently started using custom shader. Shader can do diffuse and specular lighting and normal mapping. But normal mapping is causing really ugly artifacts (some sort of pixeling noise) for textures ...