Questions tagged [ray-picking]

56 questions
14
votes
2 answers

3D Ray Picking use Mouse Coordinates when Mouse isn't locked

So basically I've made a program using OpenGL which can perform 3D Ray Picking. If the Camera View Direction Ray touches/intersects anything (which isn't air) then a little purple box will get rendered at the intersection point/points. If the ray…
vallentin
  • 23,478
  • 6
  • 59
  • 81
13
votes
1 answer

Camera Pitch/Yaw to Direction Vector

What I'm trying to do is cast a ray from my camera. I know the camera's x, y and z coordinates, as well as its pitch and yaw. I need to calculate its direction vector so I can pass it to my raytracing algorithm. The camera's up vector is (0, 1, 0).…
RunasSudo
  • 483
  • 2
  • 4
  • 13
9
votes
1 answer

Object picking with ray casting

I've been having a problem with inaccuracies in my ray casting algorithm for detecting mouse hits within a box. I'm completely at a loss as to how to fix this properly and it's been bugging me for weeks. The problem is easiest described with a…
sler
  • 974
  • 1
  • 11
  • 19
7
votes
4 answers

How to do Ray and Triangle Edge intersect?

I'm facing problem intersecting ray with triangle edges. Actually, I'm trying to pick/intersect with triangle, vertex, edge of a mesh using Mouse. So I made ray from the Mouse current position and then I intersect it with the mesh elements like…
Farhad Reza
  • 424
  • 4
  • 16
4
votes
1 answer

Using glGetFloatv to retrieve the modelview matrix in pyglet

I'm doing 3d visualization in python using pyglet, and need to retrieve the modelview and projection matrices to do some picking. I define my window using: from pyglet.gl import * from pyglet.window import * win = Window(fullscreen=True,…
user1223904
  • 43
  • 1
  • 3
4
votes
2 answers

OpenGL 3D-raypicking with high poly meshes

How to implement 3d raypicking in an 3d scene with models that contain high poly meshes? It takes too much time to iterate over all triangles to perform a triangle-line-intersection test. I know that there exist methods like octree etc. and it…
Lemonbonbon
  • 686
  • 5
  • 25
2
votes
0 answers

XNA Triangle picking on SkinnedModel

My game is using the SkinnedModel pipeline and AnimationPlayer to load and display models. I've implemented ray picking with triangles by building a list of vertices and indices from the pipeline. This works, however the indices are static are only…
Neovivacity
  • 109
  • 2
  • 15
2
votes
2 answers

How to get accurate 3D depth from 2D screen mouse click for large scale object in OpenGL?

I am computing the 3D coordinates from the 2D screen mouse click. Then I draw point at the computed 3D coordinate. Nothing is wrong in the code, nothing is wrong in the method, everything is working fine. But there is one issue which is relevant to…
maxpayne
  • 1,111
  • 2
  • 21
  • 41
2
votes
1 answer

Is there a specified Ray object in DirectX

Im doing some work using ray-picking in a DirectX project and I just wondered whether there was an actual 'ray' object type? (rather than just storing direction/origin variables) I know I could create something like struct ray { D3DXVECTOR3…
unknownSPY
  • 706
  • 4
  • 15
  • 27
2
votes
1 answer

Create ray from mouse coordinates for 3D picking

My Question Can someone please link a good article/tutorial/anything or maybe even explain how to correctly cast a ray from the mouse coordinates to pick objects in 3D? I already have the Ray and intersection works, now I only need to create the…
Big_Chair
  • 2,781
  • 3
  • 31
  • 58
2
votes
1 answer

How to calculate UP and position of my camera?

I want to implement ray-picking in my game. I follow this guide to implement it. To calculate the actual ray I lack the lookAt and the up Vector. The problem I use glRotate and glTranslate instead of gluLookAt(eye,target,up) to rotate and move the…
boop
  • 7,413
  • 13
  • 50
  • 94
2
votes
0 answers

LWJGL Ray Picking (gluUnProject)

So I have been looking through tutorials (And questions on this site) and have found nothing to solve my problem. Here is the current code I am trying to implement: private void pick() { float[] matModelView = new float[16], matProjView = new…
zfollette
  • 475
  • 4
  • 15
2
votes
1 answer

How to speed up band selection tool in a Dart WebGL application

The task at hand is to add a band selection tool to a Dart WebGL application. The tool will be used to draw a rectangle over multiple objects by dragging the mouse. Thus multiple objects can be selected/picked in a single user action. I'm currently…
Everton
  • 12,589
  • 9
  • 47
  • 59
2
votes
1 answer

Ray picking with depth buffer: horribly inaccurate?

I'm trying to implement a ray picking algorithm, for painting and selecting blocks (thus I need a fair amount of accuracy). Initially I went with a ray casting implementation, but I didn't feel it was accurate enough (although the fault may have…
Fault
  • 420
  • 3
  • 17
2
votes
2 answers

picking in 3D with ray-tracing using NinevehGL or OpenGL i-phone

I couldn't find the correct and understandable expression of picking in 3D with method of ray-tracing. Has anyone implemented this algorithm in any language? Share directly working code, because since pseudocodes can not be compiled, they are…
ibrahim demir
  • 421
  • 3
  • 16
1
2 3 4