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

Calculating view space normal instead of world space

I hope you can help with this. I am currently using a deferred renderer and am trying to implement SSAO but that needs view space normals and I currently have world space normals, I am trying to work out how to convert them but keep getting…
0
votes
1 answer

Monogame pixel shader - Texture passing as completely transparent

I'm trying to make a distortion shader for water in my game. I have the screen's rendertarget, and the water mask rendertarget, and I'm try to simply capture the pixels underneath the mask, but I can't get it to work. When I pass the textures, it's…
user1438378
  • 141
  • 2
  • 5
0
votes
1 answer

Need help - Monogame 2d water reflection

Ok so i am following this tutorial Water Reflection XNA and when i adjust code with monogame i cant get final result. So here is my LoadContent code: protected override void LoadContent() { spriteBatch = new…
mskrpan
  • 13
  • 1
  • 1
  • 3
0
votes
4 answers

Retrieving normal after rotating an instance model in HLSL

I begin to use the "instancied model" technique to draw my scene and I've got a problem with normal's vertex I give to HLSL the MATRIX ( rotation / scale / position ) to draw each instance of model but I can't obtain the good normal after rotate…
0
votes
1 answer

How to pass result from compute shader to vertex shader?

My code worked. Firstly, I create a buffer to get buffer from compute shader by CopyResource. Then I create a pointer call p1 and get result pointer from MappedResource1. After that, I create vertex buffer and render. But I don't think it's the best…
Yonghui
  • 222
  • 3
  • 16
0
votes
0 answers

Shadow Maps artifacts

We are working with XNA (Monogame) and currently trying to implement shadow maps. I believe that the topic of shadow maps issues has been already extensively covered on the Internet, however we can't quite match our particular problem to the…
MutomboDikey
  • 155
  • 2
  • 12
0
votes
1 answer

Loading HLSL shaders and multi-device directx 9 rendering

For a multi-device rendering setup using Shader Model 2.0: 1 LPDIRECT3D9 with 2 or more LPDIRECT3DDEVICE9 objects. Should I load/compile my shaders (HLSL) based on number of LPDIRECT3DDEVICE9 objects. Then provide each shader to its respective…
Hinchy
  • 143
  • 9
0
votes
1 answer

Assign struct C++ with HLSL variable

I've only start working with DirectX, so I've get this problem: I'm trying to push/send/assign a c++ struct in/into/with HLSL variable which have the same datatype with a struct from C++. In C++: struct Light { Light() { …
Misa Gu
  • 13
  • 8
0
votes
2 answers

HLSL preprocessor in Visual Studio 2015

I am working over DirectX shaders and C++ code in Visual Studio 2015 and I want to make just one code, so I started to play with macros, because I consider it as effective way how to unified the code. HLSL preprocessor in visual studio is little…
user4663214
  • 147
  • 11
0
votes
1 answer

Undefined number of TEXCOORDs

How to declare an array of TEXCOORDs? In different struct I have : float2 foo : TEXCOORD0 float3 bar : TEXCOORD1 And now I need float4 Positions[NUMBER_OF_FLOATS] float3 OtherPositions[NUMBER_OF_FLOATS_2] I want these arrays to consist of…
Wanderer
  • 147
  • 1
  • 8
0
votes
1 answer

MojoShader: HLSL to GLSL conversion

I recently started developing an application using Monogame and entered the world of shaders and shading languages. The target platform is GL. Which means that I have to write my shader in HLSL, which subsequently gets converted into GLSL by…
MutomboDikey
  • 155
  • 2
  • 12
0
votes
1 answer

What does the > arithmetic operator in HLSL do?

I found some code online for a shader containing these lines: float2 preRect; preRect.x = (IN.uv_MainTex.x > _RectMinX) - (IN.uv_MainTex.x > _RectMaxX); In C based languages (IN.uv_MainTex.x > _RectMinX) would evaluate as a boolean but here it's…
Absinthe
  • 3,258
  • 6
  • 31
  • 70
0
votes
1 answer

HLSL fragment shader different color for every vertex?

can i make different colors for every vertex instance of this shader? do i have to send instance to o.output to the frag color? It's the Unity3d implementation of HLSL running Graphics.DrawProcedural (MeshTopology.LineStrip); #pragma…
0
votes
1 answer

Terrain Height Map - C++/Vertex Shader has different values

I have been working on a terrain and have had to come to a complete stop. I am programming in C++, DirectX9 and HLSL to create the terrain but I am also using height maps that are BMP format. I am loading the information in from the height map in…
josh4263
  • 11
  • 4
0
votes
1 answer

Phong shading with directional light causing full white polygons

I am trying to make a Phong lightining shader for my game in Ogre3D 1.9. I can make diffuse and add a normal map to a plane, but when i add the specular component everythings turn a bright white. Here is an image without the specular component The…