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

learn more… | top users | synonyms

1
vote
1answer
87 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; ...
0
votes
1answer
44 views

Iris-wipe shader not properly working

I'm working on creating an iris wipe transition, like the ones you see in old cartoons - a fully transparent circle closes on a certain point, leaving a full screen of a solid color. Additionally, the ...
0
votes
0answers
18 views

HLSL texture not reading from register S1

I made a simple post processing shader, that draws scanlines. This all works perfectly. I wanted to make it a bit more interesting by applying a shadowmask instead so I wanted to pass a texture to the ...
0
votes
2answers
49 views

How can I use an HLSL pixel shader to peek at other pixels?

I think this is like a pixilation shader but I had a hard time trying to find one online, and one that I could manipulate specifically. I want to create a pixel shader for my monogame project that ...
2
votes
1answer
1k 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
0answers
13 views

HLSL topology mismatch question

I'm trying to write a fur shader with the shells & fins technique. Currently I receive this DirectX error D3D11 ERROR: ID3D11DeviceContext::DrawIndexed: The declared input primitive type in ...
0
votes
1answer
137 views

DX9 How to Apply HLSL Shader with StretchRect

Using DirectX 9,I'm trying to run a HLSL pixel shader on video frame data while copying it from one texture buffer to another texture buffer without displaying it. StretchRect at the end is what ...
2
votes
0answers
21 views

DirectX 11 - Problem with low resolution decals

I'm trying to add a decal system in my DirectX engine but i'm facing some problems with the quality of the textures projected. Every other no decal texture look fine, but these ones look really bad. ...
0
votes
2answers
775 views

Using Appendbuffers in unity for terrain generation

Like many others I figured I would try and make the most of the monster processing power of the GPU but I'm having trouble getting the basics in place. CPU code: using UnityEngine; using ...
2
votes
1answer
293 views

Run HLSL in C++ Basic Sample

I'm considering the idea of taking shaders written in HLSL and running them in an AviSynth plugin to process videos. This would allow accessing various shaders, and also to have GPU acceleration. I'm ...
1
vote
1answer
65 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 ...
1
vote
0answers
23 views

Logical operations per component in GLSL

According to the OpenGL spec in GLSL, the logical operators: &&, || etc work between booleans, not vectors of booleans. So, what is the best way to perform the logical and/or per component in ...
3
votes
1answer
107 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 ...
6
votes
1answer
250 views

How to do Chromatic Aberration on a transparent background?

I have a problem with a chromatic aberration shader effect... If I produce the effect on a white background I get exactly what I want: But if I do the same effect on a transparent background I get ...
0
votes
0answers
13 views

How to do an xBR or hqx filter in MonoGame?

I have been trying to implement an HD filter (xBR or HQX) in my MonoGame game project but so far got no success. I have checked out this question, but the shaders provided in the answers don't seem to ...
0
votes
2answers
110 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
43 views

Purple screen when using vertex shaders

Alright, so I've tried everything I can think of. I've put in over 10 hours into this crap, but nothing seems to work (tried multiple online tutorials as well). Always purple screen. Here is the ...
1
vote
1answer
44 views

About HLSL array packing policy

This is not a question but a confirmation if I'm correct about the behavior of HLSL arrays. I'm working with a standard lighting vertex shader, HLSL plus C++, DirectX11.1 API. For storing my lights ...
1
vote
1answer
38 views

Doubts with results of per-vertex lighting shader

I'm researching simple shaders to add to my DirectX 11 project such as a per-vertex diffuse shader plus specular reflection component. I'll begin with the results: Seems specular reflection is ...
3
votes
0answers
143 views

Schlick Fresnel Shader

I hope you are all doing ok. I have an issue with my Fresnel shader that doesn't allow the Fresnel to change as my camera moves around. I'm not sure what i'm doing wrong. I'm using glsl with the ...
3
votes
1answer
64 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
2answers
203 views

Unity, shader, vertexID

I'm writing a shader and I just wanna ask if it's possible to get the ID of the vertex that is currently being manipulated. I read something about gl_vertexID, but I couldn't find out if that is ...
1
vote
2answers
45 views

Shader models, when to use “ps_4_0_level_9_x” instead of “ps_4_0”

I've made a very simple post processing shader for my 2D game. It produces scanlines by dimming every other line. For this I use the position of the pixel on the screen. When using ps_4_0_level_9_3, ...
2
votes
1answer
68 views

DX11 Losing Instance Buffer Data [closed]

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
27 views

HLSL Buffer<> Data Type

I'm working on converting a dx11 shader from a .fx file for use in Unity3D and I'm a little puzzled by the HLSL Buffer<> type declared in the shader. More specifically, what are these and how can I ...
-1
votes
1answer
48 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
0answers
41 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, ...
2
votes
2answers
119 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 ...
6
votes
1answer
181 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
61 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
1answer
182 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 ...
0
votes
0answers
74 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), ...
0
votes
1answer
57 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
60 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
74 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, ...
47
votes
6answers
24k views
-1
votes
1answer
155 views

Encoding Float to RG/RGBA and Blending

Encoding a float value inside a RG or RGBA texture is very interesting and useful but it is also become quite useless when you use blending as the result and the values might be altered because of ...
0
votes
1answer
36 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 ...
1
vote
1answer
60 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 ...
16
votes
7answers
5k views

Modern Shader Book? [closed]

I'm interested in learning about Shaders: What are they, when/for what would I use them, and how to use them. (Specifically I'm interested in Water and Bloom effects, but I know close to 0 about ...
0
votes
1answer
47 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
65 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 ...
1
vote
2answers
127 views

Will DirectCompute run this HLSL code

I found a sample about how to run a HLSL code with DirectCompute. https://code.msdn.microsoft.com/windowsdesktop/DirectCompute-Basic-Win32-7d5a7408 This is the HLSL script I want to run ...
0
votes
0answers
37 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 ...
1
vote
0answers
68 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
39 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
43 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 ...
1
vote
1answer
94 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
54 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 ...
9
votes
1answer
10k views

DirectX11, how do I manage and update multiple shader constant buffers?

Alright, I'm having a hard time grasping how constant buffers are bound to a pipeline stage and updated. I understand that DirectX11 can have up to 15 shader-constant buffers per stage and each buffer ...