# \#raycasting

**URL:** https://discourse.threejs.org/tag/raycasting/429.md

[Latest](https://discourse.threejs.org/latest.md) · [Categories](https://discourse.threejs.org/categories.md) · [Tags](https://discourse.threejs.org/tags.md)

---

## [Three.ez/InstancedMesh2 - Enhanced InstancedMesh with frustum culling, fast raycasting (BVH), sorting, visibility management, LOD, skinning and more](https://discourse.threejs.org/t/three-ez-instancedmesh2-enhanced-instancedmesh-with-frustum-culling-fast-raycasting-bvh-sorting-visibility-management-lod-skinning-and-more/69344)

<div class="topic-metadata">

**Author:** [@agargaro](https://discourse.threejs.org/u/agargaro)\
**Replies:** 15\
**Last updated:** [November 5, 2026, 9:06am UTC](https://discourse.threejs.org/t/three-ez-instancedmesh2-enhanced-instancedmesh-with-frustum-culling-fast-raycasting-bvh-sorting-visibility-management-lod-skinning-and-more/69344 "2026-11-05T09:06:59Z")

</div>

Three.ez - InstancedMesh2 Simplify your three.js application development with three.ez! InstancedMesh2 is an alternative version of InstancedMesh with enhanced features for performance an…

---

## [Simulated Spatial Audio](https://discourse.threejs.org/t/simulated-spatial-audio/92443)

<div class="topic-metadata">

**Author:** [@Usnul](https://discourse.threejs.org/u/Usnul)\
**Replies:** 0\
**Last updated:** [June 26, 2026, 10:15pm UTC](https://discourse.threejs.org/t/simulated-spatial-audio/92443 "2026-06-26T22:15:09Z")

</div>

Heavily inspired by Steam Audio. The solution is probe-based. Unlike Steam, the probe mesh is sparse and connections are partial, making the graph much smaller and faster to traverse. Sparse probes also mea…

---

## [Use a Single Material for Cube While Preserving Per-Face Raycasting](https://discourse.threejs.org/t/use-a-single-material-for-cube-while-preserving-per-face-raycasting/92430)

<div class="topic-metadata">

**Author:** [@Taron\_Holikyan](https://discourse.threejs.org/u/Taron_Holikyan)\
**Replies:** 2\
**Last updated:** [June 26, 2026, 3:08pm UTC](https://discourse.threejs.org/t/use-a-single-material-for-cube-while-preserving-per-face-raycasting/92430 "2026-06-26T15:08:45Z")

</div>

Currently, the cube uses 6 separate materials (one for each face) to identify the clicked face during raycasting. We need to investigate whether it’s possible to use a single material for the entire cube while still dete…

---

## [WebGPU MRI Raycast Engine — Real-time Brain Reconstruction in the Browser](https://discourse.threejs.org/t/webgpu-mri-raycast-engine-real-time-brain-reconstruction-in-the-browser/89988)

<div class="topic-metadata">

**Author:** [@Oserebameh](https://discourse.threejs.org/u/Oserebameh)\
**Replies:** 2\
**Last updated:** [February 22, 2026, 4:34pm UTC](https://discourse.threejs.org/t/webgpu-mri-raycast-engine-real-time-brain-reconstruction-in-the-browser/89988 "2026-02-22T16:34:21Z")

</div>

Hey everyone! I’ve been building a WebGPU-based volume raycast engine for the past 8 months and wanted to share it here. It features full tissue segmentation to reconstruct 3D brain replicas from MRI scans, runnin…

---

## [Best approach for magnetic snapping with hole validation using empty Object3D markers? Raycasting +Normals or](https://discourse.threejs.org/t/best-approach-for-magnetic-snapping-with-hole-validation-using-empty-object3d-markers-raycasting-normals-or/89792)

<div class="topic-metadata">

**Author:** [@Parisa\_Shahbazi](https://discourse.threejs.org/u/Parisa_Shahbazi)\
**Replies:** 4\
**Last updated:** [February 12, 2026, 12:43pm UTC](https://discourse.threejs.org/t/best-approach-for-magnetic-snapping-with-hole-validation-using-empty-object3d-markers-raycasting-normals-or/89792 "2026-02-12T12:43:47Z")

</div>

Project Summary I’m working on a 3D robotics construction (Robotic) platform for kids (ages 8-14) using Three.js. The project has been in development for a while, and I recently joined the team to implement new fea…

---

## [Bars & Latex \[three-mesh-bvh\]](https://discourse.threejs.org/t/bars-latex-three-mesh-bvh/88006)

<div class="topic-metadata">

**Author:** [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Replies:** 2\
**Last updated:** [November 8, 2025, 2:55pm UTC](https://discourse.threejs.org/t/bars-latex-three-mesh-bvh/88006 "2025-11-08T14:55:29Z")

</div>

Hi community! Video: Demo: https://codepen.io/prisoner849/full/MYKdOLr The origin of this sketch was the simple thougth: “Fill a model with growing/elongating bars. What will this look like?” For that, I needed…

---

## [I working with webXr project - vr](https://discourse.threejs.org/t/i-working-with-webxr-project-vr/87585)

<div class="topic-metadata">

**Author:** [@Harish](https://discourse.threejs.org/u/Harish)\
**Replies:** 0\
**Last updated:** [October 17, 2025, 7:27am UTC](https://discourse.threejs.org/t/i-working-with-webxr-project-vr/87585 "2025-10-17T07:27:43Z")

</div>

I’ve tried several approaches to improve the icon quality on the buttons, but it still looks poor. Can anyone suggest some ways to sort this out? source code - vr project · GitHub

---

## [Raycasting from camera with pan error](https://discourse.threejs.org/t/raycasting-from-camera-with-pan-error/86878)

<div class="topic-metadata">

**Author:** [@Sh1nbatsu](https://discourse.threejs.org/u/Sh1nbatsu)\
**Replies:** 7\
**Last updated:** [September 9, 2025, 11:44pm UTC](https://discourse.threejs.org/t/raycasting-from-camera-with-pan-error/86878 "2025-09-09T23:44:39Z")

</div>

Hello everyone. I set up a raycasting in area, selected by mouse from camera, to find intersections with model. Logic works just fine if i rotate the camera around the axis. By that i mean that rays are going from plane…

---

## [Can i change the color of an gltf file with raycasting?](https://discourse.threejs.org/t/can-i-change-the-color-of-an-gltf-file-with-raycasting/83946)

<div class="topic-metadata">

**Author:** [@Skelly](https://discourse.threejs.org/u/Skelly)\
**Replies:** 11\
**Last updated:** [June 13, 2025, 4:39pm UTC](https://discourse.threejs.org/t/can-i-change-the-color-of-an-gltf-file-with-raycasting/83946 "2025-06-13T16:39:56Z")

</div>

i’ve been trying for a while now but it seams i just can’t make the textures change color, it’s supposed to be a map of a small traintrack tha’ll change its color to blue when you click on it. I also don’t know if i’m d…

---

## [Coordinates of cursor's pointer not in the middle of the box](https://discourse.threejs.org/t/coordinates-of-cursors-pointer-not-in-the-middle-of-the-box/82814)

<div class="topic-metadata">

**Author:** [@feelivn](https://discourse.threejs.org/u/feelivn)\
**Replies:** 5\
**Last updated:** [May 20, 2025, 7:52am UTC](https://discourse.threejs.org/t/coordinates-of-cursors-pointer-not-in-the-middle-of-the-box/82814 "2025-05-20T07:52:56Z")

</div>

Hi everyone! I am learning and analyzing examples of three.js site. Im looking at this (three.js examples) example. The red box appears with function named “onPointerMove”, and the cube places not in the middle of curso…

---

## [Raycaster only working on layer zero](https://discourse.threejs.org/t/raycaster-only-working-on-layer-zero/81985)

<div class="topic-metadata">

**Author:** [@Kwazai](https://discourse.threejs.org/u/Kwazai)\
**Replies:** 9\
**Last updated:** [May 5, 2025, 7:48pm UTC](https://discourse.threejs.org/t/raycaster-only-working-on-layer-zero/81985 "2025-05-05T19:48:31Z")

</div>

I’m a relative noob to JS and three.js, but have experience with VB and TrueVision3D. I have objects set to layer 21 and disabled layer zero on them. I have Camera set to enableAll layers, I also enabled all on the rayc…

---

## [Using layers for raycasting](https://discourse.threejs.org/t/using-layers-for-raycasting/77809)

<div class="topic-metadata">

**Author:** [@Jo\_Youzarsif](https://discourse.threejs.org/u/Jo_Youzarsif)\
**Replies:** 4\
**Last updated:** [February 9, 2025, 11:21am UTC](https://discourse.threejs.org/t/using-layers-for-raycasting/77809 "2025-02-09T11:21:03Z")

</div>

hello, I’m trying to use layers to manage my intersect objects but I’m lost! Let’s say I have a box that I intersect with raycast, I want to “disable” and “enable” it when needed. But the problem is I can’t understand …

---

## [Moving objects freely and hiding axes in Transformcontrols](https://discourse.threejs.org/t/moving-objects-freely-and-hiding-axes-in-transformcontrols/76332)

<div class="topic-metadata">

**Author:** [@Halikarnassos](https://discourse.threejs.org/u/Halikarnassos)\
**Replies:** 8\
**Last updated:** [January 11, 2025, 7:48pm UTC](https://discourse.threejs.org/t/moving-objects-freely-and-hiding-axes-in-transformcontrols/76332 "2025-01-11T19:48:16Z")

</div>

How can I hide the axes in TransformControls? Whenever I hide one axis, two axes are displayed. If I hide two axes, TransformControls no longer works. My goal is: I don’t want any axes to be displayed since I don’t need …

---

## [How to hide Walls when dynamic based on Camera position?](https://discourse.threejs.org/t/how-to-hide-walls-when-dynamic-based-on-camera-position/76334)

<div class="topic-metadata">

**Author:** [@Halikarnassos](https://discourse.threejs.org/u/Halikarnassos)\
**Replies:** 4\
**Last updated:** [January 11, 2025, 8:59am UTC](https://discourse.threejs.org/t/how-to-hide-walls-when-dynamic-based-on-camera-position/76334 "2025-01-11T08:59:07Z")

</div>

Hello everyone, how can I hide the walls, as shown in the picture, when the camera is pointing at the wall from the outside? The walls should only be hidden when the camera is directed at them from the outside, as seen …

---

## [How to Create a 3D Data Texture with Depth Using Slices of Positions and Normals from a Model?](https://discourse.threejs.org/t/how-to-create-a-3d-data-texture-with-depth-using-slices-of-positions-and-normals-from-a-model/75351)

<div class="topic-metadata">

**Author:** [@Abdullah\_zafar](https://discourse.threejs.org/u/Abdullah_zafar)\
**Replies:** 0\
**Last updated:** [December 18, 2024, 6:13pm UTC](https://discourse.threejs.org/t/how-to-create-a-3d-data-texture-with-depth-using-slices-of-positions-and-normals-from-a-model/75351 "2024-12-18T18:13:31Z")

</div>

Hi everyone, I’m currently working on a project where I need to generate a 3D data texture (volumetric texture) from a 3D model in Three.js. The goal is to create a texture that includes both position and normal data, s…

---

## [Points De-Rendering At Specific Angles](https://discourse.threejs.org/t/points-de-rendering-at-specific-angles/73716)

<div class="topic-metadata">

**Author:** [@zachjesus](https://discourse.threejs.org/u/zachjesus)\
**Replies:** 4\
**Last updated:** [November 7, 2024, 7:00pm UTC](https://discourse.threejs.org/t/points-de-rendering-at-specific-angles/73716 "2024-11-07T19:00:38Z")

</div>

Problem is as the title states… Points Material generated de-render at certain camera angles. Specifically those when zoomed out. My code is as follows: import \* as THREE from 'three'; import { OrbitControls } from 'thr…

---

## [Sprites apparently clickable only in upper half](https://discourse.threejs.org/t/sprites-apparently-clickable-only-in-upper-half/59897)

<div class="topic-metadata">

**Author:** [@Carlo\_Schiano\_di\_Cola](https://discourse.threejs.org/u/Carlo_Schiano_di_Cola)\
**Replies:** 1\
**Last updated:** [November 1, 2024, 5:37pm UTC](https://discourse.threejs.org/t/sprites-apparently-clickable-only-in-upper-half/59897 "2024-11-01T17:37:58Z")

</div>

I’m trying to make clickable sprites based on PNG images like the following However the sprites seem to be only clickable in their upper half, and slightly above. Furthermore, The problem seems to diminish as the sc…

---

## [Feasibility of doing 40000 raycasts onto a 100000 face, animated and skinned mesh](https://discourse.threejs.org/t/feasibility-of-doing-40000-raycasts-onto-a-100000-face-animated-and-skinned-mesh/72143)

<div class="topic-metadata">

**Author:** [@pomle](https://discourse.threejs.org/u/pomle)\
**Replies:** 7\
**Last updated:** [October 1, 2024, 7:19am UTC](https://discourse.threejs.org/t/feasibility-of-doing-40000-raycasts-onto-a-100000-face-animated-and-skinned-mesh/72143 "2024-10-01T07:19:36Z")

</div>

I have been tasked to replicate an effect made in a non-realtime tool. The effect has been achived by setting up 200x200 rays and casting it onto an animated mesh, then placing sprites at the first hit point. I know abo…

---

## [Implement Raycasting](https://discourse.threejs.org/t/implement-raycasting/66931)

<div class="topic-metadata">

**Author:** [@Rohith\_K](https://discourse.threejs.org/u/Rohith_K)\
**Replies:** 2\
**Last updated:** [June 19, 2024, 7:24am UTC](https://discourse.threejs.org/t/implement-raycasting/66931 "2024-06-19T07:24:57Z")

</div>

Hi Guys, i am a new member to this community and threejs, i have written a code for loading multiple fbx file from my system using input tag. Now i need to implement raycasting to it. The main aim is to consolelog the…

---

## [BIM software | measurment snapping to corners and edges](https://discourse.threejs.org/t/bim-software-measurment-snapping-to-corners-and-edges/66192)

<div class="topic-metadata">

**Author:** [@Parisa\_Shahbazi](https://discourse.threejs.org/u/Parisa_Shahbazi)\
**Replies:** 2\
**Last updated:** [May 31, 2024, 1:42pm UTC](https://discourse.threejs.org/t/bim-software-measurment-snapping-to-corners-and-edges/66192 "2024-05-31T13:42:34Z")

</div>

Hi guys, I have recently created a BIM software on the web to load .ifc files and data and walkthrough in the space and choose meshes and I added length, area, and angle measurements by : AngleMeasurement | That Open Do…

---

## [Click on mesh and get coordinates - raycasting x BVH](https://discourse.threejs.org/t/click-on-mesh-and-get-coordinates-raycasting-x-bvh/61953)

<div class="topic-metadata">

**Author:** [@jzamecnik](https://discourse.threejs.org/u/jzamecnik)\
**Replies:** 3\
**Last updated:** [April 26, 2024, 6:36am UTC](https://discourse.threejs.org/t/click-on-mesh-and-get-coordinates-raycasting-x-bvh/61953 "2024-04-26T06:36:32Z")

</div>

Hi guys, we have a problem: we need to estimate click coordinates on a complex mesh (1M+ vertices, 3D scans). Simple raycasting is working, but of course is very slow. So we have tried BVH. It works great, but a problem …

---

## [How can I use Raycaster with react three fiber?](https://discourse.threejs.org/t/how-can-i-use-raycaster-with-react-three-fiber/38308)

<div class="topic-metadata">

**Author:** [@Tanjil\_Hossain](https://discourse.threejs.org/u/Tanjil_Hossain)\
**Replies:** 5\
**Last updated:** [April 5, 2024, 12:01pm UTC](https://discourse.threejs.org/t/how-can-i-use-raycaster-with-react-three-fiber/38308 "2024-04-05T12:01:02Z")

</div>

I want to detect clicks outside of the model that’s why I need raycaster to use. When I click out of the model I need to reset the camera. I found documention for threejs but dont know how can I do that with react three …

---

## [R3f pointerEvents & raycaster](https://discourse.threejs.org/t/r3f-pointerevents-raycaster/63442)

<div class="topic-metadata">

**Author:** [@RAUMIK\_RANA](https://discourse.threejs.org/u/RAUMIK_RANA)\
**Replies:** 3\
**Last updated:** [March 31, 2024, 8:52pm UTC](https://discourse.threejs.org/t/r3f-pointerevents-raycaster/63442 "2024-03-31T20:52:06Z")

</div>

\<group onPointerDown={down} onPointerMove={move} position={position}\> ...meshes \</group\> I have 2 questions regarding raycasting in r3f. I want to call above events function conditionally. …

---

## [Raycast to select Points in pointcloud - returns all points - intersectObjects](https://discourse.threejs.org/t/raycast-to-select-points-in-pointcloud-returns-all-points-intersectobjects/21428)

<div class="topic-metadata">

**Author:** [@mikejernil](https://discourse.threejs.org/u/mikejernil)\
**Replies:** 6\
**Last updated:** [March 5, 2024, 1:33pm UTC](https://discourse.threejs.org/t/raycast-to-select-points-in-pointcloud-returns-all-points-intersectobjects/21428 "2024-03-05T13:33:39Z")

</div>

While attempting to do a selection of a single point by clicking in a point cloud(~20000 pts) loaded using XYZLoader, the intersectObject(pointCloud) returns all the points in the point cloud, even when I’m clicking outs…

---

## [Raycasting and rotation matrices](https://discourse.threejs.org/t/raycasting-and-rotation-matrices/61764)

<div class="topic-metadata">

**Author:** [@raaaahman](https://discourse.threejs.org/u/raaaahman)\
**Replies:** 8\
**Last updated:** [February 26, 2024, 11:07am UTC](https://discourse.threejs.org/t/raycasting-and-rotation-matrices/61764 "2024-02-26T11:07:25Z")

</div>

Hello everyone, I’ve been following (at a veeery slow pace) Freya Holmer’s awesome Math for Game Devs course, and I’m at the chapter about 4x4 matrices and cross products. Trying to replicate heur demonstration into Th…

---

## [Mouse click in wrong location](https://discourse.threejs.org/t/mouse-click-in-wrong-location/10507)

<div class="topic-metadata">

**Author:** [@Torben\_Van\_Assche](https://discourse.threejs.org/u/Torben_Van_Assche)\
**Replies:** 3\
**Last updated:** [February 6, 2024, 4:33am UTC](https://discourse.threejs.org/t/mouse-click-in-wrong-location/10507 "2024-02-06T04:33:41Z")

</div>

For my project I need some buttons on the side of my window. So I changed the size of the window. However, I need to be able to select objects in the scene by clicking on them, which is misbehaving. I suspect it to have…

---

## [Collision with walls/floors/objects \[furniture\] in room when using Transform Controls](https://discourse.threejs.org/t/collision-with-walls-floors-objects-furniture-in-room-when-using-transform-controls/60049)

<div class="topic-metadata">

**Author:** [@JxstWieslaw](https://discourse.threejs.org/u/JxstWieslaw)\
**Replies:** 4\
**Last updated:** [January 10, 2024, 8:27am UTC](https://discourse.threejs.org/t/collision-with-walls-floors-objects-furniture-in-room-when-using-transform-controls/60049 "2024-01-10T08:27:37Z")

</div>

Hie Devs😄, compliments of the new season. Need some help with something. Any ideas are welcome. I’m making an app where you can configure a room and move around objects using Transform Controls. Need to ensure that ob…

---

## [Clickable area of sprite](https://discourse.threejs.org/t/clickable-area-of-sprite/59693)

<div class="topic-metadata">

**Author:** [@Carlo\_Schiano\_di\_Cola](https://discourse.threejs.org/u/Carlo_Schiano_di_Cola)\
**Replies:** 9\
**Last updated:** [December 29, 2023, 10:32am UTC](https://discourse.threejs.org/t/clickable-area-of-sprite/59693 "2023-12-29T10:32:17Z")

</div>

I’m trying to make some clickable sprite, but I’m having trouble understanding which is the clickable area. Is it a rectangle? If so, how it is centered? Here I post an image with the sprites I created and the funct…

---

## [Detect certain gltf model part with Raycaster](https://discourse.threejs.org/t/detect-certain-gltf-model-part-with-raycaster/23184)

<div class="topic-metadata">

**Author:** [@yaroslavnikiforov](https://discourse.threejs.org/u/yaroslavnikiforov)\
**Replies:** 7\
**Last updated:** [November 6, 2023, 6:55pm UTC](https://discourse.threejs.org/t/detect-certain-gltf-model-part-with-raycaster/23184 "2023-11-06T18:55:32Z")

</div>

I am trying to catch the click event on exact parts of gltf model using raycaster. I am able to catch a click on the whole model but cannot get its part. Here is a working example: https://codepen.io/yaroslavnikiforov/p…

---

## [Raycast fails after modifying the instance matrices](https://discourse.threejs.org/t/raycast-fails-after-modifying-the-instance-matrices/53791)

<div class="topic-metadata">

**Author:** [@Emeric\_Beaufays](https://discourse.threejs.org/u/Emeric_Beaufays)\
**Replies:** 3\
**Last updated:** [October 10, 2023, 5:08am UTC](https://discourse.threejs.org/t/raycast-fails-after-modifying-the-instance-matrices/53791 "2023-10-10T05:08:14Z")

</div>

Using Three 0.152.0 I got a few instances and I’m using the Raycaster on them which is working fine until I modify the instance matrices. Here’s some code to reproduce const geometry = new THREE.IcosahedronGeometry(0.5…

[Next page](https://discourse.threejs.org/tag/raycasting/429.md?match_all_tags=true&page=1&tags%5B%5D=raycasting)
