Questions tagged [hlsl]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
29 views

How to set root signatures specified in HLSL in my command list?

From Microsoft Docs, I can specify the root signature of my shader in HLSL. How do I use it though? Since at the beginning of the command list, root signature is undefined. I need to use ...
-1
votes
0answers
29 views

HLSL Directional light with shadows

I'm trying to lit a scene with a directional light and also cast shadows from it. My HLSL Shader looks like this… ...
0
votes
0answers
29 views

HLSL Xna Deferred light issue

My point lights seem to have problems when the camera is far away… is it the depth map? Anyway i'll show you the code Here is my GBUffer fx : ...
0
votes
0answers
20 views

SSAO in my unity games has flickering lines at the top and right side of the screen

I've tried both the built-in unity ambient occlusion that comes with the post-processing stack, as well as another one ported from the Microsoft MiniEngine by someone: https://github.com/keijiro/...
0
votes
0answers
24 views

HLSL : Offset and length were out of bounds

...
0
votes
1answer
61 views

Strange diagonal line artifact in simple ripple shader

I have a simple shader, converted from GLSL to HLSL. This is the original: https://www.shadertoy.com/view/tdKSWG The problem is that there is a very visible diagonal line artifact going from UV(1,1) ...
0
votes
0answers
42 views

Reconstructing Position from Depth - Inverted Y?

I am currently trying to understand the following wierd result. This is basically from deferred shading in monogame/XNA. For Comparison I also write the ViewSpace Position in a Buffer and the ...
0
votes
1answer
37 views

Recalculating normals on a tesselated cubed sphere with heightmap applied

I'm learning about the graphics pipeline using C++, HLSL and DirectX 11 for my course. I'm currently tesselating a cubed sphere with an applied height map. My issue is figuring out how to recalculate ...
1
vote
0answers
39 views

How can I unpack texture data following a 16 * 8-bit pattern?

Is possible to unpack texture data following a specific bit packing scheme? I have read that texture data in HLSL can be read in as 4 floats of 32 bits each totaling 128 bits. The packing scheme I'm ...
0
votes
0answers
53 views

Simple water reflection is going wrong

i added simple code to my water shader that should add reflections of objects above the water line. The problem is that the reflection is only correct when the camera is in a certain angle to the ...
0
votes
1answer
74 views

Shaders and Distortion Effect (Monogame)

I am building a top down 2D space shooter game with sandbox elements. I am working on the shield for the spaceship now and am not having luck. I am attempting to make a distortion effect shader, but ...
0
votes
1answer
43 views

Writing Hull shader in directx

hey i am studying different types of shaders in directx. and it comes to hull shader. so i write hlsl codes for both constant hull shader and control point hull shader in same file in visual studio ...
0
votes
2answers
44 views

How to write properly shader with gradient based on vertex-color?

I took 4 squares with the outer corners painted in black, and the other ones in white. For some reason, they have a different gradient. ...
0
votes
2answers
109 views

HLSL - Shore fading in a water shader

in my desperation while trying to achieve this (I am a HLSL noob) i try to ask my question here. I am modifying an old water shader for the game "MTA San Andreas" (the multiplayer modification). MTA ...
1
vote
1answer
67 views

Problems implementing shadow maps in directx

I am trying to implement shadow maps in my Dx11 rendering engine. I created a shadow map texture2d, a shader resource view, a depth stencil, a viewport, and a rasterizer state, as recommended by ...
0
votes
0answers
32 views

Pixel Shader Displacement and Lighting

I'm doing some displacement mapping on a grid. Ambient light works well as seen in the picture but I cannot get the directional light working. When adding directional light, grid is yellow in color. ...
0
votes
0answers
55 views

Shader code not working

While compiling the following code. I get a error ...
0
votes
1answer
48 views

Rotate mesh to normal

I have some instanced geometry (basic tube meshes) laid out in a grid, and I have a noise texture (normal map) that I want to use to rotate my instances with. So head pixel in my texture is a normal ...
1
vote
1answer
58 views

