Tagged Questions

SharpDX is an open-source third-party managed DirectX wrapper.

learn more… | top users | synonyms

-1
votes
1answer
25 views

SharpDx Null Reference Exception on SpriteBatch.End()

I'm trying to port a blur effect from an XNA project over to SharpDx, and I get a "Null Reference Exception" wich I'm unable to find the reason for. private void blurShadow(RenderTarget2D to, ...
1
vote
0answers
44 views

Geometry shader: Dynamic output?

I'm currently using a geometry shader to generate grass blades out of single root points that are layed out in a grid. For each root point, I generate a grass blade with, right now, a constant number ...
0
votes
0answers
18 views

Why do I get an 'invalid call' error when creating a volume texture in SharpDX?

I'm trying to create a VolumeTexture in C# with SharpDX, but it fails: var form = new RenderForm("SharpDX - Test"); var device = new Device(new Direct3D(), 0, DeviceType.Hardware, form.Handle, ...
1
vote
0answers
92 views

How to setup a particular blend state where the alpha channel is additive?

I would like to set a blend state to be "additive" and do the following: Result.R = Source.R + Destination.R; Result.G = Source.G + Destination.G; Result.B = Source.B + Destination.B; Result.A = ...
0
votes
0answers
35 views

marshaling c# struct with array to const buffer

I am trying to use a const buffer to pass a structure with an array of values into the pixel shader. However, all my color[] array values are coming in as zeros. I have the struct defined as: ...
0
votes
0answers
38 views

Depth Map not rendering properly in DirectX / HLSL / SharpDX

I've been struggling with this for awhile, and everything I find online says this SHOULD be working, but I apparently missed something. I'm attempting to run Deferred Rendering in SharpDX on a ...
1
vote
1answer
37 views

How can I fill a Color[] from a Texture2D given a Rectangle in SharpDX?

I used to fill a Color[] using XNA's Texture2D.GetData<T>(int, Rectangle?, T[], int, int) method, but there doesn't seem to be an equivalent overload on SharpDX's Texture2D. Anyone know how I ...
0
votes
0answers
34 views

How can I have an RPG character redirect / glance off stationary objects and keep going? [duplicate]

I am attempting to create an effect in a game that is identical to the effect I've shown in the attached gifs. Essentially, the character, when they are running or walking and hit an object that is ...
0
votes
1answer
72 views

How to export FBX models to use in SharpDX?

I am trying to export a model from 3ds Max 2014 as a fbx file and use it in my SharpDX driven project. In the SharpDX example solution, there is a project named ModelRendering.Desktop. I just modified ...
0
votes
0answers
17 views

SharpDX: listen to SizeChanged

I am using SharpDX and the SharpDX.Toolkit.Gameclass within a WPF-Application. The SharpDX stuff is hosted within a SharpDXElementcontrol, like this: var element = new SharpDXElement ...
2
votes
1answer
120 views

XNA/MonoGame/SharpDX: Pixel shader with sprite sheet

I've searched around for two days now on the internet but cannot find a solution. I've also read up on Pixel Shaders on MSDN with no luck. I'm trying to apply a simple pixel shader to a sprite batch ...
1
vote
1answer
92 views

MonoGame SharpDX Error 'The Parameter is Incorrect' when using graphics.DrawUserPrimitives [closed]

Below is a small section of code that is meant to draw a multicolored triangle to the middle of the screen in a MonoGame game. This uses the basic function DrawUserPrimitives to draw the triangle. ...
2
votes
1answer
51 views

Vertex definitions and shaders

I noticed that from looking at other examples like say .. riemers tutorials he takes a buffer with a bunch of vector3's in it and ties it to a shader which expects a float4 ... why does this work in ...
3
votes
1answer
102 views

How do I output a webcam stream to a 2D canvas with SharpDX in C#?

I'm writing an application for the Oculus Rift using the SharpOVR library to access HMD position data. I decided it is reasonable to use SharpDX to also output webcamera streams. Unfortunately, all ...
0
votes
0answers
66 views

SharpDx from Nuget

I'm trying to get the SharpDx DLLs from Nuget instead of accessing the DLLs directly, and it is a nightmare for me - I've spent several hours on this task already. If I do this: Create a clean ...
0
votes
0answers
29 views

Animating colors in a Direct2D Linear or Radial GradientBrush

Is it possible to change colors in a Direct2D brush once created? For example, if I create a LinearGradientBrush can I interpolate the value of the color in one GradientStop to a target color over ...
0
votes
1answer
137 views

HLSL - can't get texture to wrap or mirror

I'm currently converting an app from XNA to SharpDx and I'm therefore upgrading my shaders to version 4 (vs_4_0/ps_4_0). When using this sampler: SamplerState MySampler { Filter = ...
1
vote
1answer
65 views

Why does this no longer render the “test tri”? [closed]

So I got this code about rendering a shaded tri using sharpDX ... var vertexShaderByteCode = ShaderBytecode.CompileFromFile("MiniTri.fx", "VS", "vs_4_0", ShaderFlags.None, EffectFlags.None); var ...
1
vote
0answers
258 views

Windows Phone 8.1 emulator for DirectX landscape

July 16, 2014 update: I have converted the SharpDX "MiniCube" sample project to a Universal 8.1 project. It is 100% self-contained. It will demonstrate this issue. There is a "READ ME.txt" file ...
1
vote
1answer
156 views

How can I create a buffer suitable for dynamic updates in SharpDX?

I want to set a buffer that is updated every frame but can't figure it out, what i have to do. The only working thing i have is this: mdexcription = new BufferDescription(Matrix.SizeInBytes * ...
1
vote
1answer
72 views

Anisotropic and trilinear filtering?

I'm confused about the usage of trilinear filtering and anisotropic filtering in SharpDX. As far as i understood, trilinear filtering does linear filtering to the textures and in a case of LOD-change ...
0
votes
0answers
58 views

Pixel Shader : Backbuffer is 'Black'

After Fiddling around I am pretty sure this is not a Shader issue. Edit 4: The only diference I can see is that BasicEffect calls these methods before drawing: // Make sure that domain, hull and ...
1
vote
1answer
193 views

How do I create a camera?

I am trying to create a generic camera class for a game engine, which works for different types of cameras (Orbital, GDoF, FPS), but I have no idea how to go about it. I have read about quaternions ...
2
votes
1answer
124 views

Achieve anisotropic filtering

I want to set anisotropic filtering to my scene. I use SharpDX (DirectX 11) and C#. How do i set up anisotropic filtering in my shader? Currently i try that in the shader: Texture2D tex; sampler ...
0
votes
1answer
153 views

Multiple joysticks event handling

I want to make a game which is totally same idea as "Who pressed the button answers the question". I have 2 joysticks and both are connected to a pc. My application will be Winforms and I will ...
1
vote
1answer
246 views

How do I set up a depth buffer in SharpDX?

I draw some instanced cubes, but when i rotate the camera (or the world) some cubes that should be behind other cubes are drawn before the cubes. I already had this issue a long time before and i ...
1
vote
2answers
370 views

Drawing cube in SharpDX, wrong perspective

I want to draw a cube. This is what i currently have: As you can see, the perspective is VERY wrong. The the size in the z-direction is too small and the difference between the front and back size ...
2
votes
2answers
123 views

Properly rendering transparent areas of textures

I'm rendering a tree that contains branch meshes with partially transparent textures. If I render it with AlphaTestEffect and set the ReferenceAlpha to something low, I'll get this. I want to ...
2
votes
1answer
97 views

Camera roll has no effect

Consider my following (abstracted) C# w/ SharpDX code: class Game { Camera _camera = new Camera(); private void Window_KeyDown(object sender, KeyEventArgs e) { // Roll if ...
0
votes
2answers
351 views

SharpDX.Toolkit setting constant buffer

I am trying to use a constant buffer in a program using SharpDX.Toolkit. I use the Toolkit because it has nice font support for writing on the screen. The problem I face is in assigning data to the ...
0
votes
0answers
101 views

class instance issue

Currently, i am working on a project which deals with several parts. First, I want to interface with a Sidewinder Force Feedback 2 joystick in Unity using SharpDX and SharpDX.DirectInput libraries. ...
4
votes
1answer
546 views

How do I convert a .dds texture to .png bitmap in C#?

This question is from someone who has not written a line of code for games, but several Game Save editors and other game tools. I'm working on a Save Editor and would like to display icons of some of ...
1
vote
0answers
380 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 ...
4
votes
1answer
362 views

How to debug DXGI_ERROR_INVALID_CALL errors?

I am developping an application using SharpDX and on one of my machines the call _swapChain = new SwapChain(factory, _device, desc); fails with the error message HRESULT: [0x887A0001], Module: ...
2
votes
3answers
574 views

SharpDX/D3D: How to implement and draw fonts/text

I am playing with SharpDX (Direct3D for .NET) without using "Toolkit", already finished with basic rendering 3D models. But now i am wondering how to program/create fonts for game (2D), or how to ...
2
votes
1answer
187 views

Is there a penalty to using render targets versus textures?

I figured that the best way to ship 2D art for multiple resolutions is to instruct my artist to create the fullscreen background images sized for the highest resolution and then scale them down during ...
0
votes
1answer
238 views

From Position/Target to Orientation/Elevation

I have an orbit camera class that calculates the camera position from Orientation/Elevation and distance from target. I decided to replace these initial values for the camera instantiation with simply ...
1
vote
1answer
680 views

How to set shader global variable in sharpdx without using Effect class

I am working with SharpDX, i thinking to try using (uniform) global variables for HLSL constants instead of constant buffers. But, in my code SharpDX's Effect class is not used: i use PixelShader ...
1
vote
1answer
196 views

Read part of texture using SharpDX

I have a Texture3D. I want to read a part of it from CPU side. (I'm using the SharpDX toolkit (v2.5.1).) My data is always 0, but the output shows no errors. This is the source texture: testTex = ...
0
votes
1answer
369 views

Instancing with the SharpDX toolkit

I am starting on the graphical portion of my project and before I begin I need to get Instancing working. I can do instancing with SharpDX, but not with the Toolkit Models. The main reason I want to ...
0
votes
1answer
209 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
41 views

IndexedInstanced logic

I'm using SharpDX.Toolkit with three buffers: two vertex and one index buffer. The first vertex buffer is bound to slot 0 for per-vertex data with following data: static VertexPosition[] vertexData = ...
1
vote
2answers
282 views

Anti-aliasing a sphere

I render everything in my game in 2D with SpriteBatch with the exception of a spherical entity (orb) that I render as a spinning and dynamically lit (custom effect) sphere in 3D. I capture the sphere ...
0
votes
1answer
141 views

Why divide by w makes the pixel shader look better?

I'm writing a shader in HLSL (Direct3D11 with SharpDX) and after some computations I was trying to make a test and print the depth z of a specific point in my pixel shader, like this: myZ = ...
-1
votes
1answer
192 views

SharpDX instancing with D3D11

Could anybody provide working code using SharpDX with D3D11, which does instancing and uses SharpDX's content pipeline? I have several problems there. I came to understand that one should use a ...
1
vote
1answer
179 views

ShaderBytecode Compiler one technique multiple passes

I have an effect code with a basic structure like technique TechniqueName { pass FirstPass { Profile = fx_4_0 VertexShader = RenderFirstVS GeometryShader = null ...
0
votes
1answer
76 views

How do I upscale my scene to a larger viewport?

I want to: Render my scene to a small viewport (some divisor of the full screen size). Stretch the rendered image to cover the full screen size. For example I want to render a complex, very slow ...
0
votes
0answers
179 views

When should I set a texture as a shader resource in order to read it?

I'm writing a Direct3D 11 HLSL shader with SharpDX. What I want to do is write the depth to a texture in one pass and read it in the next one. After declaring the texture, do I have to set the depth ...
1
vote
2answers
395 views

What is the depth that a pixel shader may output? Is it necessary to write Depth?

In DirectX11, what does the depth that a Pixel Shader can output mean? Does a pixel shader need to output a depth so that we "write" the depth? If not, why would we output it? For any doubts, I'm ...
0
votes
1answer
380 views

How to print Depth to a Texture2D and then read it in the next pass on a shader in DirectX11

I'm programming a two-pass effect in DirectX 11 (SharpDX). It's supposed to write the depth to a texture in the first pass and then use that texture to extract data on the second one in the pixel ...