Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Make your voice heard. Take the 2019 Developer Survey now

Questions tagged [hlsl]

A proprietary shading language developed by Microsoft for use with the Microsoft Direct3D API.

7
votes
1answer
135 views

How can I make outline shader like “Life is Strange”?

I want to make sketch shader like life strange. shader has two part: 1.animated dashed line 2.noisy outline I like to know how can I make noisy outline? see outline of objects First I tried to ...
1
vote
0answers
17 views

Hard coded triangle in HLSL geometry shader doesn't show on screen

In Unity I'm planning on using a geometry shader for processing points into quads and can't quite figure out why I'm not getting output from my geometry shader. I've edited it down to a minimum ...
2
votes
0answers
51 views

Trying to get Vertexshader to work Monogame 2D

If I don't use the vertex shader, it gives me white textures which is what the default color is. Once I add the vertex shader, the screen is black. I figure it is something wrong with the Matrices I ...
-1
votes
0answers
19 views

Vulkan creating shader module from spirv generated with -fhlsl_functionality1 flag

Whenver I compile the shader with this flag for semantic reflection and I try to create a module from it I get this error: ...
0
votes
0answers
21 views

Color pixel based on condition?

I am creating a PixelShader in which I only want to render specific pixels based on a condition. In this case, the condition is "time". Each ...
0
votes
0answers
13 views

Adding a property to vertex?

I am trying to add a new property to my Vertex structure so that I can modify objects in shaders based on a certain point in time. I've ran into an issue where ...
0
votes
1answer
67 views

Texture Atlas and HLSL Shader for sprite tiling

I am trying to create a shader that allows to tile a specific region of a texture. This seem to be a common need however I can't seem to find any information about how to get this effect done. The ...
0
votes
0answers
15 views

Dynamic Vertex Buffer vs Pixel Shader?

