Jump to content

GPU picking System


NasimiAsl
 Share

Recommended Posts

about q1 :

after shader  we dont access any data (new position info or Color info )

only one way to get a data after process shader we have 

we can readPixel from result of Shader 

i use this stuff for get information of picking

1: make a camera and use it like Ray( Ray in raycast ) 

2: make a render target and use raycamera for get a pixel of data

3: use a small texture (4x4) in render target and less fov : 0.000001 so we see a exactly pixel of mesh 

4: make id Color System for give number from pixel  (rgb to  long integer)

5: we make helper material and set my wanted data per pixel with color

6 : use this helper material on render target and i fetch this data with readpixel and get Number

http://www.babylonjs-playground.com/#JAG8B#8

in this sample i make all steps and log picked identity with console.Log

Link to comment
Share on other sites

Wow, Naz!  Hi again!

I hereby crown you King of the GPU, NasimiAsl!  Thanks for the play-by-play explanation, too.  Excellent, excellent, excellent. 

My dog took a look at the code, gasped (dog gasp), and immediately booked himself on a flight to Jamaica.  :D

Bounding-box-less and Octree-less picking/intersecting.  Fascinating!  Irregular shapes, no problems.  hmm.  Wow.

(Wingy carefully examines the GPU on the desk in front of him, and scratches his beard in curious wonderment.)

Link to comment
Share on other sites

  • 1 year later...

HI.

One more time I have to recognize that your code is too much for my short knowledge.

: )

I agree with other members, you are the king of GPU.

Here you can see my idea.

https://www.babylonjs-playground.com/#R38VAY#14

The matrix of rays I am using is 25 x 25 = 625 rays with scene.pick method.

Basically I am limiting the number of meshes in my scene to 625 in each mouse movement.

Besides this I am also replacing the scene by its bounding box when camera is moving.

Of course if oclussion clulling function could be executed in less time this wouldn't be necesary.

As you can see in this PG when I move the camera position this happens:

1.- the scene meshes are replace by its bounding box, so I can rotate / zon /pan in a very agile way.

2.- When camera is static again (no movement detected) I apply the oclussion culling function  with a matrix of 25 c 25 scene.pick calls dividing the canvas in 25 x 25.cell matrix.

How could I apply your technique?

As you can guess I would prefer to laucnh oclussion culling when carmera changes, but time spent depends directly on the rays launched by the function and they are computed by CPU in secuence.

I am trying to renderize a big scene  (CAD Plane), and my best achievement is to replace the scene by the bounding box in camera movements.

Best regards and again sorry for my ignorance.

 

Best regards

Link to comment
Share on other sites

hi before i start work on this ( if that possible :) ) i need now what purpose you had  means( simulation , or ... )

because this ray picking system designed for one single ray it is possible we make it for a lot ray but it is take a time

 

Link to comment
Share on other sites

HI.

Of course.

: )

I am trying to make a web CAD viewer.

My idea was to launch a matrix of rays (if posible 30x30) dividing the canvas in 900 cells. With my solution based on scene.pick method this takes around 40 secs, I guess that if task could be managed by GPU it could take around 10 times lor even less. I guess that in GPU you can launch jobs in parallel.

In this way I will only discard very small piezes.

My problem is that in my scenes I have more than 20000 meshes and many times 80% are ocluded by other meshes. But as BABYLONJS doesn't provide any oclussion system between different meshes then I am rendering in my scenes many meshes that are nnot needed.

Many thanks in advanced if you have some time to work on it.

I am sure that if you get it, your work will be used by many people.  ; )

Don't hesiate to ask me for more details if you consider.

Best regards

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...