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 and tessellation shaders. It is analogous to for OpenGL.

Resources

1397 questions
9
votes
2 answers

Pack four bytes in a float

I'm writing a shader (HLSL), and I need to pack a color value into the R32 format. I've found various pieces of code for packing a float into the R8G8B8A8 format, but none of them seem to work in reverse. I'm targeting SM3.0, so (afaik) bit…
YellPika
  • 2,834
  • 1
  • 25
  • 29
9
votes
2 answers

What are all the different HLSL sampler types for?

I'm working with DX9/SM3 at the moment, and the MSDN documentation on HLSL samplers seems to be sorely lacking in explaining how to use the different sampler types. What's worse is they try to cover DX9 and DX10 in a single article, so they jumble…
blah
9
votes
4 answers

What kind of blurs can be implemented in pixel shaders?

Gaussian, box, radial, directional, motion blur, zoom blur, etc. I read that Gaussian blur can be broken down in passes that could be implemented in pixel shaders, but couldn't find any samples. Is it right to assume that any effect that concerns…
Joan Venge
  • 269,545
  • 201
  • 440
  • 653
9
votes
1 answer

Bézier curves, Loop and Blinn style

A couple of days ago I started looking into efficiently drawing bezier curves, and I came across a this method developed by Charles Loop and Jim Blinn that seemed very interesting. How ever, after a lot of experimenting with their algorithm, I just…
Roliga
  • 93
  • 5
8
votes
4 answers

Can I generate a random number inside a pixel shader?

I'm trying to write a very simple shader that adds random sparkle to applicable objects. The way I'd like to do this is by adding a random shade of white (R = G = B) to the pixel value within the pixel shader. It seems that noise() doesn't work the…
chaosTechnician
  • 1,522
  • 3
  • 16
  • 30
8
votes
1 answer

DirectX 11 - Compute shader: Writing to an output resource

I've just started using the Compute shader stage in DirectX 11 and encountered some unwanted behaviour when writing to an output resource in the Compute shader. I seem to get only zeroes as output which, to my understanding, means that out-of-bound…
SvinSimpe
  • 780
  • 10
  • 24
8
votes
3 answers

Efficient pixel shader sum of all pixels

How can I efficiently calculate the sum of all pixels in an image, by using a HSLS pixel shader? I'm interested in Pixel Shader 2.0, that I could invoke as a WPF shader effect.
luvieere
  • 35,580
  • 18
  • 120
  • 178
8
votes
3 answers

Shader's function parameters performance

I'm trying to understand how passing parameters is implemented in shader languages. I've read several articles and documentation, but still I have some doubts. In particular I'm trying to understand the differences with a C++ function call, with a…
Heisenbug
  • 37,414
  • 27
  • 126
  • 181
8
votes
1 answer

error X8000 : D3D11 Internal Compiler error : Invalid Bytecode: Invalid operand type for operand #1 of opcode #86 (counts are 1-based)

I'm absolutely stumped as well as my instructors/lab-assistants. For some reason, the following HLSL code is returning this in the output window: error X8000 : D3D11 Internal Compiler error : Invalid Bytecode: Invalid operand type for operand #1 of…
JMazzola
  • 105
  • 5
8
votes
1 answer

Storing two float values in a single float variable

I'd like to store two float values in a single 32 bit float variable. The encoding will happen in C# while the decoding is to be done in a HLSL shader. The best solution I've found so far is hard-wiring the offset of the decimal in the encoded…
ZoltanE
  • 153
  • 1
  • 7
8
votes
1 answer

Can Silverlight play videos with transparency?

Can Silverlight play video with transparency? At least some tricky way for color keying with C# or HLSL? So if you know any way how to please post some info. If yes. What do I need? MSDN if there is any help on this. Open Source…
Rella
  • 59,216
  • 102
  • 341
  • 614
8
votes
2 answers

HLSL mul() variables clarification

The parameters for HLSL's mul( x, y) indicated here: say that if x is a vector, it is treated as a row vector. if y is a vector, it is treated as a column vector. Does this then follow through meaning that: a. if x is a vector, y is treated as a…
dk123
  • 15,184
  • 16
  • 63
  • 74
8
votes
6 answers

Real HLSL IDE/debugger

Are there any IDE's for developing HLSL code? The three key features I want are: 1) syntax highlighting 2) auto-complete 3) interaction debugging Visual Studio doesn't do any of these things, and it doesn't seem that RenderMonkey or FX Composer do…
ThePhantasm
8
votes
1 answer

Outer Glow as HLSL shader

I'm still working on an image processing project that makes use of HLSL shaders to add Photoshop-esque filters like drop shadow, bevel and so on. Now I'm searching for an approach to implement an outer glow effect in HLSL. I'm currently…
barnacleboy
  • 499
  • 8
  • 18
7
votes
1 answer

Unity Shader - How to efficiently recolor specific coordinates?

First, please allow me to explain what I've got and then I'll go over what I'm trying to figure out next. What I've got I've got a textured custom mesh with some edges that exactly align with integer world coordinates in Unity. To the mesh I've…
Mir
  • 336
  • 2
  • 21
1
2
3
93 94