I am writing a basic 3D line which has two major factors into what is displayed: A list of points. A point in time. In the case where the line does not care about the current point in time (a user ...
0
votes
1answer
23 views

Combination Lighting Shader?

I am currently working on writing a shader for combination lighting. The idea behind it is to apply directional light, point light, and spot light in a single pass. I believe I can do this by: ...
0
votes
1answer
29 views

Typical Point Light Flow?

A Quick Note This question assumes you have some knowledge about the overall rendering process and do not need clarification on rendering objects with HLSL and a <...
0
votes
1answer
46 views

Why does order matter in constant buffers?

I have a rather peculiar question remaining after solving most of my own question on StackOverflow. When creating the constant buffers used by my shaders, I've learned that the order of variables ...
0
votes
1answer
27 views

HLSL Manual Alpha Blending

I'm trying to do alpha blending manually because I only want to apply alpha blending on certain pixels. Underlying is the texture I'm writing to. This is what I got so far, but it doesn't give the ...
0
votes
1answer
61 views

DirectX 11 Compute Shader error DXGI_ERROR_DEVICE_HUNG

I am trying to use a compute shader for ray picking technology. My shader accepts: vertex buffer of all models index buffer of all models a buffer of transformation matrices of all models Offset ...
0
votes
2answers
45 views

Extracting individual components of a vector in the Source Shader Editor

I'm using the Source Shader editor and would like to mask a vector output to one or two values, yet there is no existing mask node, as far as I can see. What HLSL code should I use to output what I ...
1
vote
1answer
32 views

What does vertex:disp and tessellate:tessEdge mean? [Shader] [Unity]

I came across the following declaration on unity tutorial #pragma surface surf BlinnPhong addshadow fullforwardshadows vertex:disp tessellate:tessEdge nolightmap ...
0
votes
1answer
39 views

Difference between texture.Load and texture.Sample(PointSampler,..) in HLSL/Dx

Conceptually, I understand the difference between load and sample but I want to know if essentially point sampling and load do the same thing when it comes to selecting a texture value (ignoring an ...
1
vote
0answers
69 views

Is there a quick-reference card for HLSL (DX9 or DX11)?

Does anyone know of a DX9 or DX11 counterpart to the GLSL quick-reference card from Khronos? The GLSL card is pages 8-11 here, and lists preprocessor directives, operators, types, and builtin ...
0
votes
1answer
122 views

HLSL float bitfield

In HLSL I want to store a bitfield for each color in a texture. Specifically spanning 3 floats (RGB, not alpha). Since each float has to be between 0 and 1 I can only use the significand/mantissa of ...
-1
votes
0answers
82 views

2D Lighting Shader Multiple Lights

For a 2D platformer, I have a 2D lighting shader with two passes, the first one draws a shadow from the closest light to the sprite and the rest of the lights will reduce the visibility of the shadow ...
0
votes
0answers
31 views

Using a light mask overlay without lighting the sky

I'm using an overlay to create a lighting effect in a 2D game. The overlay is a grey-scale mesh and I multiply each pixel of the mesh with the pixel already written to the framebuffer. This works ...
1
vote
2answers
299 views

2D Blizzard/Snowstorm Effect

How can I implement a blizzard/snowstorm effect in a 2D platformer? I have a particle system for snow particles, but I need some kind of windblown texture similar to this as well: How do I create this ...
0
votes
1answer
41 views

Using multiple textures in Monogame HLSL Effect shader?

My Monogame HLSL shaders only successfully sample one texture (besides the screen). Any additional textures I try to sample end up with the same texture data as the screen. I've found people with ...
0
votes
2answers
46 views

2D Camera Movement Temporal Reprojection

Having an Orthographic Camera with its View Projection Matrix given from the current and last frame, how to reproject the previous frame to the new one?
0
votes
0answers
50 views

Why do I have to set the rendertarget to null explicitly in MonoGame?

I'm using shaders in MonoGame. I have the following code, which works fine. It fills a scene with ambient light, and applies a 2-pass gaussian smoothing to the lightmask. I have one thing that bothers ...
0
votes
0answers
63 views

D3D12 SV_InstanceID + dynamic indexing not working?

I'm implementing geometry instancing in my engine and I am having trouble indexing the constant buffer that's holding per-instance data using SV_InstanceID. Am I doing something wrong? Here is the ...
0
votes
0answers
170 views

Add emission to shader

I wrote a shader for a targeting system. It creates a parabola of chevron arrows which slowly scroll in the direction of the trajectory. The chevrons also fade to zero alpha at the beginning and end. ...
1
vote
0answers
24 views

Effective way of transferring data to HLSL shader in MonoGame and storing it

I'm toying around with HLSL shaders in monogame. Lets say I want to use a structure in my shader which is like this: ...
0
votes
0answers
118 views

Chaining Multiple Shaders Together (Unity)

this is probably a really stupid issue, but I just don't know how to do it I have shader A: This one does pixel lit sprite shading. It's a cs file that just includes a ton of cgcinc files then I have ...
0
votes
1answer
55 views

Difficulty with Texture Alphas - HLSL

UPDATE 3: I have fixed the issue by reordering my effects (see my answer for details.) Anyone who wants to post more information based on that answer (either in an answer or in the comments) would be ...
0
votes
1answer
218 views

HLSL registers and slots

I'm learning DirectX11 and since I'm beginning to write some shader code I don't understand the difference between binding slots and HLSL registers. The shader model 5.0 introduced the keyword ...
0
votes
0answers
32 views

Projective texturing in DirectX11

I'm trying to implement reflections on flat surfaces and render a simple scene with a reflection. So I'm rendering the scene from the point of view of a camera symmetrical to the reflection plane and ...
0
votes
1answer
50 views

Alpha Blending older Images

I am working on re-writing an old game, and have faced some issues with the older images that were used, the first thing we done was convert all the old images and set the alpha channel on black ...
0
votes
1answer
94 views

Specular light for DirectX11

I illumine model through model illumine of Phong. Ambient and diffuse light’s constituent work well, but specular works wrong. Under this message I sent screenshoots: 1) ambient and diffuse 2) ...
0
votes
0answers
35 views