Rendering colors from a texcoord output

I'm trying to implement a faster alternative to super-sampling for my isometric 2d monogame game (for when the view is zoomed out). The idea was that I would render the texture coordinates to the ...
0
votes
0answers
31 views

HLSL Texture Sampling Instability

I'm having some very strange behavior trying to calculate gradients in a shader. In both snippets, uv is the texture coordinate, duv is a float3 proportional to (1/width,1/height,0), c is tex2D(...
0
votes
1answer
30 views

Sampled texture from bitmap font produces blue glow

I'm creating a texture is DirectX 11 from bitmap fonts. I realize that I can use DXTK, but this is an exercise for me, not in learning another library. My sample code looks like this. ...
0
votes
0answers
34 views

Lighting abnormal when calculating in tangent space. Probably something wrong with coordinate transformation matrix

I'm trying to calculate lighting in tangent space. But I just keep getting abnormal results. I was modifying the book's demo code and I wander if there maybe something wrong with the transformation ...
1
vote
0answers
71 views

HLSL DXGI_FORMAT_A8_UNORM Texture - dark colors appear less opaque than white

I am trying to render a DXGI_FORMAT_A8_UNORM texture (precisely, a font bitmap) in multiple colors by specifying the color per vertex and then apply the alpha value ...
1
vote
1answer
94 views

how are semantics used when declaring a struct?

I don't understand how semantics are used in shaders. While reading Unity's shader tutorials, I come across this ...
0
votes
0answers
52 views

Calculating UV Coordinates in domain shader

Dears, I was trying to implement the terrain tutorial in Introduction to game programming by frank luna. I succeeded to implement it using the effect file. When I try to separate the Vertex, hull, ...
0
votes
2answers
241 views

Raymarching signed distance function resulting in holes on surface - step size required?

I've been learning about raymarching and signed distance functions, and I implemented a raymarching fragment shader in Unity. It works fine for geometric shapes such as cubes and spheres, but when I ...
1
vote
1answer
103 views

HLSL equivilant to “Object” data from “Texture Coordinate” node in Blender

I mocked up a shader how I wanted it with the node editor in Blender. Now I'm trying to write it in HLSL. In Blender there is a node group called "Texture Coordinate". If I use the "uv" node from the ...
1
vote
0answers
64 views

Alpha is not working in diffuse light shader

I am following this tutorials series on rastertek.com and I got a bit stuck on the Diffuse Lighting Tutorial. Particulary, the part that does not work for me is alpha channel of the light color. Here ...
0
votes
1answer
49 views

Steering constantly turning in circles

I've been working on a fish system in a compute shader but bugs have been drowning me. The latest bug had me strip almost all the functionality to track down: Fish keep turning in circles. It starts ...
13
votes
1answer
596 views

How can I make outline shader like “Life is Strange”?

I want to make sketch shader like life strange. shader has two part: 1.animated dashed line 2.noisy outline I like to know how can I make noisy outline? see outline of objects First I tried to ...
1
vote
0answers
181 views

Hard coded triangle in HLSL geometry shader doesn't show on screen

In Unity I'm planning on using a geometry shader for processing points into quads and can't quite figure out why I'm not getting output from my geometry shader. I've edited it down to a minimum ...
3
votes
0answers
129 views

Trying to get Vertexshader to work Monogame 2D

If I don't use the vertex shader, it gives me white textures which is what the default color is. Once I add the vertex shader, the screen is black. I figure it is something wrong with the Matrices I ...
0
votes
1answer
280 views

Texture Atlas and HLSL Shader for sprite tiling

I am trying to create a shader that allows to tile a specific region of a texture. This seem to be a common need however I can't seem to find any information about how to get this effect done. The ...
0
votes
1answer
46 views

Combination Lighting Shader?

