NasimiAsl Posted May 10, 2016 Share Posted May 10, 2016 hi in this topic we try to solve all problem in GPU picking system i think we have this questions : 1. how can pick changed vertex in gpu side 2. what information we can fetch GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted May 10, 2016 Author Share Posted May 10, 2016 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 Wingnut 1 Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted May 10, 2016 Author Share Posted May 10, 2016 http://www.babylonjs-playground.com/#JAG8B#10 http://www.babylonjs-playground.com/#JAG8B#12 Kesshi and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 10, 2016 Share Posted May 10, 2016 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. 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.) NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 10, 2016 Share Posted May 10, 2016 Really impressive. I second Wingnut: You are the king of GPU:) NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted May 11, 2016 Author Share Posted May 11, 2016 thanks @Deltakosh @Wingnut , i hope this help somewhere Quote Link to comment Share on other sites More sharing options...
ua4192 Posted June 26, 2017 Share Posted June 26, 2017 Hi. Very sorry for my ignorance but do you mean that it's possible to pick a mesh by using GPU? Best regards Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 26, 2017 Share Posted June 26, 2017 There are some implementation out there (but no in bjs) Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted June 27, 2017 Author Share Posted June 27, 2017 @ua4192 hi yes it is possible that have some cpu side working but it is fixed progress like rendertarget but you can detect your mesh i update that for BJS v3 and you most use BABYLONX > Extensions > ShaderBuilder http://www.babylonjs-playground.com/#JAG8B#14 Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted June 27, 2017 Author Share Posted June 27, 2017 @Deltakosh i can make it work only used by BJS ( with customMaterial - or ShaderMaterial too) Quote Link to comment Share on other sites More sharing options...
ua4192 Posted June 27, 2017 Share Posted June 27, 2017 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 Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted June 28, 2017 Author Share Posted June 28, 2017 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 Quote Link to comment Share on other sites More sharing options...
ua4192 Posted June 28, 2017 Share Posted June 28, 2017 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.