Shader optimizations

This commit is contained in:
2025-10-23 07:55:29 +02:00
parent 4ef1b04156
commit 40a6d832bc
3 changed files with 133 additions and 121 deletions

View File

@ -24,7 +24,7 @@ public class Player : MonoBehaviour
VoxelRaycastGPU.Ray[] rays = new VoxelRaycastGPU.Ray[rayCount];
FillRaysArray(rays);
voxelManager.gpuRayCaster.Init(rayCount, rays, 3);
voxelManager.gpuRayCaster.Init(rayCount, rays, 5);
}
void Cast( ref VoxelRaycastGPU.BatchData[] batchData, int batchCount, int iIteration )

View File

@ -95,18 +95,20 @@ public class VoxelRaycastGpuManager
countBuffer.GetData(countArr);
currentCount = countArr[0];
sw.Stop();
VoxelRaycastGPU.BatchData[] hits = new VoxelRaycastGPU.BatchData[currentCount];
hitBuffer.GetData(hits, 0, 0, currentCount);
for( int i = 0; i < hits.Length; i++ )
{
GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
sphere.transform.position = hits[i].origin;
sphere.transform.localScale = Vector3.one * 0.5f;
}
sw.Start();
/**
sw.Stop();
VoxelRaycastGPU.BatchData[] hits = new VoxelRaycastGPU.BatchData[currentCount];
hitBuffer.GetData(hits, 0, 0, currentCount);
for( int i = 0; i < hits.Length; i++ )
{
GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
sphere.transform.position = hits[i].origin;
sphere.transform.localScale = Vector3.one * 0.5f;
}
sw.Start();
*/
iteration++;