I am currently working on writing a shader for combination lighting. The idea behind it is to apply directional light, point light, and spot light in a single pass. I believe I can do this by: ...
0
votes
1answer
51 views

Typical Point Light Flow?

A Quick Note This question assumes you have some knowledge about the overall rendering process and do not need clarification on rendering objects with HLSL and a <...
0
votes
1answer
69 views

Why does order matter in constant buffers?

I have a rather peculiar question remaining after solving most of my own question on StackOverflow. When creating the constant buffers used by my shaders, I've learned that the order of variables ...
0
votes
1answer
274 views

HLSL Manual Alpha Blending

I'm trying to do alpha blending manually because I only want to apply alpha blending on certain pixels. Underlying is the texture I'm writing to. This is what I got so far, but it doesn't give the ...
0
votes
1answer
233 views

DirectX 11 Compute Shader error DXGI_ERROR_DEVICE_HUNG

I am trying to use a compute shader for ray picking technology. My shader accepts: vertex buffer of all models index buffer of all models a buffer of transformation matrices of all models Offset ...
0
votes
2answers
90 views

Extracting individual components of a vector in the Source Shader Editor

I'm using the Source Shader editor and would like to mask a vector output to one or two values, yet there is no existing mask node, as far as I can see. What HLSL code should I use to output what I ...
1
vote
1answer
123 views

What does vertex:disp and tessellate:tessEdge mean? [Shader] [Unity]

I came across the following declaration on unity tutorial #pragma surface surf BlinnPhong addshadow fullforwardshadows vertex:disp tessellate:tessEdge nolightmap ...
0
votes
1answer
147 views

Difference between texture.Load and texture.Sample(PointSampler,..) in HLSL/Dx

Conceptually, I understand the difference between load and sample but I want to know if essentially point sampling and load do the same thing when it comes to selecting a texture value (ignoring an ...
1
vote
0answers
183 views

Is there a quick-reference card for HLSL (DX9 or DX11)?

Does anyone know of a DX9 or DX11 counterpart to the GLSL quick-reference card from Khronos? The GLSL card is pages 8-11 here, and lists preprocessor directives, operators, types, and builtin ...
0
votes
1answer
397 views

HLSL float bitfield

In HLSL I want to store a bitfield for each color in a texture. Specifically spanning 3 floats (RGB, not alpha). Since each float has to be between 0 and 1 I can only use the significand/mantissa of ...
1
vote
2answers
873 views

2D Blizzard/Snowstorm Effect

How can I implement a blizzard/snowstorm effect in a 2D platformer? I have a particle system for snow particles, but I need some kind of windblown texture similar to this as well: How do I create this ...
0
votes
1answer
170 views

Using multiple textures in Monogame HLSL Effect shader?

My Monogame HLSL shaders only successfully sample one texture (besides the screen). Any additional textures I try to sample end up with the same texture data as the screen. I've found people with ...
0
votes
2answers
95 views

2D Camera Movement Temporal Reprojection

Having an Orthographic Camera with its View Projection Matrix given from the current and last frame, how to reproject the previous frame to the new one?
1
vote
0answers
37 views

Effective way of transferring data to HLSL shader in MonoGame and storing it

I'm toying around with HLSL shaders in monogame. Lets say I want to use a structure in my shader which is like this: ...
0
votes
1answer
80 views

Difficulty with Texture Alphas - HLSL

UPDATE 3: I have fixed the issue by reordering my effects (see my answer for details.) Anyone who wants to post more information based on that answer (either in an answer or in the comments) would be ...
0
votes
1answer
737 views

HLSL registers and slots

I'm learning DirectX11 and since I'm beginning to write some shader code I don't understand the difference between binding slots and HLSL registers. The shader model 5.0 introduced the keyword ...
0
votes
0answers
54 views

Projective texturing in DirectX11

I'm trying to implement reflections on flat surfaces and render a simple scene with a reflection. So I'm rendering the scene from the point of view of a camera symmetrical to the reflection plane and ...