1
vote
1answer
103 views

Tile textures on 3D models. HLSL shader code maybe?

I'm making a game in C# with XNA. I'm now applying textures to models. However if I change the scale of the model, the texture stretches with it. How can I make the texture tile over the model instead ...
2
votes
1answer
95 views

Mandelbrot generation using custom HLSL shader in XNA

So I made a Mandelbrot generator in C# and I'm learning about HLSL and custom shaders in XNA (For a college course). I was hoping to do the mandelbrot calculations on the graphics card to make them ...
0
votes
0answers
114 views

Implementing Exponential Shadow Mapping

I've been following the tutorials (link1) and (link2) to implement Shadow Mapping. However, I'm getting shadowing artifacts which are quite ugly. I've done some research, and found that ESM ...
1
vote
0answers
164 views

How do i define array in shader's constant buffer with C#?

I am using SharpDX to render 3D graphics and i cannot get to work constant buffer in my shader since it contains an array. Currently it looks like this: cbuffer cb0 : register(b0) { matrix ...
1
vote
1answer
40 views

Proper Directional light on multiple models

I've been trying to implement a Directional light into an XNA game I'm working on, but for what ever reason, I cannot seem to get the directional light to be a true directional light. Instead, I am ...
0
votes
1answer
111 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 ...
0
votes
1answer
146 views

Rendering Textured Terrain With SharpDX Toolkit [closed]

So i recently moved from XNA to SharpDX Toolkit and started with some basics. The 2d part was easy since nearly nothing has changed but im really struggeling with the 3d part. For example i wanted to ...
0
votes
0answers
88 views

Projecting shadow map

I'm having a problem with shadow mapping and don't know where to go from here. Take a look at this screenshot: The cube circled in green is the light position, the light direction is pointed ...
0
votes
1answer
284 views

XNA & HLSL - rendering a model with its original materials (colors)

I am currently trying to code my own HLSL effect file, in order to render an FBX model I made with Autodesk maya, and to which I have applied some materials (colors). before trying to write an effect ...
1
vote
1answer
473 views

Using multiple passes in OpenCL .net

I'm new to opencl but I have some experience using HLSL. In HLSL multiple passes are used when you need to finish a computation before moving on to the next step. I would like to know how this sort ...
2
votes
2answers
327 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 ...
4
votes
1answer
120 views

Masking an area inside/outside a line strip

I have some point lights in my game which are just sprites implemented with help of HLSL. Currently I'm trying to implement dynamic shadows and I managed to make the program calculate the area in ...
0
votes
1answer
124 views

How to control in the vertex shader where pixel ends up in the renderTarget?

What if I have an arbitrary renderTarget, that is smaller than the screen (say it is 1x1 pixel) and I want to make sure in the VertexShaderFunction that all my pixels end up exactly in that 1 pixel ...
2
votes
1answer
464 views

GPGPU Programming using HLSL and XNA

XNA Newbie question: I'm trying to get the GPU to perform some calculations for me. I'm trying to figure out how to send some data to the GPU, get the GPU to process it, then get the result back. ...
2
votes
0answers
285 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 ...
3
votes
2answers
420 views

XNA 3.1 to 4.0 Vertex Shader Not Drawing

I have recently been converting our XNA 3.1 game to XNA 4.0 and am stuck on the shaders. I have the game running, but nothing is drawing to the screen, except things not using a shader. This is only ...
0
votes
1answer
173 views

Volume raycaster problems HLSL

Hi this is my first question here so if I fail to include some necessary piece of information please dont rip my head off. ^^ I can't seem to get my volume raycaster to workt properly. I've been ...
1
vote
0answers
304 views

tex2dlod and tex2d giving different values [closed]

I've been having trouble with vertex texture fetch for a terrain system I am implementing. I'm using C++/DirectX9. I have already implemented exactly what I want as a prototype in C#/XNA and now ...
3
votes
0answers
468 views

How to achieve supersampling / anti-aliasing in pixel shaders?

I am trying to write a couple pixel shaders to apply to images similar to Photoshop effects. For example this effect: ...
0
votes
2answers
772 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
269 views

MultiTexturing by neighbouring points textures

Visual example: I've been trying to understand multitexturing for a while now, I've created a terrain generator but have no need for height just yet and I still want one texture to blend over to ...
6
votes
1answer
152 views

XNA Deferred + Forward, Depth Problem?

Im working with my deferred engine in XNA 4.0 and Im combining it with a forwardpipeline to support semi-transparency and other "forward only" effects. Let me describe what I do: Render GBuffer ...
1
vote
2answers
497 views

HLSL Pixel Shader that does palette swap

I have implemented a simple pixel shader which can replace a particular colour in a sprite with another colour. It looks something like this: sampler input : register(s0); float4 ...
1
vote
1answer
224 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 ...
1
vote
0answers
232 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 ...
0
votes
1answer
118 views

how to create texture for modelmesh?

Is there a possibiltiy to create a texture from a meshpart in xna. By getting a flat version of the mesh. So I can create a texture for it and edit that texture(via rendertarget)? I need to get the ...
2
votes
0answers
1k views

Why is my deferred lighting implementation so expensive?

I've implemented deferred lighting and I tried to put about 20-26 lights on the viewable space of my map, and it brings down the FPS from 61 to 28-31. It also makes my VGA temperature to go from 68°C ...
2
votes
1answer
519 views

Using SurfaceFormat.Single and HLSL for GPGPU with XNA

I'm trying to implement a so-called ping-pong technique in XNA; you basically have two RenderTarget2D A and B and at each iteration you use one as texture and the other as target - and vice versa - ...
2
votes
1answer
262 views

Shader and Custom Vertex Format Errors

I am creating an editor of sorts that allow you to create 3D voxel models. I just got started and have ran into a few errors. Here is what it is producing: I think the problem has to do with the ...
1
vote
2answers
194 views

How (if possible) would I change the BasicEffect Matrix mid draw

Say, for example, I have a list of enemies. Each enemy is a textured quad which is the stored in a singular shared VertexBuffer and IndexBuffer with the buffer usage set to BufferUsage.WriteOnly ...
1
vote
1answer
741 views

How to set TextureFilter to Point to make example Bloom filter work?

I have simple app that renders some particles and now I am trying to apply the bloom shader from the xna samplers ( http://create.msdn.com/en-US/education/catalog/sample/bloom ) to it, but I am ...
2
votes
1answer
436 views

tiled map - changing textures? (XNA HLSL)

I have successfully created a tiled map of various textures. Right now, i had a Vector4 in my own custom Vertex declaration deciding what texture each of the tiles should be. This is working ...
1
vote
1answer
684 views

Rendering fancy particles?

I'm making a tower-defense game for Windows (not phone) in XNA. I've seen this video of another tower-defense game for Windows Phone that uses particle effects, which I really like. They change ...
9
votes
1answer
3k views

Wave ripple effect?

I've been working on a tower-defense game for some time now, and so far I am really satisfied with the results. However, there's one thing I'd like to add. I've seen a video of GeoDefense for Windows ...
5
votes
1answer
692 views

Perlin noise - copying the algorithm on the CPU?

I have successfully made a Perlin noise algorithm on the GPU. It works as expected, and generates great results. Now, as part of the physics calculations in my game, I need to replicate the exact same ...
6
votes
2answers
344 views

Does it make sense to include an index for linelists?

Does it make sense to include an index by using DrawIndexedPrimitives, when using linelists performance wise? I could imagine it would be easy for the GPU to generate such indexes anyway.
3
votes
1answer
155 views

Instancing with empty data, or varying vertex counts?

I am new to game development, having only developed a few games before, in 2D space, but with 3D rendering. I have implemented instancing before, but this is only my 2nd time doing it. I have a ...
4
votes
2answers
551 views

Rendering everything with a shader when only squares are needed?

I am building a game that is tile-based (filled with glowy vector squares). Right now, I am considering using instancing for drawing these, but I would like to know if there is a faster approach. The ...
2
votes
2answers
727 views

Compatibility between DirectX 9 and DirectX 10 shaders

I am a beginner to game development and as I am used to programming in C# I decided to go for XNA. I've been playing around with it for a while and now I am learning the basics of HLSL shaders, I have ...
4
votes
2answers
2k views

C# XNA - Sky Sphere Question

I have been banging my head against the wall trying to get a sky sphere to work appropriately in XNA 4.0. I have the sphere loading correctly, and even textured, but i would like something a little ...