Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

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
0 answers
20 views

Incorrect Screen Space Reflection help

I'm leaving a question because I ran into a problem while implementing screen space reflection. The way I do it is by sampling the position and normal map saved with deferred rendering, changing it to ...
user179368's user avatar
2 votes
1 answer
98 views

Why do you use logarithmic curve to fix distortion of texture?

I'm a noob shader learner, and I came across this question about animated shaders in Unity: Animated textures for models; How to write a shader? After reading the answer, I kind of understood the ...
V.R.S's user avatar
  • 23
0 votes
1 answer
78 views

GLSL ported shader not working in HLSL

I have been working on an Infinity Grid shader for my engine. It was already implemented to Vulkan’s GLSL, so it worked great with OpenGL’s (4.6) GLSL. Here's a reference. This basic shader with ...
Kenny Tutorials's user avatar
0 votes
1 answer
177 views

Shader to give the effect of a 2D character covered in oil

I have a 2D pixel art game where characters can be covered in a flammable black oil-like substance and I am looking for a simple way to depict that visually. Simply tinting the character black won't ...
Martin's user avatar
  • 43
0 votes
0 answers
80 views

Depth Map doesn't work in 2D URP

This is a further question from my last, originally I was trying to change the way the depth map is rendered per-pixel. However, through more testing, I've found that actually it has nothing to do ...
Pow's user avatar
  • 404
0 votes
0 answers
34 views

How can I create a Spotlight in a Vertex Shader?

...
mueoc mueoc's user avatar
1 vote
1 answer
29 views

Issues with binding structure layout in the shaders which translated from glsl to hlsl

