implementing Random Bitmaps

Share your ZGE-development tips and techniques here!

Moderator: Moderators

Post Reply
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

implementing Random Bitmaps

Post by jph_wacheski »

This one took me a bit of experimentation to figure out, so I will share the results and save the rest of you all some time.

In order to have randomized Bitmaps per/Model you have to place the Bitmap component in the Model's Definitions,. HOWEVER you must also place the Material that uses the Bitmap in the Definitions as well ! If you are useing your oun random Value you would likely define that there as well. Attached is a small example to look at it in action.

This is a very powerfull feature of ZGE put it to good use.
Attachments
random_bitmap_tests.zgeproj
the project file example.
(1.45 KiB) Downloaded 594 times
iterationGAMES.com
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

The reason that the material must be inside the model is because when a model is spawned as a clone, the whole model and all child-components (and their internal references to each other) are fully cloned. If another component (outside the model) reference a child component to the model (like a material reference a bitmap) and the model is cloned, then the material will still reference the original bitmap (not the clone). Many words... but it is quite simple really :)

Thanks for sharing, jph.
Post Reply