3

OpenGL ES 2.0 で座標ピッキング機能を実装しようとしています。デスクトップ バージョンで実装した 2 つのバージョンを実装できません。

バージョン 1 では、三角形のインデックスを表す一意の色ですべての三角形をレンダリングし、レイキャストで座標を計算します。OpenGL ES GLSL バージョン 1.0 では変数 GL_PrimitiveID がなく、ビットごとのシフトもできないため、このバージョンは機能しません。

バージョン 2 は浮動小数点テクスチャの値として座標をレンダリングすることですが、浮動小数点テクスチャは OpenGL ES 2.0 では使用できません。

私が実装できるものを他に考えている人はいますか?それほどパフォーマンスが高くないため、すべての三角形をレイキャストしたくありません。

助けとアイデアをありがとう。

4

2 に答える 2

1

Another way to implement picking of coordinates is ray picking of objects. It is considered to be the best method to pick 3D objects from 2D screen coordinates. You won't have to render scene with unique colors of objects and pick colors to determine intersection.

I've implemented picking of 3D objects with the help of this great tutorial: http://android-raypick.blogspot.com/2012/04/first-i-want-to-state-this-is-my-first.html

After some optimizations of algorithm (I've made a comment in blog post) performance is not an issue in my case. To test performance I'm picking a 3D model with 3000+ triangles and it is fast. In real cases, for collision detection you can use models with very simplified geometry.

于 2012-11-22T07:38:57.310 に答える
1

レイ キャスティングを使用する場合、各プリミティブをレイに対してテストすることは、とにかく悪い考えです。バウンディング ボリューム ツリーのようなモデルの階層表現を構築し、加速されたレイキャスティング テストを実行する必要があります。もちろん、モデルが変更されるたびにこのツリーを更新する必要があります。

三角形ごとに個別の色をレンダリングする元の方法に戻ると、別の頂点属性 (色/インデックス) を割り当てる必要があり、三角形ごとに共有頂点を繰り返す必要があるようです。頂点の数は三角形の数の 3 倍になりますが、これで問題は解決します。

于 2012-12-23T06:16:56.527 に答える