Questions tagged [raycasting]

A rendering technique to create a 3D perspective in a 2D map

1193 questions
25
votes
4 answers

How to do ray plane intersection?

How do I calculate the intersection between a ray and a plane? Code This produces the wrong results. float denom = normal.dot(ray.direction); if (denom > 0) { float t = -((center - ray.origin).dot(normal)) / denom; if (t >= 0) { …
Pontus Magnusson
  • 632
  • 1
  • 10
  • 25
20
votes
1 answer

volume rendering (using glsl) with ray casting algorithm

I am learning volume rendering using ray casting algorithm. I have found a good demo and tuturial in here. but the problem is that I have a ATI graphic card instead of nVidia which make me can't using the cg shader in the demo, so I want to change…
toolchainX
  • 1,998
  • 3
  • 27
  • 43
18
votes
2 answers

Can a Three.js raycaster intersect a group?

I want to know if my raycaster is looking at an OBJ that I've loaded. Due to the way exported from Cinema4D, I believe the OBJ is a THREE.Group with 3 children, instead of a THREE.Object. Can I just change my raycaster line of code to look for this…
EJW
  • 604
  • 2
  • 10
  • 22
16
votes
2 answers

Change color of mesh using mouseover in three js

I've put together a WebGL script that displays several meshes using jsonloader and three.js and I now want to add MouseOver and onClick events. The first of these is simply changing the colour of the mesh when the mouse hovers over it: function…
Martin Leman
  • 163
  • 1
  • 1
  • 4
14
votes
6 answers

Voxels... Honestly, I need to know where to begin

Okay, i understand that voxels are just basically a volumetric version of a pixel. After that, I have no idea what to even look for. Googling doesn't show any tutorials, I can't find a book on it anywhere, I can't find anything even having to do…
Fiattarone
  • 175
  • 1
  • 1
  • 7
14
votes
7 answers

MySQL implementation of ray-casting Algorithm?

We need to figure out a quick and fairly accurate method for point-in-polygon for lat/long values and polygons over google maps. After some research - came across some posts about mysql geometric extensions, and did implement that too - SELECT id,…
zarun
  • 910
  • 9
  • 26
14
votes
1 answer

Raycast in Three.js with only a projection matrix

I'm rendering some custom layers using Three.js in a Mapbox GL JS page following this example. I'd like to add raycasting to determine which object a user has clicked on. The issue is that I only get a projection matrix from Mapbox, which I use to…
danvk
  • 15,863
  • 5
  • 72
  • 116
13
votes
3 answers

Difference between Doom and Quake 3D rendering

I have been studying (old) 3D rendering techniques for the past weeks and think that I now have a fair understanding of the way 3D rendering in Doom works. It uses raycasting to render the 3D scene, uses sprites for objects and thus is not "true"…
Ruud van Falier
  • 8,765
  • 5
  • 30
  • 59
13
votes
3 answers

Extend MySQL implementation of PiP Algorithm?

I need to make a point in polygon MySQL query. I already found these two great solutions: http://forums.mysql.com/read.php?23,286574,286574 MySQL implementation of ray-casting Algorithm? But these functions can only check if one point is inside a…
Mike
  • 5,416
  • 4
  • 40
  • 73
12
votes
2 answers

Orthographic camera and selecting objects with raycast

I am running into a bit of difficulty selecting objects with the orthographic camera using the raycaster. Though, I have no problem with it when I use a perspective camera. The only thing I am changing when switching between the two is the type…
bobkingof12vs
  • 660
  • 5
  • 22
11
votes
3 answers

'hitTest()' was Depecrated in iOS 14.0

I'm new to this and currently building an AR-related application, on the old version I stated this let results = self.hitTest(screenPosition, types: [.featurePoint]) and now I have a problem where the hitTest is deprecated in iOS…
Zaky Putra
  • 111
  • 1
  • 4
11
votes
4 answers

Detection with raycaster not completely accurate when the width of div is reduced, three.js(v72)

here is my code for calculating the intersection: var wallWidth = 1200; var wallHeight = 500; var containerWidth=1200,containerHeight=700; //div //camera camera = new THREE.PerspectiveCamera(60, containerWidth/containerHeight, 1,…
anuj rajput
  • 317
  • 1
  • 7
  • 12
10
votes
2 answers

Ray Casting with different height size

I have a java project who makes the "windows' maze" and use the ray casting algorithm. Here's a screenshot : Like you can see all the walls have the same height size. I would like to do the same but with different height size private void…
Jack
  • 405
  • 4
  • 11
10
votes
2 answers

recalculate ray tracing/casting costs when changing size of rectangle

I have an array of "rays" which I need to measure the costs in relation to the rectangular boxes below. The outer red box is always 1m larger than the dark green box and light green box is 10cm smaller than the dark green box. If a ray passes…
goh
  • 27,631
  • 28
  • 89
  • 151
10
votes
4 answers

Unexpected result when unprojecting screen coordinates in DirectX

In order to be able to determine whether the user clicked on any of my 3D objects I’m trying to turn the screen coordinates of the click into a vector which I then use to check whether any of my triangles got hit. To do so I’m using the…
ackh
  • 1,648
  • 2
  • 18
  • 36
1
2 3
79 80