Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
0 answers
31 views

How to calculate Gertner waves normals?

I'm unable to properly calculate the normals for gertner waves following the Nvidia article vec3 get_wave(vec4 wave, vec2 direction,vec3 vtx) { // x = SPEED, y = WAVELENGTH, z = AMPLITUDE, w = ...
E F's user avatar
  • 11
0 votes
0 answers
42 views

HLSL Shader, Unreal- Float seems to cause performance problems

I'm building a shader in Unreal using HLSL, and the final piece of it looks something like this- // Check un-overlapped ranges for (int r = 0; r < range_count; r++) { if (combined_spheres[r].y !...
Hadi Soufi's user avatar
0 votes
0 answers
122 views

How to get shadow from additional light in Unity custom shader? (Self-solved)

I’m working on a project in Unity where I’m using a compute shader to render grass. The rendering path is Forward+, and I’m trying to make the additional lights affect the grass. I want to achieve ...
user16287208's user avatar
0 votes
1 answer
68 views

Issue with reading texture data inside RESHADE Pixel Shader

I am new to reshade, but not new to programming as a whole. I tried to implement a compute shader using modern re shade, who's information was then passed to a pixel shader that passed that data to ...
The Armored Panda's user avatar
1 vote
0 answers
78 views

Writing to a RWTexture2D in Fragment shaders

I'm new to this topic, and I know this sounds stupid, but I just really want to learn! So I found out I can write to RWTexture2D from my fragment shader(according to forum), but I can't really find ...
phal5's user avatar
  • 11
1 vote
0 answers
64 views

What is the use-case off an offset in texture sampling

In HLSL you can sample a texture with a coordinate and you can pass in an offset https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-to-sample The offset is added to texels, ...
samanthaj's user avatar
  • 650
2 votes
1 answer
258 views

Replacing PixelShaderCompile task with fxc.exe (necessitated by moving to VS2022). Getting same functionality. Putting in resource (embedded?)

As some may know, support for PixelShaderCompile has been done away with as of VS2022. One is suppose to use fxc.exe (I believe). For a discussion of this, see: Build pixel shader project in VS2022 I ...
Dave's user avatar
  • 8,601
0 votes
1 answer
518 views

How make shader for dashed outline of rounded rectangle?

How make dashed outline for rounded rectangle like in figma? I tried wrote this, but I did only part with rounded rectangle and outline based on subtraction two rounded rectangles with different ...
deadbit's user avatar
0 votes
0 answers
343 views

Unity does not consistently provide reflection probe colors in surface shaders

For some mysterious reason, only at certain camera positions/angles, a boilerplate surface shader does not properly return a color from unity_SpecCube0. It either returns pure black, or pure white, ...
Zoop's user avatar
  • 1,085
2 votes
0 answers
57 views

Holodeck effect: Surface shader only partially blocking surfaces behind it?

I am attempting to write a cubemap shader that can be applied to any geometry, with the goal to create a Holodeck-like effect. This shader would be applied to the walls/floor/ceiling of a room, and ...
Zoop's user avatar
  • 1,085
0 votes
1 answer
200 views

Detect single channel texture in pixel shader

Is it possible to detect when a format has a single channel in HLSL or GLSL? Or just as good, is it possible to extract a greyscale color from such a texture without knowing if it has a single channel ...
Robert's user avatar
  • 515
1 vote
0 answers
64 views

Is it possible to pass a custom position to calculate lighting in unity surface shaders?

I want to create a shader that uses different coordinates for light calculations than for what's being displayed. This probably sounds strange, but I would like to do this for lighting a top-down 2D ...
Snow Snakz's user avatar
2 votes
1 answer
153 views

How to step through 3D noise for volume textures?

I'm creating volume textures for volumetric ray marching (Creating this with Unity and a fragment shader) Example I have depth value that increases the starting position on the x, y or z axis. Doing ...
Buttermilch's user avatar
3 votes
1 answer
1k views

Build pixel shader project in VS2022

I have an old class library project that was building fine in a previous version of Visual Studio (2017 IIRC). The project contains an HLSL-based pixel shader that generates a radial color picker. I ...
dotNET's user avatar
  • 35.3k
1 vote
1 answer
406 views

Why does this HLSL pixel shader not compile?

I'm working on a ray tracing pixel shader and came across a weird error. I wrote the following code solely to generate the error, it's pointless but I can't figure out what's wrong with it. float4 ...
BubLblckZ's user avatar
  • 463
0 votes
1 answer
114 views

Red colored point light not projecting correctly [D3D11]

