How would you index a texture in a compute shader to matched UV coordinates
If you have a compute shader with 16 by 16 by 1 threads, run 32 by 32 by 1 times, for a texture size 512 * 512, how would you index that in a way that would match the UV coordinates of a texture. This...
View ArticleHow would I use compute shader with physics?
Hello, I've been trying to make a simulation game using particles but my main problem is how to make them collide with each other. About everywhere I've looked had something talking about compute...
View ArticleHow do I use compute shaders with particles?
Hello, I'm trying to make a 2D mobile simulation game that is entirely based on particles. It's meant to have different elements you can spawn that act in different ways, at the moment I made water but...
View ArticlePass ComputeBuffer to another ComputeShader
Hello. I am using two compute shader for computing quite large texture. My process can be summarized as below steps. 1. Pass 'Texture 1' to 'Compute shader A'. 2. 'Compute shader A' produces new...
View ArticleHow to Update UI.Image for compute shaders?
So I've dove into some Compute Shaders because it's definitely better way to render anything you can think of - which for me is trying to render Voxels without dealing with polygons. Here's a quick...
View ArticleCompute Shader Threads
Can a Compute Shader kick off threads from within a kernel thread? Let's say I'm using a compute shader to get a single vector back from a GPU calculation. So I kick off 1 thread in my dispatch from...
View ArticleUnity doesn't recognize compute shader
Hi, everyone! I'm brand new to writing compute shaders in Unity, and I seem to have issues very early off. When I try to use any of the ComputeShader [functions][1] defined by Unity, it throws an...
View ArticleMath Question: Calculating force around Vector3 length inside a 3D Grid...
I'm having a tough time phrasing this question, so I'll do my best. I'd be happy to provide more details if necessary. Currently I have a kernel that is calculating a force within a certain radius...
View ArticleCompute shader "Fill With Red" example not working
I want to get started with compute shaders but I seem to be stuck on the very first step. Here is my example code: private void Update() { if (Input.GetKeyDown(KeyCode.G)) { m_outputRenderTexture = new...
View ArticleUsing compute shader to return whether texture has certain colour
I'm writing a Compute Shader which I need to do a very simple task: check whether any pixel in the image has green == 1 and blue > 0.5. (For clarity - the green channel is a 2d "light" and the blue...
View ArticleWhat is the cost of ComputeShader.SetBuffer
I would like to know if ComputeShader.SetBuffer has any overhead. I have a ComputeBuffer that I want to share between kernels since its rather large and I will need to set the Buffer for each kernel...
View ArticleBlack Screen in Android when calling compute shader dispatch in Update
Hello, I am trying to create a real time GPU Ray Tracer embedded in Augmented Reality using the Vuforia SDK. The ray tracer is done by rendering a texture on a Raw Image object nested inside a Canvas...
View ArticleComputeShader: Accessing array elements within a StructuredBuffer
I have been toying with ComputeShaders for a while now, and have been trying to use them to leverage the hair physics calculations I was doing in my game. The hair is based off a series of points that...
View ArticleReading and Writing to the same texture
Hi, I am trying to create a paint-like shader where the shader draws color into a texture while preserving the paint from the previous frame. #pragma kernel Paint Texture2D Input; RWTexture2D Out;...
View ArticleEfficient Multiplication of array of matrices
Im trying to update an array of matrices with the rotation of their parent object. However the matrix multiplication seems to be extremely slow, needing 5-6ms for around 2000 matrices. Thats my current...
View ArticleDebugging compute shader driver crash in editor
I'm writing a custom editor tool that uses compute shaders to generate meshes from implicit surfaces. This tool runs inside the Unity Editor, not inside the final executable. My invocation code is...
View ArticleDifferences between DrawMeshInstanced & DrawMeshInstancedIndirect
Im not sure if its a very simple question, but as far as I have read, I dont understand what is the difference between them and when one would outperforms the other. Thanks and sorry for my clumsy english
View ArticleHow should i draw a bezier curve in a compute shader? (Already works in c#)
Okay, so i've made this mess of c# code; it loops through all the pixels in the texture and and calculates the distance from points along the bezier curve (defined by vx and vy). This works fine in c#,...
View Article[Compute Shader] Porting an Image Effect Shader - Kuwahara Filter
Hi All I am trying to port an image Effect Shader to Compute Shader because I want to learn compute shaders. I chose to port [Kuwahara Filter][1] because I am generally interested in image filtering....
View ArticleWhere can compute shader compile errors be found on Mac?
When I create a compute shader that compiles, the inspector for the shader lists the kernels. If I introduce an error in the shader, the inspector shows no kernels, and I cannot find where the compile...
View Article