Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / having problems with "instance object"

Author
Message
Death_fox
14
Years of Service
User Offline
Joined: 18th Apr 2012
Location:
Posted: 15th Nov 2012 14:21
hi, i've used instance object before but that was a while ago and now i can't seem to get it work.

heres when i'm getting when i try to run, the object below is the original object and the rest a instances



and the code,





clone object seems to work fine but it puts more of a strain on the system so i'm hoping i just done something wrong to break instance object.
Death_fox
14
Years of Service
User Offline
Joined: 18th Apr 2012
Location:
Posted: 15th Nov 2012 17:44
sorry screwed up the image, here's it is

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Nov 2012 19:09
What's the problem exactly?
Death_fox
14
Years of Service
User Offline
Joined: 18th Apr 2012
Location:
Posted: 15th Nov 2012 20:58
from what i understand instance object is similar to clone object, the only difference is that instances refer to the original for appearance data like rotation and texture so all the above plains should resemble the orinal plain (the one below) but there not
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Nov 2012 23:08
Quote: "the only difference is that instances refer to the original for appearance data like rotation and texture so all the above plains should resemble the orinal plain (the one below) but there not"


Not quite as far as I know. Mesh and texture details are shared but others like position, rotation and color can be changed. An up-to-date list in the Help file would be, well, helpful.
thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 15th Nov 2012 23:18
Like Green Gandalf said, instanced objects share mesh and texture data, as well as animation data. Position, rotation, scale, and some visual parameters can still be changed but you'll have to experiment with that. Instancing objects are a very finicky system, but they can have huge performance gains, at least with high-poly objects. With flat low-poly plains like you have, however, they don't have as much effect.

In addition, instanced objects have a bug where if the main object is out of the screen and is being culled by dbpro, all the instanced objects will disappear even if they are in screen. I fix this problem by positioning the "master object" at the camera position and hiding it, and then manually culling the out of screen instanced objects. You'll also have trouble with animation, because all instanced objects will share the master object's animation data. Generally, the best use of instancing is for high-poly, non-animated objects that you can cull manually with a system you'll have to come up with yourself.

Death_fox
14
Years of Service
User Offline
Joined: 18th Apr 2012
Location:
Posted: 16th Nov 2012 04:50
the plains are only temporary, they'll be replace with 3D objects later in development but thanks for the info anyway guys
Death_fox
14
Years of Service
User Offline
Joined: 18th Apr 2012
Location:
Posted: 17th Nov 2012 16:30
another question / problem, the instanced plains wont respond to a rotate command or colour command, any ideas?
Death_fox
14
Years of Service
User Offline
Joined: 18th Apr 2012
Location:
Posted: 17th Nov 2012 16:32
ignore the last question, it was a error with my code

Login to post a reply

Server time is: 2026-07-08 08:31:33
Your offset time is: 2026-07-08 08:31:33