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

learn more… | top users | synonyms

0
votes
0answers
14 views

HLSL Function Problem

Right now I am trying to implement Specular lighting in my DirectX Engine. Whenever I create the DirectSpecularBRDF function in my .HLSL file, my program crashes. Can anybody help me? The problem is ...
0
votes
1answer
19 views

Problem with Basic Diffuse Lighting

So recently I have been learning how to implement Diffuse Lighting in DirectX and I have done so with the following code: float4 PS(VS_OUTPUT input) : SV_TARGET { input.normal = normalize(input....
0
votes
0answers
30 views

Using typed buffers with the compute shader (HLSL, C++)

I've been using Introduction to 3D Programming by Frank Luna to introduce myself to graphics programming. In the compute shader chapter exercises, we're asked to make a program to input 64 vectors and ...
3
votes
2answers
29 views

How to force XNA to render model very far away as a light dot?

Making a space strategy game focusing on commanding a large fleet, with 1000+ ships per side.(I'm new in XNA 3D...below is a test screenshot. The ships will be scaled down another 2-5 times) When a ...
6
votes
1answer
113 views

What are screen space derivatives and when would I use them?

I see the ddx and ddy glsl functions and the hlsl equivalents come up in shader code every now and then. I'm currently using them to do bump mapping without a tangent or bitangent but I basically copy-...
1
vote
2answers
66 views

Problem with Diffuse Lighting

So I am currently implementing Diffuse & Ambient Lighting based off this tutorial: https://www.braynzarsoft.net/viewtutorial/q16390-simple-lighting I think I have implemented everything correctly,...
2
votes
2answers
54 views

Why does VertexPositionColor seem incompatible with Monogame?

This question is a continuation of What causes this InvalidOperationException when drawing primitives?. I've been dealing with HLSL shaders in Monogame over the past few days. It has been extremely ...
0
votes
2answers
39 views

What causes this InvalidOperationException when drawing primitives?

I'm working on implementing a 2D masking effect in my current game. To do so, I have two textures, one for the source image and one for the mask. The source image is just a regular texture, so that's ...
1
vote
1answer
38 views

HLSL texture sampler always returns white

I'm facing in problem in HLSL with Monogame that I can't figure out. The gist is that sampling from a texture seems to always return white rather than the texture's actual color. My pixel shader code ...
-1
votes
2answers
44 views

How do .HLSL files work together compared to .FX?

So I have been slowly reading and working through Frank Luna's D3D11 book which uses the .FX file format which uses effects, techniques and passes which I understand now. However I have read online ...
1
vote
1answer
42 views

How do multiple shaders in a DirectX Engine work?

So as I have been learning DirectX 11, I have been looking at a few tutorials online and in the sample code provided there are more than the usual pixel and vertex shaders (along with the geometry ...
0
votes
1answer
19 views

Monogame HLSL GBuffer Depth Mysteriously Colored Red

I was working through an older tutorial listed here, and got it to work for the most part. The RenderTarget for Depth is colored red for some reason, and I've been scratching my head trying to figure ...
0
votes
0answers
34 views

DX12 Domain Shader texture mapping using WRAP despite setting CLAMP on AMD hardware

My application works fine on my NVidia GTX 960, but my AMD Radeon R9 380 is incorrectly setting the address mode to WRAP, despite setting it as CLAMP in my application. This totally caught me off ...
0
votes
1answer
80 views

Need an example of a HLSL Compute Shader

I'm finding Compute shaders very confusing. I was wondering, if I were to provide an example, and maybe one more later, if someone could demonstrate how to convert it into a Compute shader for D3D11? ...
1
vote
1answer
54 views

Check if vertex is visible in shader

Im trying to figure out when a vertex is visible from the main camera. I have this function: bool in_frustum(float4x4 M, float4 p) { float4 Pclip = mul(M, float4(p.x, p.y, p.z, 1.0)); ...
-1
votes
1answer
89 views

Volumetric Lighting/Light Shafts in DirectX

So currently I am trying to implement Light Shafts into my DirectX Engine. I read the Nvidia GPU Gems Article (http://http.developer.nvidia.com/GPUGems3/gpugems3_ch13.html) I am new to Graphics ...
0
votes
1answer
51 views

Getting the material name or index from a Blender FBX model in MonoGame

I've imported Blender FBX models in to UE4 before, so I'm aware that some of the material information is saved in the model. How do I go about accessing this in MonoGame? To be clear, I don't ...
0
votes
1answer
25 views

XNA HLSL Shader Color Swapping based on lightness

I'm trying to achieve a similar effect to the image below in HLSL. [Ignore the inbetween state, currently I'm only trying to achieve the final phase, which is black and red] What I tried so far is ...
0
votes
1answer
84 views

HLSL SetVertexShader Texture2DArray Sample

I want to do some texture samples in the vertex shader, but it seems this cannot be done in the same was as when using the Pixel shader. The code is basically.. Texture2DArray gTexture; VS() { ...
2
votes
2answers
160 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 ...
1
vote
0answers
35 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 ...
1
vote
2answers
185 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
0answers
31 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. ...
1
vote
0answers
47 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 ...
0
votes
0answers
36 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
0answers
46 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
135 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 ...
2
votes
1answer
444 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 ...
1
vote
1answer
47 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 ...
2
votes
2answers
113 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, ...
1
vote
0answers
46 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 ...
0
votes
1answer
50 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 ...
6
votes
1answer
315 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 ...
-1
votes
1answer
84 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
2answers
228 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
94 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, Tex.SampleGrad(TexSampler,UV+offset,InDDX,...
6
votes
1answer
226 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 ...
4
votes
1answer
95 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 = Input....
0
votes
0answers
141 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
115 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
94 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
85 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
75 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
102 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
107 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
37 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
53 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
117 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
50 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
77 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 ...