In my d3d11 scene, I have a point light projecting onto this planet. To help identify the fact that it is the point light, I colored it red in the code below. pointLight.light = /*DirectionalLight*/{ {...
Gunchap Red's user avatar
0 votes
1 answer
184 views

Discarding pixels in ps_2_0?

Everything I looked up online indicates it does microsoft documents etc (but doesn't mention version)... but when I do this code: float4 main(in float4 mXYZ : POSITION,in float4 mColor : COLOR0,in ...
KiraHoneybee's user avatar
0 votes
1 answer
231 views

Textures do not get accessed properly in pixel shader (DirectX11)

Textures are not being used by the pixel shader correctly. I am loading two separate textures in my pixel shader. However, most of the time, I can only ever display Texture1, even when I am trying to ...
V1aD1's user avatar
  • 13
0 votes
1 answer
752 views

Converting pixelshader asm to HLSL

I am trying to convert an inline asm ps_1_3 pixelshader back to HLSL and I am stuck at one instruction that I cannot find any documentation for. The instruction is +mov and such a modifier is not ...
Mats391's user avatar
  • 1,209
0 votes
1 answer
622 views

Mix asm vertex shader with HLSL pixel shader in effect

I'm working with legacy code that is using vs_2_0 and ps_2_0 assembly shader code in an effect file. I'm looking to add some pixel shaders to work with existing the vertex shader, but would like to ...
Matthew Dickerson's user avatar
2 votes
1 answer
360 views

How to optimize color reduction and dithering

I have the following function inside fragment shader, but it reduces fps by 7 half3 ClusterAndDithering(half3 color, half2 uv) { half2 clusters = half2(16, 16); color.xyz = RgbToHsv(color....
Artromskiy's user avatar
2 votes
1 answer
1k views

How to correct this HLSL pixel shader to round corners of a quad?

I'd like the make an HLSL pixel shader that can round the corners of a quad. I attempted to port this GLSL example the following way: cbuffer CBuf : register(b0) { float4 color; float2 ...
cecil's user avatar
  • 433
1 vote
1 answer
1k views

How do pixel values behave in DirectX 11 HLSL shaders?

When sampling texel values in a pixel shader, the sampler always returns a float4. However, the texture itself may contain any of a wide number of formats based on DXGI_FORMAT. It seems fairly ...
Murrgon's user avatar
  • 395
0 votes
1 answer
312 views

How to allow an overlapping object's edge to show in front of another object with the same shader?

This is what it looks like currently, but I want the black outline to outline the whole sphere when in front of the other object in the scene. OverlappingShadedObjects.jpg Here is my shader coder: ...
Matt's user avatar
  • 55
0 votes
1 answer
209 views

Having trouble converting a d3d9 pixelshader to d3d11

I've got this pixel shader that I'm trying to convert. I've corrected all the syntax for d3d11 but when I run the HLSL file through the compiler that spits out the .fxc file, it gives me this error: ...
ben's user avatar
  • 1
0 votes
1 answer
281 views

How to utilize matrix math for neighbour processing in HLSL?

I'm trying to do neighbour processing on GPU with HLSL, and I'm wondering if there is a way to load an array of neigbour samples at once and not just one sample, so that I can utilize matrix math ...
martinkarlik's user avatar
1 vote
0 answers
435 views

Easier way to use Texture2D array in shader

I want to use Texture2D array by easier way in PixelShader. That is, PS Texture2D map[3] : register(0); if (input.index == 0) color = map[input.index].Sample(samp, input.uv); else if (input.index ...
MC Smile's user avatar
0 votes
1 answer
967 views

Collision checking in pixel shader

I'm implementing kind of 3D Model tools using DirectX 11 and I need to paint the collision area between 2 meshes with Pixel-level accuracy. So I think I should do something in pixel shader but I don't ...
nocekdw's user avatar
  • 53
0 votes
1 answer
331 views

Alpha values below 0.5f are invisible

I am currently developing on a new mechanism to visualize laser beam hits on spaceships' shields. The development on the CPU side is done and the Vertex Shader is working fine, but I have an issue ...
GameDevAlien's user avatar
0 votes
1 answer
214 views

how can i get the pixel shader asm code "Ld"?I'm writing HLSL

When I'm reading the asm code ,I dont know how to get the instruction "ld" just below. Which function should I use in HLSL to get it? Or had it be replaced with the update of versions? The ...
SuperGeo0928's user avatar
0 votes
1 answer
641 views

How is vertex data used in pixel Shader

A triangle has 3 vertices. A pixel shader receives data from the vertex shader. If each vertex has a different color, the transition is calculated between the colors. This calculation of such a ...
Silentium Vetzo's user avatar
1 vote
2 answers
709 views

Cull off parts above the mesh

So, I want to make scene same to this Sphere Scene Now I have mesh with random generation as a ground and a sphere. But I dont't know how to cull off spheres geometry above mesh. Tried to use Stencil,...
Artromskiy's user avatar
0 votes
0 answers
318 views

Validation failure tex2D HLSL Shader Model 6.0

So apparently tex2D is still supported in HLSL shaderModel 6.0 so why does doing something like the following produce validation errors: float myFloat = tex2D(MySampler, In.texCoord).w; It does not ...
Sixjac's user avatar
  • 339
2 votes
1 answer
1k views

Flow Control in HLSL

I recently read this paper about raymarching clouds (careful it´s an PDF, in case you dont want that: http://www.diva-portal.org/smash/get/diva2:1223894/FULLTEXT01.pdf) where the author goes on about ...
foodius's user avatar
  • 63
0 votes
2 answers
414 views

XNA Distance Vector to HLSL float2

I have applied a noise effect to a texture using this pixel shader. float2 noisePower; float noiseFrequency; float camMoveX; float camMoveY; texture noiseTexture; sampler2D noiseSampler = ...
Lamar's user avatar
  • 641
1 vote
1 answer
581 views

C# WPF Brush to Blur the Canvas

I have a canvas in which I add a child image element. <Canvas SnapsToDevicePixels="True" Width="56160" Height="37440"> <Image Width="56160" Height="37440" x:Name="OverlayImage"/> </...
Maxim_A's user avatar
  • 378
1 vote
1 answer
432 views

Why can't I access matrices in hlsl pixel-shader?

I'm learning how to create effects for wpf using hlsl. I'm currently trying to make a simple effect that marks edges in an image. I want too use the Sobel operator for this, so I set a public float2x3 ...
Rotem Steiner's user avatar
2 votes
1 answer
2k views

Unity 3d Sprite Shader (How do I limit Max Brightness to 1 with Multiple Lights Hitting)

I am creating a videogame in Unity. Every sprite is rendered with a Sprite Renderer with a Material that has the CornucopiaShader.shader. The problem I have is I want to limit the max brightness (or ...
David's user avatar
  • 65
1 vote
0 answers
690 views

The homemade Chroma Key filter I developed in OBS-Studio can't use the usual green or blue background, but it can be used in red

I refer to the OBS Studio 20.1.0 documentation and chroma_key_filter.effect on github. I have had a problem with the recent homemade obs-studio filter. I can't think of how to solve it. I want to ask ...
Jared C's user avatar
  • 11
8 votes
1 answer
4k views

Why "Warning X4000: use of potentially uninitialized variable" shows for more than one usage of common method?

I have a common method in hlsli /// RendererShaderTypes.hlsli /// static inline float4 OverlayColor(float2 texOverlay, float4 videoColor) { float4 texColor = float4(imageMixTexture[4].Sample(...
Tajuddin Khandaker's user avatar
0 votes
1 answer
137 views

Why is there a non-smooth reduction in intensity for attenuated light?

I'm trying to implement light attenuation in a Phong shader. The pixel/fragment shader does the following calculation (per light source): float3 refl = reflect(e, n); float dist = length(L.xyz); ...
user1803551's user avatar
  • 13.4k
4 votes
1 answer
243 views

Which texture slot should be used to start where I need 7th and 8th slot together among 0 to 8 index of 9 resources

I have total 9 texture resources among them I need 2 resources together for a pixel shader. In that case what should be the texture slot start index if I need the 7th and 8th texture resources only. (...
Tajuddin Khandaker's user avatar
1 vote
1 answer
3k views

Combining Two Shaders into One Shader

Unity Project, Want to combine these two shaders into one shader to get both of their functionality. One shader is for lighting, the other shader is for rendering better. How do I combine? Shader "...
David's user avatar
  • 65
1 vote
0 answers
757 views

HLSL custom bitpacking not working correctly

I'm a bit of a noob with Directx but i have been trying to get this custom bitpacking working all day. I'm trying to pack a float4 and another float into a uint. The float4 is a color and the float is ...
kostenickj's user avatar
0 votes
1 answer
636 views

Tex2D returns interpolated values when off pixel center in HLSL

The Tex2D function returns interpolated values when off pixel center ((0.5, 0.5) for instance), this is really a problem when you have a large texture like 1920x1080. I have an HLSL pixel shader ...
Martin's user avatar
  • 335
4 votes
0 answers
2k views

Object-To-Clip for Unity Canvas Image Shader

The TL;DR When applying a shader to a UI.Image object in a Unity3D canvas, UNITY_MATRIX_MVP appears to be relative to the Canvas renderer, and not the Image object itself being drawn. Is there a ...
Johannes's user avatar
  • 6,419
0 votes
0 answers
207 views

HLSL lighting based on texture pixels instead of screen

In HLSL, how can I calculate lighting based on pixels of a texture, instead of pixels that make up the object? In other words, if I have a 64x64px texture being rendered on a 1024x768px screen, I ...
Felipe's user avatar
  • 11.9k
7 votes
2 answers
2k views

Greenish image with BGRA to YUV444 conversion using DirectX11 pixel shader

  I'm new to HLSL. I am trying to convert color space of an image captured using DXGI Desktop Duplication API from BGRA to YUV444 using texture as render target.   I have set my pixel ...
Balakrishna Avulapati's user avatar
-1 votes
1 answer
1k views

How to fix shader invert y on IOS

This is shader to make UI blur. This shader work fine with android, but the y is invert on IOS device. I try to search for an answer but I don't understand how to implement it. Because it is using ...
Tengku Fathullah's user avatar
0 votes
1 answer
85 views

Artefact in shader for iOS

kernel vec4 custom(__sample s1, __sample s2) { if(s1.a == 0.0) return s2; if(s2.a == 0.0) return s1; vec4 res; float ...
Vahe Karamyan's user avatar