Math 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 ArticleCalling Graphics.DrawProcedural multiple times for chunked procedural terrain
In my project, I'm creating chunks of 3D procedural terrain (voxels) using a series of compute shaders and then passing the vertex data of each chunk from a ComputeBuffer to the Graphics.DrawProcedural...
View ArticleCompute shader on UWP
Hi everyone, I have some difficulties on running a very simple test compute shader on UWP. As a base I have a very simple shader and script running just fine on a Quad in my Unity editor (5.6.0f3). But...
View ArticleHow to build for Mac to make compute shaders work?
The problem is that even though 5.6 supposed to compile compute shaders for Metal, it didn't work for me. I created a simple project: compute shader is used to render a fractal. Then I just made Mac OS...
View ArticleImplementation of GPU Flocking?
Hi, I'm new to Unity and Compute Shaders. I'm trying to implement GPU Flocking using compute shaders in Unity to show that GPU Computing is faster than the CPU . I've managed to write a script and...
View ArticleSystemInfo.supportsComputeShaders always false on Android
Hello, I'm trying to get compute shaders to work on Android but SystemInfo.supportsComputeShaders always return false when my target platform is Android. When I select Windows as my target platform, it...
View ArticleUpload list of textures to the GPU to be used with compute shaders ?
Hi, i need to collect ( have no problem with this ) and upload all the textures used in a scene to the GPU memory. ComputeShader.SetTexture() can set a single texture only. Is there any way of loading...
View ArticleHow does one do compute shaders(with particles)?
So, this is my first attempt at compute shaders and I'm quite lost... ANY help or referral is higly appreciated. ---------- My goal is to achieve an effect that I've only been able to identify as...
View ArticleCompute shaders not working in editor but working on device
I have started learning compute shaders. And I found a really good project on github (https://github.com/antoinefournier/XParticle) that would help me learn and experiment with compute shaders. As I...
View ArticleHow to write to a RenderTexture as a cubemap
So after a lot of digging I found RenderTexture.isCubeMap. Then I found that it was obsolete. Then I found RenderTexture.dimension and, by extension, UnityEngine.Rendering.TextureDimension.Cube which...
View ArticleHow to disable Warnings in Compute Shaders ?
Hi, We are using Compute Shaders in our project and doing quite a lot of math operations. A warning is always generated : ***"Shader warning in 'VertexGenerator.compute': integer divides may be much...
View ArticleWhat does "Pass platform caps keyword defines to compute shaders" mean?
In the [2017.1.0 release notes][1] it says "Shaders: Pass platform caps keyword defines to compute shaders." What does that mean? [1]: https://unity3d.com/unity/what's-new/unity-2017.1.0
View ArticleCompute Shader calculation time
Hi, how can I know for sure that from the moment I call: shader.Dispatch(kernelHandle, x, y, z); the next line the compute shader is done with the calculations? I mean, lets say I want to calculate...
View Article