Esempio n. 1
0
        protected override bool ProcessNode(CommandBuffer cmd)
        {
            rtSettings.doubleBuffered = true;

            if (!base.ProcessNode(cmd) || inputMesh?.mesh == null)
            {
                return(false);
            }

            UpdateTempRenderTexture(ref outputVolume);
            UpdateTempRenderTexture(ref rayMapBuffer, overrideGraphicsFormat: GraphicsFormat.R32_UInt);
            MixtureUtils.SetupComputeTextureDimension(cmd, computeShader, TextureDimension.Tex3D);

            // Clear 3D render texture
            int clearKernel = mode == Mode.Signed ? clearSignedKernel : clearUnsignedKernel;

            cmd.SetComputeTextureParam(computeShader, clearKernel, "_Output", outputVolume);
            cmd.SetComputeTextureParam(computeShader, clearKernel, "_RayMapsOutput", rayMapBuffer);
            DispatchCompute(cmd, clearKernel, outputVolume.width, outputVolume.height, outputVolume.volumeDepth);

            // Rasterize the mesh in the volume
            MixtureUtils.RasterizeMeshToTexture3D(cmd, inputMesh, outputVolume, conservativeRaster);

            // Generate a distance field with JFA
            JumpFlooding(cmd);

            return(true);
        }
Esempio n. 2
0
        protected override bool ProcessNode(CommandBuffer cmd)
        {
            if (!base.ProcessNode(cmd) || inputMesh?.mesh == null)
            {
                return(false);
            }

            UpdateTempRenderTexture(ref outputVolume);

            // Clear 3D render texture
            cmd.SetComputeTextureParam(computeShader, 0, "_Output", outputVolume);
            DispatchCompute(cmd, 0, outputVolume.width, outputVolume.height, outputVolume.volumeDepth);

            MixtureUtils.RasterizeMeshToTexture3D(cmd, inputMesh, outputVolume, conservativeRaster);

            return(true);
        }