- Home /
Can't get Math Functions to Work in Compute Shader
I have a compute shader that currently only draws to textures. But I want to use the same script to do the math that the cpu is doing. However when I try the code below, nothing happens. I know I am calling, and initializing everything correctly because I am drawing to the textures in the same kernels. This is the code I am trying to run:
for(int i=0; i<positionsX.Length; i++){
int xPos_FrontandBack = round (tan (atan (buffer[1] / buffer1[1])) * w / 2);
int yPos_FrontandBack = round (tan (atan (buffer1[1] / buffer2[1])) * w / 2);
if (abs (atan (positionsX[i] / positionsZ[i])) < 0.785 && positionsZ[i] > 0 && abs (xPos_FrontandBack) < w / 2 && abs (yPos_FrontandBack) < w / 2) {
tex0[int2(xPos_FrontandBack + w / 2, yPos_FrontandBack + w / 2)] = float4(1, 1, 0, 1);
}
}
When this compiles there are no errors, or anything at all that appears in the console. When it is run in the game, nothing happens. What is happening here, and how can I get this to work?
Your answer
Follow this Question
Related Questions
[Solved] False "variable not assigned" error 3 Answers
Shader / Compute Shader in Unity 1 Answer
jungle terrain problem 0 Answers
How is _WorldSpaceLightPos0 calculated for a directional light? 0 Answers
Incremental game need help 1 Answer