Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#1 29-Jul-2011 09:03:33

astrolabio
Member
Registered: 29-Jul-2011
Posts: 10

Raycast + GPU

I'm running a big scene (more than 500000 pol) , and having low frame rate only when moving the cursor, is there a raycast process there?  is there any way to accelerate it?

Offline

#2 29-Jul-2011 12:53:39

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,091
Website

Re: Raycast + GPU

Hi,

the mouse raycast is already optimized, the subentity selection is done on a rendered picture with a color by entity
the polygon raycast is done per subentity.

if your object have only one subentity and a large count of polygon we can't optimize more hmm

Offline

#3 29-Jul-2011 13:02:56

astrolabio
Member
Registered: 29-Jul-2011
Posts: 10

Re: Raycast + GPU

Thanks Arkeon!! Sorry but i don't understand very well what the cpu and gpu does in the process, why cant the gpu make all the intersecion part with a color by entity? is there an algoritm that loops through all the polygons of an entity? what is the diference between entity and subentity in openspace?

Offline

#4 29-Jul-2011 13:08:24

Nodrev
Scol Language & OS3D developer
From: Nantes, France
Registered: 29-Dec-2009
Posts: 197

Re: Raycast + GPU

Hey,

Indeed, there's a raycast done.
But in fact, we had already boosted it the better way I know, ie with a selector buffer. The principe is very simple, and consist in rendering the scene a second time on a texture, and to set a unique colour by "sub-entity". A sub entity is not a concept that exists in OpenSpace3D, but in two words, it's a subset of an entity (an entity with 3 materials will have 3 sub-entities). So, next, we check which color is under the mouse cursor, get the sub-entity associated with this color, and then we are doing a "raycast to the polygon level" on the sub-entity triangles, to find the exact collision point with the mesh (and also get the uv coordonates and other stuff). And that's this last part that can affect the frame time, ie, if you have too many triangles on the subentity under the mouse, it'll lag...

So, to improve performance, use object with subentities that do not have two much polygons (the total polygon on the scene can stay the same, but, for example, if I have a building mesh, with one sub-entity on it, and 200K polys, it will be less effective than 10 sub-entities of 20K polys...).

You can also disable the rendering of an Entity on the color selector, meanings that the "raycasting to polygon level" will never be done on it. The Scol function is SO3ObjectSetMouseClick ("fun [SO3_OBJECT I] I"), but I don't know if an OpenSpace3D's plugit uses it (maybe "object click" plugit).

I Hope it helps.

<edit>I didn't saw your responses guys, but I think that you will find more infos in my post, let me know if it's still not clear</edit>

Last edited by Nodrev (29-Jul-2011 13:10:31)

Offline

#5 29-Jul-2011 14:00:33

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: Raycast + GPU

Interesting !...

@Nodrev object click plugIt uses SO3ObjectSetMouseClick, it should be  wink

Offline

#6 29-Jul-2011 16:21:29

astrolabio
Member
Registered: 29-Jul-2011
Posts: 10

Re: Raycast + GPU

What a helpful comunity! :-) , thank you all

It's Strange but I have a terrain composed by few polygons and with 128   512x512 textures  as subentities (materials)   and The slow frame rate when moving the mouse is still there (60fps without moving and more or less 32 fps moving), It's also true that with a scene without geometry the frame rate goes down to 50 (from 60) only moving the mouse, is it a normal behavement? , anyway i'll try the SO3ObjectSetMouseClick

Offline

#7 29-Jul-2011 16:46:44

astrolabio
Member
Registered: 29-Jul-2011
Posts: 10

Re: Raycast + GPU

I've tried ignoring mouse in object click with SO3ObjectSetMouseClick but it continues casting rays, maybe there is a similar function SO3ObjectSetMouseOver???

Offline

#8 29-Jul-2011 16:49:14

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,091
Website

Re: Raycast + GPU

try to use the Object click plugIt and check ignore.
Or look at the plugIT code.

I'll test your case with a big mesh

Offline

#9 29-Jul-2011 19:35:04

Nodrev
Scol Language & OS3D developer
From: Nantes, France
Registered: 29-Dec-2009
Posts: 197

Re: Raycast + GPU

astrolabio message let me think about a way to do the casting fully on the GPU with shaders, but as we need to render a third time the scene to have the "depth" map, it should not be very efficient with the actual renderer, but feasible with a deferred renderer. A thing to keep in mind. Anyway, sorry to not answer to your problem, I don't really have time to look at it tonight...

Offline

#10 30-Jul-2011 07:48:29

astrolabio
Member
Registered: 29-Jul-2011
Posts: 10

Re: Raycast + GPU

SORRY!!!
I had tested the object click and SO3ObjectSetMouseClick but had forgot to play the scene :-), big mistake!!!
It's working !!
I've tried it over a 2.000.000 polygon sphere and without ignore it it was 0-1 fps and 50-60 fps with it
Thank you all

Offline

#11 30-Jul-2011 11:17:41

Nodrev
Scol Language & OS3D developer
From: Nantes, France
Registered: 29-Dec-2009
Posts: 197

Re: Raycast + GPU

You are welcome.

Offline

Board footer

Powered by FluxBB