I have a small issue with my shaders. Sorry if it is not the right place for this question. In general, the essence is that for my application on dx12, I have shaders in glsl (I'm too lazy to rewrite ...
Zhukov Artem's user avatar
1 vote
0 answers
61 views

Can you append values to an appendbuffer and then immediately read from that same buffer?

I am looking to achieve the following: I have a compute shader that receives a Texture2D as input, where a small percentage of the pixels in the texture are white. ...
Daniel Cardin's user avatar
0 votes
0 answers
39 views

Specular lighting does not appear

I'm struggling to add specular lighting on-top of diffuse lighting and not entirely sure where I'm going wrong. I've followed the instructions given in our lecture but it just doesn't seem to be ...
Skoosh's user avatar
  • 1
4 votes
0 answers
82 views

Simple shader to draw lights on a skyscraper

I have some basic shapes in the background of a scene that represent a small city. There is a stage where the scene becomes a nights scene. I would like to have the city come to life at night with ...
Charl Cillie's user avatar
3 votes
1 answer
210 views

How would I generate mipmaps for a 3D texture in Unity (at runtime)?

I have been trying to create a voxel cone tracer for Unity (in Universal Render Pipeline 16). I have this (unoptimized) C# code that turns the [CubeScale] area around 0,0,0 of the scene into a 3D ...
MacksNotCool's user avatar
0 votes
0 answers
14 views

Finding highest point on displacement map returns bizarre results

I find the highest point of a displacement map sampled at 9 different UV coordinates that i pass in an array to the shader. Then if the result is more than 0.7 I output a red pixel at every UV ...
Zeke Sanders's user avatar
0 votes
0 answers
46 views

Convolution matrix based minimum distance calculation

I want to detect the minimum distance to each game object within a convolution matrix in a compute shader. I know the code is a bit to read, but the logic itself is not too complicated. I am trying to ...
rasputin's user avatar
0 votes
1 answer
189 views

How to use gather offsets

I have this situation where I have parts of the same scene in each 4 half squares of a rendertarget rendered with the same view projection matrices. In my deferred pipeline I would like to sample with ...
philB's user avatar
  • 139
0 votes
0 answers
30 views

Trouble trying to use multiple rendertargetviews and viewports at the same time

I have worked on the GSCubemap demo for DX11 to obtain rendering to multiple rendertargets and modified it to render to a single RTV with multiple viewports with SV_ViewportArrayIndex. I'm now trying ...
philB's user avatar
  • 139
0 votes
1 answer
277 views

Iterating through every pixel in a shader - skipping pixels

I made the below shader to draw a mesh for every pixel on a texture, and color it with that pixel. It iterates through the pixels, correctly drawing and coloring the mesh instances. However it skips ...
Wiley Rush's user avatar
1 vote
1 answer
933 views

How to support Texture Tiling + Offset for custom shader

I've written a custom shader (with help) and I'm not sure why it does not have tiling & offset capabilities. What is the simplest way to add that feature to my shader? current shader code ...
Jacksonkr's user avatar
  • 229
1 vote
2 answers
203 views

How to use unconventional texture format

I would like to use a texture that could have more than 4 channels. I have seen a post where they use a single channel R8 texture to store string chars. I'm thinking of using something like that with ...
philB's user avatar
  • 139
0 votes
0 answers
156 views

How to calculate the world position of pixels in an HLSL script?

I want to make a simple ray marching loop in the fragment shader. I think the main issue is that I'm not giving the correct world position input. Here is my current attempt: ...
Nikhil Nair's user avatar
0 votes
1 answer
47 views

Weird result whe nusing OMSetRenderTargetsAndUnorderedAccessViews

My render pass consist in four passes. 3 first have 2 rendertargets and two unordered access view. RTV0 = RG88 //store normal.xy RTV1 = R32 //store depth UAV0 = R32UINT //store color1 UAV1 = R32UINT//...
philB's user avatar
  • 139
0 votes
1 answer
82 views

Screen position in Deferred Shading

I am trying to implement a program in Direct3D 11 which uses techniques like deferred shading and shadowmapping, but when I create my gBuffers, the position looks strange. After researching a bit I ...
Charlie.Q's user avatar
0 votes
0 answers
41 views

using texture as variable

I was trying to use a texture as a variable in my shader (DX11 VS/PS 5.0). Can't get it. I have recently find this piece of code here where a texture is passed as a function parameter. Is that ...
philB's user avatar
  • 139
0 votes
1 answer
162 views

Noise in compute shader related to threadsPerGroup

I have been working on a metaball compute shader for roughly 3 months now, and the only issue I have to resolve is noise in the output Dest[id.xy]. I also asked GPT 4 about the crux of the issue and ...
rasputin's user avatar
0 votes
2 answers
403 views

How to convert from object space to clip space

I want to animate foliage with vertex animation but I have wrong output because I can't correctrly transform from object space to clip space, and my foliage goes off the model. How Can I convert in ...
Silz's user avatar
  • 37
0 votes
0 answers
162 views

How to deform mesh's actual vertices, based on shader waves code?

I am using a shader that is applying a visual deformation that looks like Gerstner waves. It works great, but I need the mesh's actual vertices to deform based on these formulas as well. How can this ...
yukjaly7's user avatar
1 vote
2 answers
376 views

Pack 4 textures into one channel

Can I pack 4 grayscale textures into one channel by converting the textures into uints and packing them? ...
Shiv-iwnl's user avatar
1 vote
1 answer
216 views

D3D11 ERROR ("invalid arguments") from HLSL shader

I am using MonoGame 3.8.1.303 with Windows/DirectX. I am just rendering a TriangleList using DrawIndexedPrimitives, but I am ...
codymanix's user avatar
  • 364
0 votes
1 answer
306 views

Putting two R16_UNORM in a R32_UINT

With my hardware limitation for CS5 I'm using R32_UINT in my shaders to store compacted colors and normasl as 555 bits each. My packing is using uint3 and the result is of poor quality. I'm planning ...
philB's user avatar
  • 139
0 votes
1 answer
127 views

Looking for an advice on how to possibly boost my compute shader

I have 4 rendertargets R10G10B10A2 each being used to store color and normal in a compact double RGB 555 bits format. When I'm doing the lighting pass I'm obliged to have extra rendertargets because ...
philB's user avatar
  • 139
0 votes
1 answer
318 views

Reliably addressing compute buffer when using large numbers of threads

I'm trying to move a 262,144 [2^18] points (stars) in a compute shader and am struggling to reliably address the data in a buffer. I understand that there's a 3-dimensional array ...
Basic's user avatar
  • 1,278
0 votes
1 answer
144 views

Problems with normal recovery from storage as two floats and normal from depth buffer

In my app I’m producing for my deferred shading 4 layers of data to show up occluded parts of the scene during screen space reflection (SSR) pass. I need normal maps with bumpiness of these layers for ...
philB's user avatar
  • 139
0 votes
1 answer
450 views

error X4532 Cannot map expression to gs_5_0 instruction set

Using DX11 I have this line starting with TC = txDiffuse in a geometry shader that generates the error message. Can someone explain me the problem or if it is not possible to sample in geometry shader ...
philB's user avatar
  • 139
0 votes
0 answers
208 views

How to add inverted hull outline to desired objects in HLSL?

I am currently trying to edit a Vertex Shader of a game and want to add inverted hull outlines to the desired objects, but there are a lot of tutorials on the inverted hull for Unity, Blender, and ...
Krish-fz's user avatar
0 votes
1 answer
905 views

Difficulties in converting RGBA to float and back

I can't get my colors back. What I'm using to encode/decode: ...
philB's user avatar
  • 139
0 votes
2 answers
184 views

Shadowmapping in view space

UV coordinates for shadow mapping are usually calculated from world position. I want to make it compliant with my screen space reflection (SSR) pipeline which works in view space. Is it possible to ...
philB's user avatar
  • 139
0 votes
2 answers
635 views

DirectX11 creating input layout throws error on input signature not matching shader (instancing)

The input layout ...
koreus737's user avatar
  • 131
0 votes
0 answers
280 views

How do I make a shader that simulates acrylic paint being smeared on a surface?

I know something about shaders, I have written some very basic shaders. This is the most advanced shader I have written so far. It's been several days since I conceived the idea of trying to recreate ...
blablaalb's user avatar
0 votes
1 answer
631 views

24bit float to RGB

There's solutions to convert float to RGBA but I would like to encode a float depth value in RGB format and save the three components in three separated unused alpha channels and recompose when needed....
philB's user avatar
  • 139
0 votes
1 answer
2k views

How do I cast a float4 to a float[4]?

I've a RGBA16F texturecube for 4 pointlights shadows rendered in one pass. Each color channel stores the object to light distance for one pointlight shadow (e.g red channel is for light 0 and so on). ...
philB's user avatar
  • 139
0 votes
1 answer
215 views

How do I offset a texture pointer in order to store an array of D3D11_SUBRESOURCE_DATA?

I'm attempting to load a sequence of frames from a GIF into a Texture2DArray using stbi_load_gif_from_memory which returns a ...
Casey's user avatar
  • 2,035
1 vote
1 answer
2k views

How to add antialiasing to my circle shader?

I made a circle shader by following this tutorial: https://www.youtube.com/watch?v=Ww1GbfnBH_Q. It is simple flat circle shader. The problem is that there are visible jigged lines on the circle edges. ...
Ivan's user avatar
  • 337
0 votes
1 answer
287 views

Why can't I use the "degrees" character in HLSL comments?

I was in the process of creating a function in my compute shader that converts a 180° angle to a 360° CCW angle like this: ...
Keheck's user avatar
  • 31
0 votes
1 answer
1k views

How to modify the z depth value inside the vertex function of a surface shader?

I wrote the following surface shader. The idea is to increase the Z depth value of vertices, after projection. ...
tigrou's user avatar
  • 3,214
5 votes
0 answers
218 views

How inefficient is my ray-box-intersection algorithm?

One of the most critical parts of my raytracer is the calculation of a collision between ray-box which is done following way: ...
NHSH's user avatar
  • 51
0 votes
1 answer
1k views

Initializing a global variable array once for a shader without using CPU code to populate the array

I know I can initialize arrays via code written in C++, etc. to set arrays in a shader. What I want to know is if I can initialize the array in HLSL code instead. For example: ...
jjxtra's user avatar
  • 127
2 votes
1 answer
252 views

How to generate a correct RGB + Luminance histogram?

I am trying to create a debug tool that would help me visualize an image RGB and luminance histogram. I have created a compute shader where I gather the histogram data ...
GameDevNerd's user avatar
0 votes
0 answers
120 views

ComputeBuffer Values messed up when calling the dispatch many times in a row

I'm having a RWStructuredBuffer called AffectedVertices give me random data instead of 1 simple value to resultAffectedVertices, ...
TensaDev's user avatar
2 votes
0 answers
27 views

Where is this quad pattern coming from? [duplicate]

I'm rendering a map generated from noise. For debugging purposes, I'm just using the normals as color. I'm not sure how good/correct my calculated normals are, either way, I'd expect a smooth colored ...
tkausl's user avatar
  • 1,860
0 votes
1 answer
127 views

What is wrong with my terrain lighting?

I've just implemented a simple algorithm to calculate terrain vertex normals and I'm using diffuse and ambient light currently, but for some reason the squares that make up my terrain are visible when ...
Rafael Ferreira's user avatar
0 votes
0 answers
44 views

shader can't read data except position, texcoord, normal

i want to read bone's weight but shader can't read data this is my vertex type ...
문형준's user avatar

1
2 3 4 5
14