Questions tagged [compute-shader]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
15 votes
1 answer
374 views

Flowing GPU compute water

I have a civil engineering background and perform hydraulic and hydrologic analysis' regularly. They sell degrees for that sort of thing, but it's really not rocket science. I recently got it in my ...
Jon's user avatar
  • 3,684
3 votes
1 answer
926 views

Solving a recursive problem in the geometry (or any other) shader

I would like to calculate an effect of an external force on a binary tree (wind on a tree). It's a recursive function - take a (parent) node and calculate the angle to rotate all of the nodes "...
Karlovsky120's user avatar
3 votes
0 answers
54 views

issue with Compute Shader macbeth chart

I'm trying to generate a macbeth chart using the compute shader, but there seems to be an issue with the output image. here is the glsl code: ...
Jay Ebhomenye's user avatar
2 votes
2 answers
512 views

Compute Shader generating data for use on CPU

I'm trying to create a compute shader that will generate and manage the movement of a point cloud. The shader needs several thousand points to work on and I want to pull back the first dozen or so. ...
Basic's user avatar
  • 1,141
2 votes
2 answers
6k views

Pseudo random number generation in compute shader

Using a C# script in Unity3D to control a HLSL compute shader, I'm trying to generate pseudo random numbers on the gpu. Following along with GPU Gems 3 Hybrid Tausworthe method and another thread ...
slanden's user avatar
  • 121
2 votes
2 answers
841 views

How to evaluate a binary expression tree in HLSL without recursion or a stack?

I'm currently working on a dual contouring implementation for which I want to create procedural terrain based on layers of noise. Both, the terrain generation and the mesh creation via dual contouring ...
Tuntenfisch's user avatar
2 votes
1 answer
3k views

Unity3D URP - How do I approach creating Fog of War for 3D top-down stealth game?

What I try to achieve is a fog of war system for 3d top-down stealth game. I have searched the Internet and it seems that behavior I want to achieve can be done by using secondary camera that is ...
Zekko's user avatar
  • 21
2 votes
1 answer
359 views

How to sort tiled decal list?

I have a tiled forward render pipeline (also called forward+). It assigns a list of lights for every 16*16 block of pixels (tiles) on the screen. Lights are accumulated additively so their order doesn'...
János Turánszki's user avatar
2 votes
1 answer
2k views

Send an array of struct to compute shader

I am using Unity to send two types of data to the Compute Shader: A struct: struct Flock { public Vector3 position; public Vector3 velocity; } And an ...
Aaron Z's user avatar
  • 33
2 votes
1 answer
451 views

Splitting up HLSL code into separate functions causes the number of needed temporary registers to increase

EDIT Per request I've provided a simple compute shader that reproduces the problem. The compute shader below is kind of a contrived example meant to compute the rolling average over an input ...
Tuntenfisch's user avatar
2 votes
0 answers
444 views

Creating the Vertices and Triangle Indices for Voxel Generated Mesh

I am running into a problem with a compute shader I am writing to generate the vertices and triangle indices for a voxel generated mesh. Currently, I am creating an ...
Tom Himler's user avatar
2 votes
1 answer
1k views

Problem unrolling loop in compute shader

I'm pretty new to compute shaders and shader writing in general. I'm trying to write a compute shader for a procedural generation project I'm working on, it's purpose is to blend biomes together. The ...
DBurn's user avatar
  • 23
2 votes
0 answers
44 views

How to generate a star onto a render texture with spherical warping

How would one proceduraly generate a star in a compute shader that looks like one of thes two at any size needed. Also any way transfer this into a spherical map, would be appreciated. Goal is to ...
chief65's user avatar
  • 21
2 votes
0 answers
467 views

Vulkan imageLoad data of r32f format in compute shader

I am doing add with a compute shader. All input-output data are stored in VkImage, the format is VK_FORMAT_R32_SFLOAT. In the shader, the corresponding layout is r32f. I have two questions about this: ...
whoami's user avatar
  • 31
2 votes
1 answer
1k views

How to write a PBR Unlit Shader in Unity? [closed]

I have a REALLY specific case here: I have an Texture (a webcam), that is used by a shader to pickup a few x,y colors at the cordinates, and renders to a ...
Ivan Seidel's user avatar
2 votes
0 answers
468 views

RWTexture3D in Compute Shader on Intel HD 4000

I'm having some weird issues running a Compute Shader with DirectX 11 on an Intel HD 4000 GPU. The goal is to write different shapes into a DXGI_FORMAT_R32_FLOAT 3D Texture with a size of ...
Lukas F.'s user avatar
  • 121
1 vote
1 answer
380 views

DirectX shader - how to spread raytracer computation over multiple frames?