Is there another to blur a cubemap other than changing mip level for PBR?

I am working on a physically based shader and have encountered a problem of high mip levels not properly blurring environmental maps. At first I've tried to linearly interpolate between two mip ...
2
votes
1answer
1k views
0
votes
0answers
50 views

Passing in 2 arrays into HLSL pixel shader

I am in the process of learning how to use DirectX (using SharpDX). If you know DirectX they are both similar SharpDX is just a wrapper for DirectX. I was able to show a triangle using an index ...
0
votes
1answer
60 views

What does declaring a const float within a function do? (CGFX)

I've been working with this piece of code to get the mip map level that I should sample for a texture that I got off a forum somewhere. I noticed that they use a const float. Now from what I ...
0
votes
0answers
26 views

Setting up and using an ubershader in MonoGame

I'm creating a 2D engine with MonoGame. I initially clumped objects in the scene together based on the shader they were using; however, this caused several issues, such as layer depth not being ...
2
votes
1answer
344 views

Why do these DirectXMath functions seem like they return column-major matrics?

I know these questions have been asked a million times in various formats, but I'm getting weirdly skeptical about some of the row-major vs. column-major claims about the DirectXMath library. If I ...
0
votes
1answer
644 views

HLSL MipMap sampling in pixel shader

Using the Texture2D.Sample function, how does the pixel shader infer the mipmap level to use? Or does it use mipmap level 0? I am using the ps_4_0 shader model. And replacing Sample, with SampleLevel(...
1
vote
0answers
92 views

How can I rolling plane by vertex shader?

I have plane that i wanna roll it by vertex shader like this: https://www.desmos.com/calculator/mrfrugwvm5 this is my shader: ...
1
vote
0answers
55 views

dx Shader Model 3.0 break, continue, and loop attributes not recognized

I've been stuck on this problem for just too long. Long story short, the compiler returns "syntax error: unexpected token" for break, continue, [loop], [unroll] and pretty much every other attribute. ...
0
votes
2answers
141 views

Compiled shader not working?

I did a simple pixel shader that makes the texture monochrome, and it works perfectly when it is precompiled, but not when compiled (returns E_FAIL). The effect was compiled using fxc.exe with these ...
0
votes
2answers
197 views

Why doesn't my simple HLSL shader work?

I'm using Monogame to draw 2D primitives to the screen. To do that, rather than use included structures like VertexPositionColor, I wrote my own vertex class for 2D....
1
vote
1answer
77 views

Per pixel normal mapping resulting in static on normals starting on Z axis

For the past week I've been trying to implement bump mapping in DirectX 11 using the Frank Luna's '3D Game Programming with DirectX 11' book. I got it working until I tried to add a flat 2D plane ...
1
vote
1answer
174 views

Processing large multi layered images with SharpDX

I'm currently working on an image processing project that pans and zooms on multi-layer high resolution images. The goal is colorize (including color, gain and noise) ...
0
votes
1answer
190 views

How do I write to a 16-bit depth buffer using Monogame and HLSL?

I'm working on shadow mapping. Part of the implementation involves drawing 3D models to a depth buffer with recommended 16-bit depth. To that end, I'm first creating a render target as follows: ...
0
votes
1answer
42 views

about register reserved word or sementic in HLSL

I'm studying HLSL cookbook. In that sample code, author used a lot of register sementic. like this ...
0
votes
1answer
79 views

Shader Resource Binding

Im trying to set a constant buffer in my shader with a value. But getting nothing, no results. Code in shader ...
0
votes
1answer
1k views

Is there an HLSL equivalent to GLSL's “map” function?

Google has not helped me in this area. Here is the GLSL shader: ...