static geometry vs grouped entities in a node

Everything related to 3D programming
User avatar
Comtois
Addict
Addict
Posts: 1432
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: static geometry vs grouped entities in a node

Post by Comtois »

kelebrindae have done a nice example using StaticGeometry, a 'minecraft clone'
http://www.purebasic.fr/french/viewtopi ... 13&t=14057

http://keleb.free.fr/codecorner/downloa ... eclone.zip
Please correct my english
http://purebasic.developpez.com/
T4r4ntul4
Enthusiast
Enthusiast
Posts: 119
Joined: Tue Mar 04, 2014 4:15 pm
Location: Netherlands

Re: static geometry vs grouped entities in a node

Post by T4r4ntul4 »

PMV wrote:What is needed is not "static geometry" ... it is "instanced geometry" that
is not implemented in PB-OGRE until now.
http://www.purebasic.fr/english/viewtop ... =3&t=55995

Or maybe "paged geometry":
http://www.purebasic.fr/english/viewtop ... =3&t=55996
yes, that would be the ultimate solution. do i need to bump your topic(s) with a +1 ?

@ Comtois
yes i tried the mineclone, but its very slow unfortunate. but there are always little bits i can learn from it.
PMV
Enthusiast
Enthusiast
Posts: 727
Joined: Sat Feb 24, 2007 3:15 pm
Location: Germany

Re: static geometry vs grouped entities in a node

Post by PMV »

I don't think that Comtois (or Fred) will be faster if you bump that thread.
Just wait for the PB5.30 and then, if it hasn't been implemented

...we all can bump it :twisted:


:mrgreen:
T4r4ntul4
Enthusiast
Enthusiast
Posts: 119
Joined: Tue Mar 04, 2014 4:15 pm
Location: Netherlands

Re: static geometry vs grouped entities in a node

Post by T4r4ntul4 »

...we all can bump it :twisted:
haha okay.

iam now exploring the limits of PB-Ogre :D having 200 static geometrys with 400 entities each seems no problem lol (takes only 1.7GB ram, oops :twisted: )

but i have another question:

is there a way to determine the ID of a certain static geometry, in realtime ingame?
because that would be the difference to write and build a whole grid system or just look up the ID.

and what are the max entities in a world?
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: static geometry vs grouped entities in a node

Post by Bananenfreak »

Hmm, the maximum entitynumber depends on your cpu and RAM (Perhaps also maximum number of RAM adress :lol: )

Hmm, for which reason do you want the ID of an StaticGeometry? It could be possible that IsStaticGeometry() gives you the ID.
Image
T4r4ntul4
Enthusiast
Enthusiast
Posts: 119
Joined: Tue Mar 04, 2014 4:15 pm
Location: Netherlands

Re: static geometry vs grouped entities in a node

Post by T4r4ntul4 »

Bananenfreak wrote:Hmm, the maximum entitynumber depends on your cpu and RAM (Perhaps also maximum number of RAM adress :lol: )
than i have no problems with that i think, got 16GB of ram, and my cpu is i7-4820K @ 3.7GHz :D
Bananenfreak wrote:Hmm, for which reason do you want the ID of an StaticGeometry?
because i want to rebuild it after i delete and added a few objects to it.
Bananenfreak wrote:It could be possible that IsStaticGeometry() gives you the ID.
IsStaticGeometry() gives me a strange long number instead of just the ID of the Static Geometry
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: static geometry vs grouped entities in a node

Post by Samuel »

T4r4ntul4 wrote: what are the max entities in a world?
Lot's of entities won't be a problem. As long as your batch count doesn't get too high.
Nvidia has a nice article on batches if you'd like to read a little about it.
http://www.nvidia.de/docs/IO/8230/BatchBatchBatch.pdf


I don't know of a command to obtain the StaticGeometry ID. Wouldn't the handle you give it during creation suffice?
You could store that and then use it when needed. Or is there a reason that wouldn't work?
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: static geometry vs grouped entities in a node

