ray-picking

Camera Pitch/Yaw to Direction Vector

孤街醉人 提交于 2019-12-10 02:36:53
问题 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). "Pitch", from the perspective of the camera, is looking up and down. (I would prefer to not use matrices, but I will if I have to) 回答1: Assuming that your coordinate system is set up such that the following conditions are met: (pitch, yaw) -> (x, y

Ray-picking in OpenGL ES 2.0

微笑、不失礼 提交于 2019-12-09 20:08:38
问题 I'm trying to implement ray-picking in OpenGL ES 2.0 to determine if an object has been clicked or not. So far I'm just trying to check if a specific triangle has been pressed. I`m using this site as a motivation http://android-raypick.blogspot.ca/2012/04/first-i-want-to-state-this-is-my-first.html This is what I have so far: public void onClick(float x, float y) { float[] temp = new float[4]; float[] temp2 = new float[4]; System.out.println("X coordinate: " + x); System.out.println("Y

Camera Pitch/Yaw to Direction Vector

馋奶兔 提交于 2019-12-05 02:13:24
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). "Pitch", from the perspective of the camera, is looking up and down. (I would prefer to not use matrices, but I will if I have to) Assuming that your coordinate system is set up such that the following conditions are met: (pitch, yaw) -> (x, y, z) (0, 0) -> (1, 0, 0) (pi/2, 0) -> (0, 1, 0) (0, -pi/2) -> (0, 0, 1) This will calculate (x, y, z): xzLen

Ray-picking in OpenGL ES 2.0

ⅰ亾dé卋堺 提交于 2019-12-04 17:58:34
I'm trying to implement ray-picking in OpenGL ES 2.0 to determine if an object has been clicked or not. So far I'm just trying to check if a specific triangle has been pressed. I`m using this site as a motivation http://android-raypick.blogspot.ca/2012/04/first-i-want-to-state-this-is-my-first.html This is what I have so far: public void onClick(float x, float y) { float[] temp = new float[4]; float[] temp2 = new float[4]; System.out.println("X coordinate: " + x); System.out.println("Y coordinate: " + y); float[] pos = new float[4]; y = (float) viewport[3] - y; int res = GLU.gluUnProject(x, y,

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

流过昼夜 提交于 2019-11-28 08:30:37
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 intersects with any of the "Red Boxes" the once that are intersecting with the ray will turn green. The ground and walls won't change color or texture at all. Examples: The current way I do the 3D Ray Picking, is getting the camera's view direction ray, and then just calculating for intersections. My function for calculating intersections doesn't

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

烈酒焚心 提交于 2019-11-27 02:16:05
问题 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 intersects with any of the "Red Boxes" the once that are intersecting with the ray will turn green. The ground and walls won't change color or texture at all. Examples: The current way I do the 3D Ray Picking, is getting the camera's view direction

OpenGL 3D-raypicking with high poly meshes

青春壹個敷衍的年華 提交于 2019-11-26 15:33:49
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 should be possible to use these for the models in the scene, but I do not know how I should use these concepts at mesh-level. But if you use an octree at mesh-level, how should one cover problems with polygons, that exceed the boundaries of the octree volumes? Do you have any advice which method is suitable or recommended for 3d ray-intersections with