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
3
votes
1 answer

Trying to make Gaussian Blur stronger/blurrier - XNA 4.0 HLSL

I'm trying to implement a gaussian blur on a Texture2D and have had trouble trying to find any good tutorials etc. I've finally managed to find a nice piece of one-pass sample code and it visibly does blur the image a tiny bit but I want to be able…
poncho
  • 1,100
  • 2
  • 15
  • 38
3
votes
1 answer

hlsl matrix multiplication

I was just playing with HLSL . I want to get the vector "inputPos" in vector "pos". case2 is working but not case1 . why ? Aren't both the cases same ? M * M_Inv * inputPos = inputPos. Why case 1 is not giving right value? //case 1 pos = mul(…
YAHOOOOO
  • 939
  • 4
  • 19
  • 27
3
votes
1 answer

Heightmap in Shader not working

I'm trying to implement GPU-based geometry clipmapping and have problems to apply a simple heightmap to my terrain. For the heightmap I use a simple texture with the surface format "single". I've taken the texture from Catalinz's XNA blog. What I'm…
CShark
  • 1,413
  • 15
  • 25
3
votes
1 answer

Drawing a SuperEllipse in HLSL

Update : answer on how to draw one using Superformula is at the end I need to draw a rounded rectangle such as this one, using a SuperEllipse. Drawing one when being able to plot wherever was easy : But in HLSL where you cannot, I got stuck on the…
aybe
  • 15,516
  • 9
  • 57
  • 105
3
votes
2 answers

HLSL invalid ps_2_0 input semantic POSITION0

I'm attempting to write a phong shader effect for Dx9 in RenderMonkey. I'm getting a compile error in the pixel shader *"invalid ps_2_0 input semantic 'POSITION0'"* and I'm not sure how to fix it, although I know it's got to be something to do…
fishfood
  • 4,092
  • 4
  • 28
  • 35
3
votes
3 answers

Is it possible to use a shader to find the "difference" between two textures? (XNA/HLSL)

I have made a simple webcam based application that detects the "edges of motion" so draws a texture that shows where the pixels of the current frame are significantly different to the previous frame. This is my code: // LastTexture is a Texture2D…
Callum Rogers
  • 15,630
  • 17
  • 67
  • 90
3
votes
2 answers

Adding normal information for the shader in DirectX 11 - normals not visible in shader?

I wanted to add a normal map information for my shader. I was using tutorial 5 from DirectX 11 C++ SDK as a base. The code for shader creating is (I'm putting it just to be sure I have posted every important information, but I think that only the…
PolGraphic
  • 3,233
  • 11
  • 51
  • 108
3
votes
1 answer

C#/XNA/HLSL - Applying a pixel shader on 2D sprites affects the other sprites on the same render target

Background information I have just started learning HLSL and decided to test what I have learned from the Internet by writing a simple 2D XNA 4.0 bullet-hell game. I have written a pixel shader in order to change the color of bullets. Here is the…
andy lee
  • 55
  • 1
  • 5
3
votes
4 answers

Whats the logic behind creating a normal map from a texture?

I have looked on google, but the only thing that I could find was a tutorial on how to create one by using photoshop. No interest! I need the logic behind it. (and i dont need the logic of how to 'use' a bump map, i want to know how to 'make'…
Y S
  • 41
  • 1
  • 3
2
votes
1 answer

C#/HLSL & XNA - Blending 2 colors together via percentage in HLSL

I'm creating a fog feature in my Effect file.. in the pixel shader, I calculate the distance from the camera position and the input's position, as so: float x = distance(_in.pos3d, CameraPosition); float fd; if(Fog) { if(x > FogDistance) …
Jared
  • 129
  • 3
  • 13
2
votes
2 answers

WPF or Silverlight 3 Pixel Shader for Stippling Effect

Can anyone recommend an algorithm for a HLSL Pixel Shader (for WPF or Silverlight 3) to do a stippling effect? Here are some examples: http://www.nolinovak.com/, http://sprouls.com/
Michael S. Scherotter
  • 10,715
  • 3
  • 34
  • 57
2
votes
4 answers

HLSL without WPF or XNA?

I have a large scientific legacy application written in VB .NET 4.0, using winforms. I find the need for pixel shaders. In order to use pixel shaders in this situation, I assume I have to, for example, launch a WPF form, do some graphics magic,…
2
votes
1 answer

How can I set shader constants by register in glsl?

I'm working on a graphics api that has to run on both directx9 and opengl (2.1 and no uniform buffer support) I don't want to write two versions of the shaders and need to convert between hlsl and glsl (Cg is not an option) I've solved most…
Birken
  • 43
  • 1
  • 3
2
votes
0 answers

What is the hlsl `dst` instruction for?

The docs say dst "Calculates a distance vector" by: dest = dst( src0, src1 ) ; It says, The first source operand (src0) is assumed to be the vector (ignored, d*d, d*d, ignored) and the second source operand (src1) is assumed to be the vector…
bobobobo
  • 64,917
  • 62
  • 258
  • 363
2
votes
1 answer

Sample code for AES Encryption/Decryption using DirectCompute

would anyone happen to know of an implementation of AES Encryption/Decryption (any type) using DirectCompute (including the HLSL source code)? I've read a few of the papers discussing AES on the GPU and they tend to make reference to either CUDA or…
SJoshi
  • 1,866
  • 24
  • 47