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

If I use vertex shader to do all operations on object, then constant buffer can be empty?

The program cycle is Update(); UpdatePipeline(); In Update() constant buffer for each object, that after transformations, has ...
0
votes
1answer
50 views

Generating normals from terrain heightmap

I am drawing my terrain by rendering a static quad mesh several times and then displacing vertices using a heightmap. As such I need to generate normals. I am primarily interested in quality over ...
0
votes
0answers
20 views

What is the right way to access raw data from an Unreal material's output?

I am using an Unreal material not so much as a material but essentially as a compute shader for performance reasons (using the Custom nodes in a material blueprint), where I perform a bunch of per-...
0
votes
0answers
14 views

Setting and using a dynamic variable inside an Unreal material

I have an Unreal material that contains a custom node (with HLSL code) - where a condition involves comparison with a matrix of values that was computed in the previous time step. How can I create ...
0
votes
0answers
22 views

How can I sample from a normal distribution in HLSL?

I need to 'distort' individual pixels inside a compute shader node of an Unreal material. Specifically, the pseudocode for this per-pixel operation looks as follows. ...
-1
votes
0answers
20 views

Shader /w custom render texture works in the editor but it is black on iOS

I am using some shaders for painting. Everything works fine in the editor and on Android except for iOS. You can see the problem here recoreded on an iPhone 6 - video The object looks ok until I ...
0
votes
1answer
42 views

Figure out why vertices are clipped

I am trying to figure out why, at sharp cutoffs in geometry, some vertices seems to be culled for some reason. I have a heightmap for demonstrating it like this And this is the result I get See the ...
0
votes
1answer
39 views

Combining cylindrical Billboarding and aligning with velocity (unity)

I'm trying to make a custom GPU particle solution on Unity to fullfill some needs on my project, using compute shaders and custom shader + Graphics.DrawProceduralNow() to draw them. While I managed ...
0
votes
1answer
53 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 ...
0
votes
0answers
32 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
30 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
31 views

HLSL : Offset and length were out of bounds

...
0
votes
1answer
69 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
1answer
51 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
40 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
53 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
55 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
2answers
111 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
55 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
80 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
176 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
102 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
36 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
49 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
63 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
38 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
37 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
77 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
125 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 ...
1
vote
2answers
282 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
135 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
66 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
54 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
709 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
227 views

Hard coded triangle in CG 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
150 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
322 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
47 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
73 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
384 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
254 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
99 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
151 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
177 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
231 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
461 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
993 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 ...

1
2 3 4 5
12