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

In hlsl what this means

I have some code in .fx file whening using fxcomposer,and I met some code like this: float4x4 WorldITXf : WorldInverseTranspose < string UIWidget="None"; > what is the < and > containning meaning?
One Double
  • 131
  • 2
  • 9
0
votes
0 answers

Mismatch between input assembler and vertex shader - but it looks right

I had a similar issue someone kindly solved here, but that led me to this one. The error is: "Input Assembler - Vertex Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (SV_POSITION,0) as…
Dave
  • 1,521
  • 17
  • 31
0
votes
1 answer

Writing a HLSL shader for rescaling floating point textures

When using HalfSingle/Single format for my Texture2D, XNA complains that sampling must be set to PointClamp, and this makes my texture look jagged. I am actually using this to pass depth data to the shader, so I am trying to get a better dynamic…
Lou
  • 4,244
  • 3
  • 33
  • 72
0
votes
0 answers

Issues with 2D raycasting lighting under limitations of HLSL 3.0 pixel shader

I've been writing my own HLSL pixel shader for dynamic lighting using raycasting. Unfortunately, since I'm using this out of XNA, I can only use up to ps_3_0. As you can see, the limitations difference between 3 and 4 are drastic, especially in…
ben
  • 133
  • 13
0
votes
1 answer

Doing 64bit addition with 2 high 32bit integers and 2 low 32bit integers. Are there more efficient ways of getting the carry bit?

Let's say that A and B are my lower 32bit integers, and T is a 32bit integer that I want to represent the carry from adding A and B. I threw together some quick logic to get T: T = (A >> 1) + (B >> 1); T += A & B & 1; T >>= 31; It works, but I'm…
MNagy
  • 423
  • 7
  • 20
0
votes
2 answers

Normals are not transfered to DirectX 11 shader correctly - random, time-dependent values?

Today I was trying to add normal maps to my DirectX 11 application. Something went wrong. I've decided to output the normals' information instead of color on scene objects to "see" where lies the problem. What surprised me is that the normals'…
PolGraphic
  • 3,233
  • 11
  • 51
  • 108
0
votes
1 answer

Rendering a circle with a Vertex shader in DirectX

I am trying to draw a simple 2D circle by manipulating texcoord coordinates inside a vertex shader. This is the code: float2 uv2 = 2.0 * (TextureCoordinate.xy - 0.5); float tnm = 1.0 - length(uv2); In pixel shader, this draws a circle. The same…
vtastek
  • 123
  • 8
0
votes
1 answer

Draw a sphere on a billboard with world normal from a pointlist

I am drawing spheres on billboards by passing center world positions via a StructuredBuffer and use the geometry shader to build a billboard facing the camera. The sphere is drawn correctly and I can figure out the UVs. Now I would like to light it…
kittikun
  • 1,829
  • 1
  • 25
  • 33
0
votes
0 answers

HLSL Shader in DX9 failing to complile

I have a DirectX shader (.fx and .fxo) and am trying to implement it into my own DirectX9.0 project but when using HRESULT hr = (D3DXCreateEffectFromFile(mD3DDevice, "Terrain.fx", 0, 0, D3DXSHADER_DEBUG, 0, &mFX, &errors)); where mD3DDevice is…
unknownSPY
  • 706
  • 4
  • 15
  • 27
0
votes
0 answers

In HLSL pixel shader, why am I getting [-256.0, 256.0] values in SV_POSITION input?

My question is basically in my DirectX11 pixel shader, why am I getting a range of values from -256.0 to 256.0 in the SV_POSITION input instead of the supposed values from 0.0 to ViewportWidth and 0.0 to ViewportHeight? I am setting explicitly the…
0
votes
1 answer

Porting Directional Light from OpenGL to DirectX11

I am porting my GLSL Directional Light Shader from OpenGL to DirectX11. My LightDirection is (1,0,0) (from left to right in the pictures) The Shader in GLSL looks like this: #version 330 core uniform sampler2D DiffuseMap; uniform sampler2D…
PuRe
  • 179
  • 2
  • 13
0
votes
1 answer

DirectX Toolkit loaded model with custom HLSL shader Vertex shader input signature

I am working on a project in which I use DirectX Toolkit to load FBX models. As I understood, DXTK does not support HLSL shaders for its models, so I have to get the model information (vertex buffer, index buffer, etc.) from the model object and…
Gábor Szalóki
  • 261
  • 2
  • 8
0
votes
1 answer

How to achieve left to right color gradient for non Standard shapes without using Texture coordinates in hlsl?

I have searched a lot on Google and most of examples achieving gradient using texture coordinates. But I don't have texture coordinates with me. I am working on 3D text on which I want to apply gradient color. Is it possible? If yes, how? Is it…
0
votes
1 answer

DirectX10, Rendering to a Rendertarget - No Alpha

My Problem is, that when I render to a rendertarget, which has a texture binded to it, the rendered information cannot be seen, because the alpha is 0. If I turn the alpha value within the shader to 1 when displaying the rendertarget, then I can…
PuRe
  • 179
  • 2
  • 13
0
votes
1 answer

In DirectX, what values is stored in the depth value? Does this differ between DX9 and DX11?

I'm rendering the same geometry, using the same projection/view matrix in both DirectX 11 and DirectX 9. The vertex shader uses Output.oPosition = mul(float4(Position, 1.0), mul(mul(mHookModel, mHookView), mHookProjection)); in both APIs. Then…
CrazyNorman
  • 185
  • 1
  • 9