Questions tagged [hlsl]

HLSL(High Level Shader Language) is a proprietary shading language developed by Microsoft for use with the Microsoft Direct3D API

HLSL is a C-like language developed by Microsoft and it's used in Direct3D API to define shaders. HLSL is used by Direct3D 9, and is required by the unified shader model in Direct3D 10+.

HLSL can be used to define pixel shaders, vertex shaders, geometry shaders, compute shaders, tessellation shaders, raytracing shaders and mesh shaders. It is analogous to for OpenGL.

Vulkan SDK and DirectX Shader Compiler also supports compiling HLSL shaders into SPIR-V, enabling its use in Vulkan applications.

Resources

1642 questions
4
votes
1 answer

How do you write a vertex shader that does nothing?

Despite the simplicity of the problem I am facing, I cannot find an answer ANYWHERE on the internet. I have a source texture that I get from the RenderTarget I am using, which I then pass to my effect. My effect has a vertex shader and a pixel…
Darkhydro
  • 1,992
  • 4
  • 24
  • 43
4
votes
3 answers

HLSL operator/functions cycle count

I'm modeling some algorithms to be run on GPU's. Is there a reference or something as to how many cycles the various intrinsics and calculations take on modern hardware? (nvidia 5xx+ series, amd 6xxx+ series) I cant seem to find any official word on…
4
votes
1 answer

Real time dynamic shadows to complement deferred shading?

I currently have a deferred rendering system setup and can render point lights and directional lights. My question is what are my options for different forms of shadowing which can make shadows based on point lights and directional lights which can…
meds
  • 21,699
  • 37
  • 163
  • 314
4
votes
1 answer

HLSL point sprite texture coordinates work on ATI not NVIDIA

I am really stuck on this one. My HLSL for rendering point sprites with texture coordinates for a sprite sheet works fine on all ATI cards but not on any NVIDIA cards. On NVIDIA cards the passed texture coordinates map to the whole sprite sheet…
ste
  • 41
  • 2
4
votes
1 answer

HLSL Passing a single float to PS?

I'm working through Frank Luna's "DirectX 9.0c: A Shader Approach" book and I'm stuck on exercise 2 in chapter 10. I'm supposed to calculate a float value s and pass it to the pixel shader so I can calculate "toon lighting". I understand the theory…
Aztal
  • 217
  • 1
  • 5
  • 12
3
votes
2 answers

How to find the distance between a point and a parabola in code

I am trying to find the closest point on a parabola to an arbitrary point in 2d, for a DirectX pixel shader. A great amount of googling has revealed to me that this is a common pre-calculus homework problem. Unfortunately, the hundreds of relevant…
Greg Bahm
  • 638
  • 6
  • 11
3
votes
2 answers

General confusion about .fx files and shaders use in DirectX9 in C++ - how exactly do you make the connection with the app?

Well basically,I'm not quite sure how to properly use the Set and Get Parameter methods in DX to use the .fx files.I mean I can't find a good tutorial anywhere.I even had a book about D3D9 and while I got most of it,I'm still unable to use effect…
Vio Lence
  • 49
  • 1
  • 3
3
votes
1 answer

Marshalling C# Structs into DX11 cbuffers

I'm having some issues with (i think) the packing of my structure in C# and passing them through to cbuffers i have registered in HLSL. When i pack my struct in one manner the information seems to be able to pass to the…
Craig
  • 1,199
  • 1
  • 13
  • 27
3
votes
1 answer

Noise function outputs subtly different result when converted from hlsl to c#

I am making a game in which I procedurally generate planets using a compute shader which builds a deformed sphere based on noise from a noise function I downloaded. The whole system works fine in the shader. I however wanted to be able to sample the…
Ashton Way
  • 46
  • 4
3
votes
2 answers

How to create a constant buffer with valid dimension

Good evening, I'm trying to send a XMFLOAT3X3 to a constant buffer (see code below). ZeroMemory(&constDesc, sizeof(constDesc)); constDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; constDesc.ByteWidth = sizeof(XMFLOAT3X3); constDesc.Usage =…
xcrypt
  • 3,276
  • 5
  • 39
  • 63
3
votes
1 answer

Difference between angled brackets and parentheses in HLSL texture samplers

Is there any important difference between using parentheses and angled brackets for texture sampler parameters? I have used them interchangeably before without any different effect. For instance Sampler TexSceneSampler { Texture =…
Chris C
  • 2,003
  • 15
  • 18
3
votes
1 answer

Unity Shader working in editor but not In-Game

I made a custom Unity shader for the Universal Render Pipeline (URP). That script is working well inside the scene view, but strangely not game view, and neither in build. That script uses the depth buffer of the camera to blend between two…
Eyap
  • 754
  • 1
  • 7
  • 22
3
votes
0 answers

Problem generating perlin noise using HLSL shader

I'm relatively new to HLSL and shaders in general, I've been trying to get a perlin noise shader working and I think I'm almost there, however the rendered noise is covered in banding or seam artifacts and I can't figure out why. heres a picture of…
Glenn
  • 111
  • 3
3
votes
1 answer

Should I use dxc or glslangValidator?

In the Vulkan SDK there are two different tools that allow to compile HLSL to SPIR-V: dxc and glslangValidator. Why do we need two? What are the differences? How do I decide which one to use?
tuket
  • 3,232
  • 1
  • 26
  • 41
3
votes
2 answers

GPU Heightmap sculpting in shader

i have successfully done the sculpting implementation on CPU, throw some guide on how to do this on GPU kindly … i have moved the sculpting code to vertex shader but the sculpting is not accumulating in vertex shader and cant modify position in…
enzio91900
  • 41
  • 8