ray-picking

GPU Picking inconsistent across devices

孤者浪人 提交于 2020-04-17 22:33:14
问题 I’m trying to implement GPU picking with Points using code I modified from the latter half of this article https://threejsfundamentals.org/threejs/lessons/threejs-picking.html It’s been working fine for me on desktop, but I started testing different browsers and devices and it doesn’t work consistently. I made a Codepen to illustrate https://codepen.io/deklanw/pen/OJVVmEd?editors=1111 body { margin: 0; } #c { width: 100vw; height: 100vh; display: block; } <canvas id="c"></canvas> <script type

Question about 3D Picking in Android (with OpenGL ES 2)

◇◆丶佛笑我妖孽 提交于 2020-01-14 05:41:06
问题 I need some help on 3D picking. I am using the way it works here. In short, what I have is: normalizedPoint[0] = (x * 2 / screenW) -1; normalizedPoint[1] = 1 - (y * 2 / screenH); normalizedPoint[2] = ? normalizedPoint[3] = ? for 2 and 3, I have no idea what it should be (I put 1, -1 just like the reference, and it doesn't work) Then, for my root object (following just psuedo code): matrix = perspective_matrix x model_matrix inv_matrix = inverse(matrix) outpoint = inv_matrix x normalizedPoint

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

跟風遠走 提交于 2019-12-30 12:51:48
问题 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 genereally written with lacking parts. 回答1: What you have is a position in 2D on the screen. The first thing to do is convert that point from pixels to normalized device coordinates — -1 to 1. Then you need to find the line in 3D space that the point

LWJGL Ray Picking (gluUnProject)

谁说胖子不能爱 提交于 2019-12-24 00:47:44
问题 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 float[16]; int[] view = new int[16]; float mouseX = width / 2; float mouseY = height / 2; Vector3f start = new Vector3f(); Vector3f end = new Vector3f(); FloatBuffer modelBuffer = compileBuffer(matModelView); FloatBuffer projBuffer = compileBuffer

3D Graphics Picking - What is the best approach for this scenario

独自空忆成欢 提交于 2019-12-24 00:32:26
问题 I am working on a project which allows users to pick 3d objects in a scene and I was wondering what everyone thought would be the best way to approach this particular scenario. Basically we have a scene with at least 100 objects (they are low-poly but made from at least ~12-15 triangles) and up to about 1000-2000 objects. Not all the objects will be "pickable" at all times because some objects will occlude others so "pickable" objects probably land in the range between 800-1500 (depending on

OpenGL 3D-raypicking with high poly meshes

穿精又带淫゛_ 提交于 2019-12-17 03:44:56
问题 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

Intersection test for ray picking in opengl es for android

半城伤御伤魂 提交于 2019-12-13 05:48:53
问题 Ok so I was able to get the coordinates in 3d space for the touch now I need to test whether that ray intersected a triangle. What I am asking is for help to understand the Test Class. BTW this code came from http://android-raypick.blogspot.ca/2012/04/first-i-want-to-state-this-is-my-first.html. I know to pass in the ray and an empty float array into intersectRayAndTriangle() but the Test T is the V0[], V1[], and V2[] but where do I get those at? Are they the converted coordinates of my

get mouse in world coordinates with 2 gluUnproject calls to create ray

£可爱£侵袭症+ 提交于 2019-12-13 01:23:15
问题 I try to use what many people seem to find a good way, I call gluUnproject 2 times with different z-values and then try to calculate the direction vector for the ray from these 2 vectors. I read this question and tried to use the structure there for my own code: glGetFloat(GL_MODELVIEW_MATRIX, modelBuffer); glGetFloat(GL_PROJECTION_MATRIX, projBuffer); glGetInteger(GL_VIEWPORT, viewBuffer); gluUnProject(mouseX, mouseY, 0.0f, modelBuffer, projBuffer, viewBuffer, startBuffer); gluUnProject

'Ray' creation for raypicking not fully working

筅森魡賤 提交于 2019-12-11 11:42:07
问题 I'm trying to implement a 'raypicker' for selecting objects within my project. I do not fully understand how to implement this, but I understand conceptually how it should work. I've been trying to learn how to do this, but most tutorials I find go way over my head. My current code is based on one of the recent tutorials I found, here. After several hours of revisions, I believe the problem I'm having with my raypicker is actually the creation of the ray in the first place. If I substitute

Using glGetFloatv to retrieve the modelview matrix in pyglet

前提是你 提交于 2019-12-11 01:05:33
问题 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, visible=True, vsync=True) I then define all of my window events: @win.event def on_draw(): # All of the drawing happens here @win.event def on_mouse_release(x, y, button, modifiers): if button == mouse.LEFT: # This is where I'm having problems a = GLfloat()