Click Anywhere in the Canvas and move your mouse a little

Bresenham Algorithmus

Raycasting is the process of figuring out, which surface corresponds with the current mouse position. For this a Ray is created. Starting at the camera position, shooting into the scene.

When working with the ThreeJS RayCaster I walked straight into a performance bottleneck. The Ray will be intersected with each triangle in the whole Scene. A solution for this was organizing the scene as a grid and only intersecting the ray with triangles that are withing the grid-cells, which are intersected by the ray.

Figuring out which cells to look at. Well this is what this experiment is for.