GLBasic forum

Feature request => 3D => Topic started by: MrTAToad on 2012-Feb-25

Title: Clone object
Post by: MrTAToad on 2012-Feb-25
Would be handy if a 3D object could be cloned, rather than having to (re)load the same object over and over.
Title: Re: Clone object
Post by: kanonet on 2012-Feb-25
Why clone/reload a object? You can load it one time and draw it over and over again, just like sprites.
Title: Re: Clone object
Post by: fuzzy70 on 2012-Feb-25
Do you mean "Instancing" type clones?

Lee
Title: Re: Clone object
Post by: MrTAToad on 2012-Feb-25
Oh yes, usually I do use the same object multiple times...
Title: Re: Clone object
Post by: Kitty Hello on 2012-Mar-15
Why would you?
Title: Re: Clone object
Post by: mentalthink on 2012-Mar-15
I think Clone, consume less memory... or something... I read in some render engines... almost are Unbiased renders... speaks about million of clones of 3d meshes whitout consume more memory or CPU, I´m not understand this think, but if they talk abouit this I think it´s thru...

Will be very interesting have this Clone Command, and don´t consume anything in te device... if it´s possible, how I say, I don´t have any idea about this advanced things in programming.
Title: Re: Clone object
Post by: fuzzy70 on 2012-Mar-15
Clones are useful for things like trees etc, Why model 50 different trees when you can make 2-3 & clone them with say a random rotation & then you have your forest with a minimal memory footprint.

Here is a picture I created that is made from 1 flat plane (the floor) & 1 cube which I cloned.

Lee



[attachment deleted by admin]
Title: Re: Clone object
Post by: kanonet on 2012-Mar-15
But you wont need a new clone command for that, just load (or create) one cube and draw it thousand times...
Title: Re: Clone object
Post by: fuzzy70 on 2012-Mar-16
Quote from: kanonet on 2012-Mar-15
But you wont need a new clone command for that, just load (or create) one cube and draw it thousand times...

Then obviously I do not understand the original question of this post. The picture I posted is an object type called a cloner & you feed it whatever you want, could be 1 cube or any number of objects & you tell it what to do with them like scale/rotate etc, amount of clones plus other options all from 1 set of parameters. That to me sounds like a clone command

Lee
Title: Re: Clone object
Post by: Slydog on 2012-Mar-16
Ya, I wasn't too sure what the original request meant either.

Right now with GLBasic, you can load ONE model into memory, and in the SAME frame, draw it as many times as you want, at different locations, each with it's own scale and rotation.  Kinda like a cloned object.

I'm not sure how GLBasic / OpenGL handles this behind the scenes however.  It may transfer one copy of the model for each clone to the OpenGL framework, repeating this each frame, which may be time and memory consuming.  It would be nice to transfer just ONE copy and get OpenGL to use that copy for all instances.  I don't know.  It'd be nice if it kept it in OpenGL between frames so it doesn't have to move it to OpenGL each frame (is that what a 'Vertex Buffer Object' is?)

Or, maybe a function to 'copy' a model in GLBasic.  Then you can alter this 'copy' using the GLBasic vertex commands perhaps to give it a unique feature (color / texture, or different vertex locations, more/less vertices, etc).  But I don't think that is why MrTAToad wanted this.
Title: Re: Clone object
Post by: fuzzy70 on 2012-Mar-16
The example I posted the object that is being cloned is only stored once, the only extra data that is stored is the position/rotation etc of the clones. With a simple cube obviously the memory savings are very small as it only consists of 8 points & 12 polys. My example uses a rounded cube with 248 points & 266 polys & is cloned 100 times  so the memory saving is considerably more, also the screen updates are noticeably quicker then having 100 manually placed items. It is using openGL as if I switch the prefs to software rendering I get bounding boxes instead of the object along with huge slow down when I rotate the scene.

I tried looking on google & found some examples but was hard to work out what was best, along with some using hardware shaders & what version of openGL supports what it all got more & more confusing to me  :D

Think I will just stick to my modelling/rendering packages with regards to 3D for the present time  =D

Lee
Title: Re: Clone object
Post by: MrTAToad on 2012-Mar-20
It probably wasn't a good suggestion :)