Questions tagged [hlsl]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
34 views

Rotate mesh to normal

I have some instanced geometry (basic tube meshes) laid out in a grid, and I have a noise texture (normal map) that I want to use to rotate my instances with. So head pixel in my texture is a normal ...
1
vote
1answer
38 views

Rendering colors from a texcoord output

I'm trying to implement a faster alternative to super-sampling for my isometric 2d monogame game (for when the view is zoomed out). The idea was that I would render the texture coordinates to the ...
0
votes
0answers
25 views

HLSL Texture Sampling Instability

I'm having some very strange behavior trying to calculate gradients in a shader. In both snippets, uv is the texture coordinate, duv is a float3 proportional to (1/width,1/height,0), c is tex2D(...
0
votes
1answer
23 views

Sampled texture from bitmap font produces blue glow

I'm creating a texture is DirectX 11 from bitmap fonts. I realize that I can use DXTK, but this is an exercise for me, not in learning another library. My sample code looks like this. ...
0
votes
0answers
24 views

Lighting abnormal when calculating in tangent space. Probably something wrong with coordinate transformation matrix

I'm trying to calculate lighting in tangent space. But I just keep getting abnormal results. I was modifying the book's demo code and I wander if there maybe something wrong with the transformation ...
1
vote
0answers
41 views

HLSL DXGI_FORMAT_A8_UNORM Texture - dark colors appear less opaque than white

I am trying to render a DXGI_FORMAT_A8_UNORM texture (precisely, a font bitmap) in multiple colors by specifying the color per vertex and then apply the alpha value ...
1
vote
1answer
44 views

how are semantics used when declaring a struct?

I don't understand how semantics are used in shaders. While reading Unity's shader tutorials, I come across this ...
0
votes
0answers
28 views

Calculating UV Coordinates in domain shader

Dears, I was trying to implement the terrain tutorial in Introduction to game programming by frank luna. I succeeded to implement it using the effect file. When I try to separate the Vertex, hull, ...
0
votes
2answers
114 views

Raymarching signed distance function resulting in holes on surface - step size required?

I've been learning about raymarching and signed distance functions, and I implemented a raymarching fragment shader in Unity. It works fine for geometric shapes such as cubes and spheres, but when I ...
1
vote
1answer
63 views

HLSL equivilant to “Object” data from “Texture Coordinate” node in Blender

I mocked up a shader how I wanted it with the node editor in Blender. Now I'm trying to write it in HLSL. In Blender there is a node group called "Texture Coordinate". If I use the "uv" node from the ...
1
vote
0answers
54 views

Alpha is not working in diffuse light shader

I am following this tutorials series on rastertek.com and I got a bit stuck on the Diffuse Lighting Tutorial. Particulary, the part that does not work for me is alpha channel of the light color. Here ...
0
votes
1answer
45 views

Steering constantly turning in circles

I've been working on a fish system in a compute shader but bugs have been drowning me. The latest bug had me strip almost all the functionality to track down: Fish keep turning in circles. It starts ...
11
votes
1answer
362 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
102 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
84 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 ...
0
votes
1answer
178 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
1answer
24 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
34 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
54 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
86 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
144 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
63 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
66 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
93 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
122 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
233 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
vote
2answers
489 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
86 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
74 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?
1
vote
0answers
34 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
1answer
63 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
421 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
41 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
58 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
131 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) ...
2
votes
1answer
2k views

How does the following code generate a full screen quad?

How does this ...
0
votes
1answer
123 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 ...
2
votes
1answer
704 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 ...
2
votes
1answer
1k 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
123 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
76 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
189 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
282 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
81 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
211 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
231 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
53 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
92 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
2k views

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

Google has not helped me in this area. Here is the GLSL shader: ...
3
votes
1answer
157 views

How is “resolution scaling” done?

Lots of new games use Resolution Scaling as an option. At first I thought it was just Super-sampling but it does not appear to remove aliasing so I'm assuming there is more to it than that. I guess ...