A proprietary shading language developed by Microsoft for use with the Microsoft Direct3D API.

learn more… | top users | synonyms

0
votes
0answers
19 views

Sampling in the Compute Shader not working

I'm trying to sample a image in the compute shader. My code is [numthreads(1, N, 1)] void VertBlurCS(int3 groupThreadID : SV_GroupThreadID, int3 dispatchThreadID : ...
0
votes
1answer
56 views

How do I build a 3D array result set from a compute shader in unity?

I took this right down to the absolute most basic scenario but for some reason I can't get anything back from the GPU when this completes, could someone explain what I am doing wrong ... Here's my ...
0
votes
0answers
18 views

Parallax Occlusion Mapping using Shared Sampler

I'm using the Unreal Engine 4. So here is some custom node code that is supposed to achieve POM: while (i<MaxSteps+2) { texatray=dot(HeightMapChannel, ...
0
votes
0answers
27 views

How can I write the depth buffer to a texture in D3D?

How can write the depth buffer to a texture? I see a lot of OpenGL examples, but I'm looking for one using Direct3D 11.
6
votes
1answer
157 views

How can I speed up this HLSL shader?

I have written a lighting shader file that is used as the fragment shader part of a deferred lighting pipeline. Unfortunately, each iteration seems to be adding 0.5ms to my frame time, so any more ...
3
votes
1answer
50 views

2D deferred lighting calculations not working

I have the following code for my HLSL pixel shader. Modified from another post here on GameDev (Link), but I have a few problems with it: // calculate UV and get texture and normal. float2 UV = ...
0
votes
0answers
21 views

Monogame Vertex Shader Hassle

I'm currently creating a game in Monogame 3.4. I've written a relatively simple pixel shader in HLSL which works perfectly fine under Windows DX. When I use the same shader under Linux (OpenGL), ...
3
votes
1answer
37 views

Vertex normals in the geometry shader using directx

I'm in directx 11 with the geometry shader. Is is possible to calculate vertex normals? Just one like segment per vertex? In the geometry shader? I did vertex normals per face, this is what I got, ...
1
vote
1answer
44 views

Multitexturing depending on given variables?

Im having trouble with rendering multiple textures. Using XNA gamestudio: working with 3D meshes and texturing. Effect.fx HLSL I do have a map/level that loads from a heightmap. - This works I have ...
0
votes
1answer
20 views

Distance per mesh in HLSL directx

I'm subdividing a sphere so when distance gets greater, the sphere is subdivided less to save memory. The sphere changes to another sphere when the distance is 10. My problem is that only one ...
1
vote
2answers
42 views

Subdivision of a triangle in HLSL

How can I subdivide a triangle more than once. I can not use recursion as directx 11 hlsl will not allow it. Are there any links to a HLSL code. This has to be done in the geometry shader as my book ...
0
votes
1answer
35 views

Automapping of the noise texture onto 3D model

I want to apply kind of noise/dust texture to objects so it would look good, and make it without having UV mapping in models. This is because I want to have a possibility to apply this to any objects, ...
1
vote
1answer
37 views

HLSL pixel inside a view (cascaded shadowmapping)

I'm figuring out shadowmapping in HLSL (see also this question). I understand that I need projection matrices for each cascading shadowmap. I use this code to create the projections: Matrix ...
0
votes
1answer
34 views

XNA Texture2D Copy Error

I have a static class that I use to build a 3d character and render the results to a RenderTarget2D which I then return. I'd like to store the results for later use so I need to make a copy of the ...
0
votes
1answer
35 views

Pixel Shader from Visual Studio Graphics Diagnostics

i want to check my pixel shader variables in graphics diagnostics but unfortunately when i click start debugging in pixel history (mentioned below), a new tap will open and says source is not ...
3
votes
1answer
48 views

Issues with depth calculation in HLSL shader

I'm currently trying to implement shadow maps in my graphics framework. I ran into an issue with depth calculations I wasn't able to solve myself (yet). I did a lot of testing and debugging and think ...
0
votes
0answers
26 views

How do I set an array of matrices in HLSL?

I'm trying to render skinned meshes using Direct3D9 and HLSL. I am getting unexpected results due to the transforms that are bound to the shader. I am using PIX to view the constants and the values ...
2
votes
1answer
51 views

DX11 Losing Instance Buffer Data

