Questions tagged [compute-shader]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
0answers
27 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 ...
0
votes
0answers
91 views

Marching cube terrain generated by compute shader gives strange error

I'm creating my own terrain terrain system for Unity using marching cubes but I've run into a problem I'm stumped on. First I'll explain how it works: A compute shader creates an array of points ...
0
votes
0answers
14 views

Unity, connecting unlit shader output to compute shader?

I'm hoping to learn what my options are for sharing the outputs of simple unlit shaders with compute shaders that will operate on the data. Is my only course of action to use a render texture with the ...
0
votes
0answers
31 views

Updating Texture in Compute Shader

I am new to compute shaders in unity, and trying to understand how they work. I have distilled the problem to this one: I have a script "Panel.cs" which uses a compute shader "...
0
votes
1answer
278 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 ...
0
votes
1answer
116 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 ...
0
votes
1answer
23 views

How to synchronize reads and writes to a StructuredBuffer across warps in HLSL?

I'm currently trying to implement smooth voxel terrain (using dual contouring) with mesh generation happening on the GPU and I'm struggeling with chunked level of detail creation. My approach is as ...
0
votes
0answers
239 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 ...
0
votes
3answers
164 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 ...
0
votes
0answers
45 views

ID3D11DeviceContext:::CopyResource is bottleneck in my particle system

I have a snow particle system and I use simplex noise for creating turbulence effect. At first, I made calculations on the CPU, and the simplex noise calls obviously were the bottleneck. The ...
1
vote
1answer
85 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 ...
0
votes
0answers
80 views

How does DrawProceduralIndirect use MeshTopology.Triangles?

I'm working on a voxel terrain generation system. Currently I'm running into issues using DrawProceduralIndirect. In the call, you are able to choose how the GPU should render the data you are passing....
2
votes
0answers
134 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 ...
0
votes
0answers
89 views

Floodfilling a texture in HLSL Compute shader

I have a very large texture which I want to fill with values representing "distance in units from a river tile". The texture is already seeded with these origin river points (meaning ...
0
votes
0answers
48 views

Compute Shader vs Pixel Shader

I am pretty new to game development and graphic stuff. I find that compute shader is somehow more powerful and flexible than Pixel Shader for almost everything I need so far. But Pixel/Fragment shader ...
1
vote
0answers
45 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), ...
1
vote
0answers
296 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 ...
2
votes
0answers
33 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 ...
0
votes
1answer
102 views

Passing touch position to compute shader

I am working on a game where I have to mix colored liquids as shown here. I am working with a plugin (StableFluids) to get this effect: Effect Problem: The shaders used in the plugin are able to ...
2
votes
1answer
1k 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 ...
0
votes
1answer
2k 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 ...
2
votes
0answers
163 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: ...
1
vote
0answers
418 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) ...
1
vote
1answer
182 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 ...
1
vote
1answer
89 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 ...
0
votes
0answers
119 views

How Lots of ComputeBuffers at Once Affect Performance Unity

How will lots ComputeBuffer instances affect performance? And why? I know that I should call ComputeBuffer.Release() on every <...
3
votes
0answers
41 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: ...
0
votes
0answers
208 views

GLSL Atomics With Floats

I am implementing SDSM and in a GLSL compute shader I need to min/max vec3 values to compute the shadow map bounds. The sample implementation (in HLSL) uses vectors in "light space" that spans from 0-...
1
vote
0answers
458 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 ...
2
votes
1answer
1k views

How to write a PBR Unlit Shader in Unity?

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 ...
0
votes
1answer
67 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 ...
0
votes
1answer
427 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 ...
1
vote
0answers
797 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 ...
2
votes
1answer
524 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 "...
0
votes
1answer
3k 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 ...
0
votes
1answer
954 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 ...
2
votes
2answers
3k 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 ...
0
votes
1answer
95 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: <...
1
vote
0answers
763 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: ...
0
votes
1answer
161 views

Why does my triangle ray intersection test always return -1.0f?

I'm trying to get the mouse click position on a terrain geometry, but multiple times in each frame; doing it on the CPU was way too slow, so I'm trying to do it with a compute shader. I can't seem to ...
1
vote
1answer
583 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 ...
0
votes
1answer
165 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 ...
2
votes
1answer
319 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'...
1
vote
1answer
285 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 ...
2
votes
0answers
433 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 ...
15
votes
1answer
344 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 ...