I was following a tutorial on the Marching Cubes algorithm that is presented by Sebastian Lague. He shared the project in github but I was unable to get it to work. He is on Windows and no doubt using DirectX11, while I'm on Linux using OpenGLCore. In theory this shouldn't be a train-smash because Unity is able to convert from HLSL to GLSL, but in my particular case I'm getting errors with linking the shader, which I'm assuming is due to a failed conversion and/or compilation. I believe there are some conventions to follow when writing a "convertable" HLSL shader (like not using float3), and in this case those precautions weren't deemed necessary by the author. I don't want to rule out the fact that it might just be my settings and/or drivers that are causing problems, so I was hoping that someone could try this using OpenGLCore on their machine. If it is a matter of the conversion failing, is there any easy way to "force" it to work? I changed the `float3`'s to `float4` and updated the code to handle those, but that alone didn't seem to do the trick. In lieu of getting that to work, is there a way of removing the compute shaders entirely and just having the MeshGenerator generate the mesh? Any help would be greatly appreciated here!
Let me try to be more specific. Is there anything in this script that looks like it will be problematic to convert from HLSL to GLSL? Code (CSharp): StructuredBuffer<float3> offsets; int octaves; float lacunarity; float persistence; float noiseScale; float noiseWeight; float floorOffset; float weightMultiplier; bool closeEdges; float hardFloor; float hardFloorWeight; float4 params; [numthreads(numThreads,numThreads,numThreads)] void Density (int3 id : SV_DispatchThreadID) { if (id.x >= numPointsPerAxis || id.y >= numPointsPerAxis || id.z >= numPointsPerAxis) { return; } float3 pos = centre + id * spacing - boundsSize/2; float offsetNoise = 0; float noise = 0; float frequency = noiseScale/100; float amplitude = 1; float weight = 1; for (int j =0; j < octaves; j ++) { float n = snoise((pos+offsetNoise) * frequency + offsets[j] + offset); float v = 1-abs(n); v = v*v; v *= weight; weight = max(min(v*weightMultiplier,1),0); noise += v * amplitude; amplitude *= persistence; frequency *= lacunarity; } float finalVal = -(pos.y + floorOffset) + noise * noiseWeight + (pos.y%params.x) * params.y; if (pos.y < hardFloor) { finalVal += hardFloorWeight; } if (closeEdges) { float3 edgeOffset = abs(pos*2)-worldSize + spacing/2; float edgeWeight = saturate(sign(max(max(edgeOffset.x,edgeOffset.y),edgeOffset.z))); finalVal = finalVal * (1-edgeWeight) - 100 * edgeWeight; } int index = indexFromCoord(id.x,id.y,id.z); points[index] = float4(pos, finalVal); }