I'm playing around making a shadertoy style SDF raytracer in HLSL and to make it run faster on high resolutions (1080p and up) I'd like to spread the computation over multiple frames. Right now I ...
Spectraljump's user avatar
1 vote
1 answer
369 views

Why does it take around 5 times longer to sample large RenderTextures vs. sampling large Texture3D/2Ds in a Compute Shader?

Firstly I am in Unity 2021.3.11f1 using DX12. So the situation is the following. I have a large 3D RenderTexture, and I have a large 3D Texture3D with the same data, same format, same dimensions, same ...
Pjbomb2's user avatar
  • 11
1 vote
1 answer
576 views

Unity: running GPU intensive operations in editor mode

I have written an erosion simulator that I want to execute from the editor (for generating terrain and such outside of play mode). Unfortunately, when I crank the parameters on my simulation, unity ...
otoomey's user avatar
  • 196
1 vote
1 answer
119 views

OpenGL approach to depth-testing-like combination of a large buffer of fragments

I have a depth buffer and color buffer created by another effect. The buffer is more than double my screen size. It is not rendered from geometry, but as a whole it resembles a rendered scene with an ...
user1920703's user avatar
1 vote
1 answer
4k views

Using a Compute Shader in Unity to convert a texture to a float array

I have a fairly simple requirement for a compute shader (DirectCompute through Unity). I have a 128x128 texture and I'd like to turn the red channel of that texture into a 1d array of floats. I need ...
EmmetOT's user avatar
  • 121
1 vote
1 answer
720 views

Batch/Combine multiple Graphics.DrawProcedural-Calls in Unity

I have multiple calls to Graphics.DrawProcedural in my Unity-project. E.g. I'm drawing 1000 procedural geometries that share the same material and get their ...
Christoph's user avatar
  • 135
1 vote
0 answers
48 views

How to connect terrain chunks smoothly? [duplicate]

I'm generating a 3D terrain chunk based on Simplex Noise and Marching Cubes algorithm to create mesh. My chunks have global coordinates (x,y) e.g: (0, 1), (-1, 1)... Noise is generated using Compute ...
aress's user avatar
  • 21
1 vote
0 answers
275 views

Generating Shader Includes via script at compile time

I'm experimenting with compute shaders in Unity. A pretty typical thing you wanna do is marshal a buffer of structs back and fourth between C# and HLSL land. Ordinarily you'd have to manually define ...
Charly's user avatar
  • 742
1 vote
1 answer
2k views

Difference between ComputeBuffer and GraphicsBuffer in Unity?

At first I thought that ComputeBuffer's could only be used in compute shaders and that GraphicsBuffer's could only be used in ...
Bartimaeus's user avatar
1 vote
0 answers
958 views

OpenGL Compute Shader vs Fragment Shader device support

I have a game with massively parallelizable logic, which I intend to write calculate on the GPU (Java/LibGDX). I am planning to implement a logic for it through a fragment shader, instead of a compute ...
Dávid Tóth's user avatar
1 vote
0 answers
93 views

GLSL link fails with C9999 (too many buffer declarations?)

I'm receiving a C9999 (*** exception during compilation ***) linker error for an OpenGl 4.6 compute shader. It seems to be related to the number of SSBOs I have declared (14 separate declarations), ...
gdevi's user avatar
  • 11
1 vote
0 answers
878 views

Unity Direct Compute: Setting a struct of arrays

The NVIDIA Direct Compute programming guide lists some best practices for memory management on the GPU. One tip they give on page 8 ("Structured Buffers") is to use a 'structure of arrays' (SOA) ...
otoomey's user avatar
  • 196
1 vote
0 answers
659 views

Generating Mesh using Compute Shaders

I am working on a game project in unity which has a procedurally generated terrain made up of 16*128*16 chunks of blocks. The map size is going to be finite (Possibly up to ~100*100 chunks). Currently ...
Jack Radforth's user avatar
1 vote
0 answers
1k views

How to get Pixel Coordinates of certain colors in a Texture?

I have a relatively big Texture, and I try to find a certain color pixels pattern: eg. White, Black, White, Green . They are lying next to each other, If I use Texture2d.Getpixels() on every pixel ...
OC_RaizW's user avatar
  • 1,460
1 vote
0 answers
1k views

Passing an UAV to a Pixel Shader in DirectX11

I have a compute shader which task is to take an input image and then blur it using a Gaussian filter approach. The input and output for the compute shader looks like this: ...
Riggs's user avatar
  • 69
0 votes
1 answer
234 views

Why can't I use the "degrees" character in HLSL comments?

I was in the process of creating a function in my compute shader that converts a 180° angle to a 360° CCW angle like this: ...
Keheck's user avatar
  • 31
0 votes
1 answer
288 views

