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

Is it possible to create a Point Light Shadowmap with only 1 Texture and 1 Vertexshader?

I was wondering if it would be somehow possible to reduce the need for 6 shadowmaps (front, back,top,right,left,down) with normal Projectionmatrix to only a single one, using some Vertex Shader trickery. Basicly I want to somehow manipulate the…
user2741831
  • 2,120
  • 2
  • 22
  • 43
0
votes
0 answers

Monogame shader doesn't draw anything

I'm brand new to working with shaders and I'm trying to learn how to use them with Monogame. I've been reading a few tutorials online about them and I'm already running into problems. It may be that the tutorials are outdated? When I apply the…
bwoogie
  • 4,339
  • 12
  • 39
  • 72
0
votes
1 answer

Unity Pass multiple textures(array) into shader?

Right now in my shader, I have 5 textures, Properties { _MainTex ("Texture", 2D) = "white" {} _MainTex2("Texture2", 2D) = "white" {} _MainTex3 ("Texture3", 2D) = "white" {} _MainTex4 ("Texture4", 2D) =…
ywj7931
  • 135
  • 1
  • 3
  • 9
0
votes
2 answers

HLSL compilation speed

I have one relatively complicated shader, which I want to compile. Shader has ~700 lines, which are compiled into ~3000 instructions. Compilation time is with fxc (Windows 8 SDK) about 90 seconds. I have another shader of similar size and…
user4663214
  • 147
  • 11
0
votes
1 answer

direct11 write data to buffer in pixel shader? (like ssbo in open)

I'm trying to write data to a buffer in hlsl shader. I know in opengl you need ssbo, but is there a corresponding buffer type in direct11?(I'm new to it). p.s. I'm using monogame so the newest shader model available is 3.0. thanks!
sunsflower
  • 15
  • 2
  • 8
0
votes
1 answer

How to configure VS to build hlsl file multiple times with different defines (/D stuff)

Recently I want to change my run-time shader compilation into build-time shader compilation by use vs built-in shader compiler (so you could right click on the hlsl file from vs solution explorer, and change the item type to HLSL compiler to use…
Peng
  • 23
  • 3
0
votes
1 answer

How to use the hardware's 3D texture sampling with a flipbook style volume texture?

A question sort of addressing the problem and another question asking a related question. I have a 2D texture that has 12x12 slices of a volume layered in a grid like this: What I am doing now is to calculate the offset and sampling based of the…
Noobs DeSroobs
  • 253
  • 1
  • 6
  • 24
0
votes
1 answer

Can't find source when debugging shader

I want to debug my shader using visual studio graphics diagnostic tool. I did the instructions in the manual and the graphics diagnostic captures frame. I click the play button next to shader in pixel history panel: Now VS asks for some file…
morteza khosravi
  • 1,599
  • 1
  • 20
  • 36
0
votes
1 answer

Can I shader link the same HLSL function twice with different resource bindings?

Say I have the following: Texture2D texture : register(t0); SamplerState sampler : register(s0); export float4 Sample(float2 uv) { return texture.Sample(sampler, uv); } export float4 Multiply(float4 lhs, float4 rhs) { return lhs * rhs; } Can I…
Trillian
  • 6,207
  • 1
  • 26
  • 36
0
votes
2 answers

Append Textures using HLSL

I want to create a function that takes multiple textures and append them and tiles them next to each other. Example, if I had imgA, imgB, imgC I can get an texture like this: A A B C B B B C A Also image do not have to be the same size so I might…
Joseph Azzam
  • 105
  • 1
  • 14
0
votes
0 answers

TextureCube to Texture2DArray: from sampling vector to uv + slice index

Premise I'm currently developing a graphical application and, due to unforeseen limitations with the framework I'm using, I need to convert my TextureCube textures into a Texture2DArray with 6 slices. While going from one format to the other is not…
StrG30
  • 670
  • 1
  • 10
  • 20
0
votes
1 answer

Get the MSAA sample number inside pixelshader for OIT

I try to implement Order Independent Transparency on my own. It is like finished without one thing... As you can see in the picture below, the OIT with MSAA is some kind of wrong. I think it is because of the samples. because at each triangle edge…
Thomas
  • 2,093
  • 3
  • 21
  • 40
0
votes
1 answer

Affine Texture Mapping in d3d11/hlsl

I am wondering if you happen to know how to change the default perspective correct texturing to affine texturing in HLSL or d3d11. I have to do specifically this for an assignment I am working on and any help would be great. THANKS!
0
votes
1 answer

HLSL re-texturing

I am trying to re-texture an image on top of a series of images using HLSL and a UV render pass, but the resulting images have a number of artifacts (Overall pixelated image, aliasing artifacts within the image). The background and the UV-pass can…
0
votes
0 answers

HLSL: static-value optimization and dynamic-value optimization

I use an if-statement without else block. As the images below show, it seems like that the compiler has done some optimizations, making gDiffuseMap_NormalMapping null. However, when I replace the conditional TRUE with a variable of boolean type,…