I've got a function that basically creates different instance buffers into an array for me to use in my DrawIndexedInstanced call. But when I pass the vertex buffer and instance buffer through to my ...
1
vote
0answers
47 views

HLSL screen-space to world-space

I'm trying to use RenderDoc to understand how a DirectX11 game engine's vertex shader works, and ultimately recover the world-space positions of vertices. I have captured a frame using RenderDoc, and ...
1
vote
0answers
36 views

applying two Vertex shaders on two model with the same pixel shader

i want to apply two HLSL vertex shader on two different models but with the same pixel shader. what i've done is wrong but i didn't know how can I use both vertex shader with one pixel shader (and i ...
3
votes
0answers
37 views

Perspective division by zero yields unexpected results

Usually, this is how a shape in clip space is defined: [0.25, 0.25, 0.0, 1.0] [0.25, 0.75, 0.0, 1.0] [0.75, 0.75, 0.0, 1.0] [0.75, 0.25, 0.0, 1.0] After perspective division to NDC space the result ...
3
votes
1answer
55 views

How to write a custom shader in Unity 3D that lights up a specific pixel or group of pixel?

I'm making a FPS game in Unity, and I want the environment to light up as the player is shooting on his environment. The map would be entirely put in darkness at the beginning, but as the player ...
2
votes
2answers
93 views

Draw 3D ellipse in monogame/xna

I am programming a 3d solar system (simulator). To describe the path of a planet I wanted to add 3D rectangles.. and draw them. But this ; no surprise; decreased the frame rate extremly. Also it does ...
1
vote
1answer
48 views

Shader and Texture Scrolling depending on Direction

I am trying to scroll a texture using its uv in Unity but I don't get the result I need. The aim is to have two components, the speed and the direction. I would like to define the direction in ...
1
vote
0answers
39 views

Textured trapezoid in Monogame DirectX

I'm working on a 2D game, so most of the graphics are sprites. However, some elements are drawn using trianglestrips in Orthographic projection. The thing is that I can't do a 3D projection because ...
1
vote
1answer
52 views

ID3D11Device::CreateInputLayout: Encoded Signature size doesn't match specified size

I get [ STATE_CREATION ERROR #161: CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE] with the following code: // Vertex data struct VertexData { XMFLOAT3 v; XMFLOAT2 vt; XMFLOAT3 vn; }; // ...
1
vote
0answers
58 views

Open Borders in Fluid / Smoke Simulation

I am trying to adopt a fluid / smoke simulation based of the source files of this video to my needs but came across a few problems when trying to make it open at the borders (flows into the void). ...
1
vote
1answer
51 views

View Matrix to Texture Matrix

I'm converting view coordinates to texture coordinates for both my shadow maps and Screen space reflections. I keep seeing this conversion in examples: var T = new Matrix { ...
0
votes
2answers
52 views

Shader value remap - Blend Falloff

I would like to know if there's a way to remap a value that goes from 0 to 1 constantly like this. Into those values (those are examples). This might be some function transformation but I can't ...
0
votes
1answer
50 views

How to determine vertex index using Shader Model 3 or lower?

I need something like SV_VertexId (added in Shader Model 4) in HLSL shader to determine which vertex is currently handled. Unfortunatelly, I can compile only vs_3_0 or lower. The objective is to ...
0
votes
0answers
38 views

HLSL Vector Addition - Getting Zeroes

I have the following line in HLSL: result.Color.xyz += nM * stepVal nM is a float3 and stepVal is a float. result.Color is a float4. When nM is {0.0, 0.0, 0.0} however I'm seeing odd behaviour. ...
0
votes
0answers
90 views

Screen Space Reflections

Screen space reflections seems very straight forward but for some reason I'm struggling with this. My GBuffer is in View space and depth is z/w. float3 ViewSpaceToScreenSpace(float3 viewSpace) { ...
0
votes
2answers
244 views

Textures rendering upside down and small with Pixel Shader in Mono Game but not XNA

I'm new to HLSL, attempting to use MonoGame to do some simple post processing effects. Here is my HLSL file, taken from one of rbwhitaker's xna tutorials (I would post the link, but can't post more ...
0
votes
1answer
43 views

D3D12 ConstantBuffer - Shader receives wrong values

im having trouble with one constantbuffer: struct CameraConstData { urd::Matrix projection; // 64 ( 16 floats) urd::Matrix view; // 64 ( 16 floats) urd::Vec3 viewPosition; // 12 ( 3 ...
3
votes
1answer
65 views

Do shader compilers typically know not to look up unused texture channels?

I have a texture that's from the color attachment of an FBO in OpenGL ES 2.0, so I have limited control over the number of channels in the image. Suppose I only need the color from the R channel of ...
1
vote
1answer
68 views

DirectX11 - AlphaBlending Rendering problem

So.. I completed this tutorial on the following site rastertek.com/dx11tut12.html. The tutorial is all about rendering Text in an orthographic space. Basically just 2D rendering on DirectX 11. Now ...
0
votes
0answers
38 views

My texture is doing weird, either not loaded correctly or not rendered correctly. DirectX11

I'm loading a texture from a file called owl.png. But it renders really weird. Original picture(512 X 512): But it renders like this: It's rendered on a square, that is initialized like this: { ...
0
votes
1answer
128 views

The Pixel Shader unit expects a Sampler configured for default filtering to be set at Slot 0 […]

I don't understand this error. The full output being : The Pixel Shader unit expects a Sampler configured for default filtering to be set at Slot 0, but the sampler bound at this slot is ...
1
vote
1answer
66 views

Why isn't my cbuffer updating?

I am really frustrated because my cbufer isn't updating. This is my VS: cbuffer MatrixBuffer: register(b0) { float4x4 worldViewProj; }; struct VertexIn { float4 Pos : POSITION; float4 Color: COLOR; ...
7
votes
1answer
470 views

Strange SSAO effect (wrong position/normal textures in view space?)

I try to create an SSAO effect in my game engine (DirectX 11, C++), based mainly on gamedev.net tutorial by José María Méndez. Unfortunately, it doesn't cover texture-creating problem (normals, ...
1
vote
1answer
129 views

How to pass a big (60+) amount of variables to an HLSL pixel shader?

I am in trouble at trying to pass a big amount of variables needed for my pixel shader computations. After trying and failing to link my struct to a cbuffer (data alignement mismatch) I tried passing ...
2
votes
2answers
303 views

C++ struct doesn't align correctly to a pixel shader cbuffer

To expand from my previous question, I must add I can't correctly map my C++ structs to a corresponding cbuffer inside the pixel shader. When outputing random colors defined in the struct C++ side, it ...
4
votes
2answers
597 views

Mapping a C++ struct to an HLSL cbuffer

Out of curiosity (and peace of the mind...) I wondered how DirectX decides which attribute from a struct corresponds to the right variable inside an HLSL cbuffer-register(x) (apart from the order/type ...
1
vote
1answer
46 views

How to correctly pass multiple light structures to shader stage?

I'm having some problems when passing multiple light structures to a shader stage. I'm using an array of point lights that is updated each frame. This is my code for creating the buffer ...
1
vote
0answers
60 views

How do you fix wobbling shadow edges?

I've implemented an omni-directional shadow map and I've noticed a rather unwanted behaviour on the shadows. It seems like when the angle between the occluded points and the light source is really ...
2
votes
0answers
88 views

How do I sample a cubic shadow map in DirectX 11?

I've implemented a cubic shadow map for dealing with omni-directional light sources in my scene. By defualt it produces hard shadows Obviously a shadow map with higher resolution (currently using ...
0
votes
1answer
76 views

Pass-through pixel shader not displaying properly

I'm new to shaders, HLSL and XNA in general. I'm trying to write a pass-through pixel shader but I'm experiencing some odd behaviour. I created a simple texture, shown below: Here's what I see when ...
1
vote
1answer
160 views

What's wrong with my HLSL depth shader?

I'm trying to render depth texture in XNA 4.0. I'm read few different tutorials several times and realy cannot understand what I'm doing wrong. Depth shader: float4x4 WVPMatrix; struct ...
0
votes
0answers
29 views

Device.SetRenderTarget Prevents Shader From Executing

Using DirectX 9 and C++. I'm trying to finalize this code to run a HLSL shader on in-memory data. In theory it should be working. In practice the shader doesn't run. ...
0
votes
1answer
118 views

How to Set HLSL Shader Input Textures?

Very simple question. With C++/Direct9, I'm creating a texture as RenderTarget with a full screen quad, creating a scene, setting a HLSL pixel shader, copying the image and then call Present. 1) How ...