Flickering in mesh created procedurally using compute shaders and compute buffers

I'm attempting to create a mesh using compute buffers in Unity(2022.2.11). So far I've got the mesh rendering however parts of it periodically flicker frame to frame. I'm assuming I've done something ...
Hex Crown's user avatar
0 votes
1 answer
95 views

Looking for an advice on how to possibly boost my compute shader

I have 4 rendertargets R10G10B10A2 each being used to store color and normal in a compact double RGB 555 bits format. When I'm doing the lighting pass I'm obliged to have extra rendertargets because ...
philB's user avatar
  • 99
0 votes
1 answer
210 views

In theory, would an erosion algorithm compute faster on a GPU than CPU?

I'm planning to port an erosion algorithm from CPU to GPU, in theory, will it be faster or would it be better to multi-thread it on the CPU? The algorithm has quite a lot of if statements and loops ...
Werem's user avatar
  • 148
0 votes
1 answer
107 views

Gaps between terrain chunks generated with marching cubes

My generated terrain chunks have gaps between them: I'm using Compute Shader and Simplex Noise from FastNoiseLite library to generate noise: ...
aress's user avatar
  • 21
0 votes
2 answers
42 views

error X3671: loop termination conditions in varying flow control cannot depend on data read from a UAV

I have a problem with converting my pixel shader to compute shader. The error is in this piece of code: ...
philB's user avatar
  • 99
0 votes
1 answer
198 views

Reliably addressing compute buffer when using large numbers of threads

I'm trying to move a 262,144 [2^18] points (stars) in a compute shader and am struggling to reliably address the data in a buffer. I understand that there's a 3-dimensional array ...
Basic's user avatar
  • 1,141
0 votes
1 answer
122 views

d3d11 compute shader compile failed

I want to comiple a compute shader from text, but it failed with 0x8e16d728 error. ...
Xinggang Li's user avatar
0 votes
3 answers
450 views

Voxel raycasting algorithm not working correctly

I am using Unity with a compute shader to render to a texture. So far I have been checking points along the rays in units of 1 just for testing, so I know it works. Now I am simply trying to write a ...
Tristan367's user avatar
0 votes
1 answer
7k views

Compute shader: Property at kernel index is not set

I am trying to follow this excellent Coding Adventure: https://www.youtube.com/watch?v=lctXaT9pxA0 in order to get a very simple mesh deformation on a mesh using a compute shader. I'm getting an error ...
Glen Pierce's user avatar
0 votes
1 answer
622 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 ...
Range's user avatar
  • 159
0 votes
1 answer
1k views

Vulkan Storage Buffers, loss of data

I have been passing glm::vec3's in an array to a storage buffer to be processed by a compute shader, but once it has been modified I am getting some malformed data back. Shader ...
0xen's user avatar
  • 453
0 votes
1 answer
135 views

Get VertexSize of Instance in VertexShader

I'm using Unitys DrawProceduralIndirect function to directly render the content of a ComputeShader. I setup the argumentBuffer for this function as follows: <...
Christoph's user avatar
  • 135
0 votes
0 answers
23 views

Some of the assignment operations in the directx11 compute shader are getting skipped, even though the assigned values are used later

I'm implementing an algorithm called Fast3x3 SVD on my compute shader. However, while I was debugging my compute shader in RenderDoc, I noticed some assignment operators were completely getting ...
ThisAccountIsForGameDev's user avatar
0 votes
0 answers
43 views

What are the Godot equivalent to these Unity types and Functions for graphics processing?

Here are some unity types in this script: https://github.com/aras-p/UnityGaussianSplatting/blob/main/package/Runtime/GaussianSplatRenderer.cs which I am trying to convert to Godot: ...
Ethan's user avatar
  • 145
0 votes
0 answers
119 views

Unity Compute Shader InterlockedMin Max not work on Android

I have a Compute Shader which uses InterlockedMin() and InterlockedMax(). The Compute Shader works very well on my PC (AMD ...
Khang Dinh Hoang's user avatar
0 votes
0 answers
25 views

ComputeShader.SetTexture() isn't writing to the shader

The C# script: ...
Nikhil Nair's user avatar
0 votes
0 answers
36 views

Convolution matrix based minimum distance calculation

I want to detect the minimum distance to each game object within a convolution matrix in a compute shader. I know the code is a bit to read, but the logic itself is not too complicated. I am trying to ...
rasputin's user avatar
0 votes
0 answers
45 views

INSANE Slowdown when implementing MSAA

I am trying to implement MSAA in my very simple raytracer. However, when I do, my program gets and insane slowdown. I am working in Metal, and on the Metal HUD, I can see that my frametimes drop from ...
oli2's user avatar
  • 3