Post by Bananenfreak »

T4r4ntul4, I don´t know why you want the ID. In PB, we have the ID, that´s the address to this Thing (Entity, StaticGeometry,...) and we also have the PB-intern ...-Number (Entitynumber, Materialnumber, Staticgeometrynumber,...), because PB lays down everything in a list or Array (I don´t know the exact behavior).
So, I believe you want the Staticgeometrynumber. We can´t rebuild a staticgeometry. So just create a variable and receive the number from CreateStaticGeometry(). If you wanna add something, you can free this staticgeometry and create another.
Image
T4r4ntul4
Enthusiast
Enthusiast
Posts: 119
Joined: Tue Mar 04, 2014 4:15 pm
Location: Netherlands

Re: static geometry vs grouped entities in a node

Post by T4r4ntul4 »

@samuel
that was indeed an interesting read.
I don't know of a command to obtain the StaticGeometry ID. Wouldn't the handle you give it during creation suffice?
You could store that and then use it when needed. Or is there a reason that wouldn't work?
but it seems there is no command for it, so iam gonna build a array grid for it.


a@ Bananenfreak

yes but iam using
AddStaticGeometryEntity(#StaticGeometry, EntityID, x, y, z [, ScaleX, ScaleY, ScaleZ [, RotationX, RotationY, RotationZ]])

if i have 50 (or 200) static geometrys, i would like to know to what static geometry iam adding to.

what i said before, its similar to minecraft, the static geometrys are like chunks to hold the entitys. if iam done building i create from the entities a static geometry. if i need to build again and add things to that static geometry, i convert it to the original entities. and so on and so on.

to bad theres no command for it, but i have already ideas to solve this :)
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: static geometry vs grouped entities in a node

Post by Bananenfreak »

You could create an integerarray for handling with your static geometries.
Now you can do this:

Code: Select all

Array() = CreateStaticGeometry(#PB_Any,... bla)
I don´t know what you want to do with a staticgeometry and converting it?! You can´t convert it. If you add an Entity to a static geometry, you still have this entity in your world; You also got an entry in your static geometry.
So, what I do is, I Keep my entities I added to the static geometry and make them invisible (HideEntity()). So they´re still in RAM, you can "touch" them with RayCast, MousePick,... but the GPU doesn´t render these Entities.

@Samuel:
I´ve read Nvidias presentation you posted here, but one question:
According to Nvidia, more triangles in one Batch are rendered with same Speed (rendertime). Only Batchcount is (Rendered Batches per sec.) is important.
So, if I add all Static Entities of an TerrainTile to one big Batch, there should be an increasement in renderspeed contemplable to , hmm, 5-10 Batches (only for static things), or not?
Image
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: static geometry vs grouped entities in a node

Post by Samuel »

@Bananenfreak
Yes, a single batch should be quite a bit faster then multiple batches.

Kojack managed to render 16,777,216 cubes in a single batch. At first it was a little slow, but after he added some shader optimizations the speed improved.
It's related to minecraft which is something that T4r4ntul4 might be interested in.
http://ogre3d.org/forums/viewtopic.php?p=404631#p404631
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: static geometry vs grouped entities in a node

Post by Bananenfreak »

What´s a 3D-texture?!
I've got 2 textures. One is a 16x16 texture atlas of tiles, which I "borrowed" from a minecraft mod page. The second is a 256x256x256 3d texture. I have a shader which uses the 3d position of each pixel to look up the second texture, take that colour and treat the green and blue channels as tile index values in the texture atlas
Image
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: static geometry vs grouped entities in a node

Post by Samuel »

A 3D texture is literally a solid cube of texture. A 2D texture only has U and V coordinates, but with 3D you add on the W coordinate.
The DDS format should support 3D textures. As far as I know you can only use a 3D texture in a shader.
Post Reply