Results 1 to 12 of 12

Thread: Bake instances

  1. #1
    Registered User mijaba's Avatar
    Join Date
    Dec 2005
    Location
    florida
    Posts
    60

    Bake instances

    It would fabulous if we could bake instancing as a separate object. It would ALSO be cool if we could load instance references from a text file rather than the object itself.
    Any thoughts on how this could be done otherwise? Thanks!

  2. #2
    There's a python script that will bake instances. Check your scripts folder.
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

  3. #3
    Big fan of coffee raw-m's Avatar
    Join Date
    Jul 2003
    Location
    London
    Posts
    2,333
    As ernpchan says, also Scene2Modeler will get all the bakes into one object. There's 2 scripts, one for Layout and one for Modeler. Run the Layout script on your objects and once done hop to Modeler and run the other script to collect the objects.

    There are other similar scripts but this one worked best for my setup. It maybe a bit painful if you have 1000s of objects!

  4. #4
    Stuck in a very big cube Waves of light's Avatar
    Join Date
    Aug 2007
    Location
    South Yorkshire, England
    Posts
    2,500
    Having just baked out 75,000+ stadium seats, let me share my story.

    First off - Baking the instances. There were two scripts that I tested, bake_instance.py (found under C:\Program Files\NewTek\LightWave11.6.1\support\plugins\scrip ts\Python\Layout\Generic) and Mike Green's MG_bake_selected_instancers_GN.py (http://www.mikegreen.name/Lscripts.html)

    What I found was that both scripts would become extremely slow the more instances backed. E.g. using bake_instance.py on all the top tier of seats took 18 hours to bake! I tried this with Mike's script and could see that we were heading towards similar timings. So, to get around this I broke my instance placeholder layer into layers containing no more than 2000 objects. After this, I found that the baking routine was a lot quicker. Mike's script also uses less RAM and is slightly quicker at baking instances.

    This is all done in Layout and after I'd baked a set of seats, I used cp_SaveTransformed by Chris Peterson (xChrisx on the forum) to save out each instance as its own .lwo file. For some reason I couldn't get scene2modeler to work. I don't know if this was due to the number of instances I was trying to bake, but once I had a working workflow, I stuck with it.

    One note: Re. cp_SaveTransformed - If you select 'Selected' it will only bake out 1,000 instances regardless of how many instances you have selected. Instead, I used 'All' - which saves out a single lwo for any additional items, but you can always delete them if you don't want them.

    In the end, I wanted to join the instances together and make single .lwo and be able to export to .obj. So I used Collapse Object function in Modeler.
    Last edited by Waves of light; 05-20-2014 at 01:04 PM.


    Systen Spec: i7 4930k (OC @4.5ghz),ASUS p9x79 MB, 32GB Ballistix RAM, H60 cooling, Samsung SSD 120GB, WD 1TB

  5. #5
    Big fan of coffee raw-m's Avatar
    Join Date
    Jul 2003
    Location
    London
    Posts
    2,333
    Wave of Light, I enjoyed that story!

  6. #6
    Stuck in a very big cube Waves of light's Avatar
    Join Date
    Aug 2007
    Location
    South Yorkshire, England
    Posts
    2,500
    Quote Originally Posted by raw-m View Post
    Wave of Light, I enjoyed that story!
    Cheers Mark.

    It was so I could have an obj of a football stadium I was doing. I'm just glad it wasn't for a client, because I wouldn't have been able to deliver it. It took me a week (and lots of moaning and help from lightwave users on skype) to figure out the pitfalls.
    Last edited by Waves of light; 05-20-2014 at 01:23 PM.


    Systen Spec: i7 4930k (OC @4.5ghz),ASUS p9x79 MB, 32GB Ballistix RAM, H60 cooling, Samsung SSD 120GB, WD 1TB

  7. #7
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,726
    Hmmmm, I wonder what the deal with speed was? Was the s/w having to reload an accumulating mesh repeatedly or something? Perhaps a different strategy of duplication in LWM might offer significant speed increases?

    Like, possibly, saving out an array of destination points and allowing LWM do the heavy lifting of copying would be faster than whatever is currently happening. --Or not.

    --Also, does an individual point in Modeler have rotation values? --I'd think it must, for spline operations, but I've been wrong a lot lately.
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  8. #8
    skeptic lertola2's Avatar
    Join Date
    Dec 2008
    Location
    New York City
    Posts
    1,110
    I did not see mentioned in this thread that you can combine your baked instances into a single .lwo by exporting an fbx file and importing it into modeler. That method does have the drawback that each instance gets unique surface names created for it. The best solution to that problem that I know about is to use this script to select similar named surface polys and rename them yourself: https://www.lightwave3d.com/assets/p...lectsurfnames/

    -Joe

  9. #9
    Big fan of coffee raw-m's Avatar
    Join Date
    Jul 2003
    Location
    London
    Posts
    2,333
    Quote Originally Posted by Waves of light View Post
    Cheers Mark.

    It was so I could have an obj of a football stadium I was doing. I'm just glad it wasn't for a client, because I wouldn't have been able to deliver it. It took me a week (and lots of moaning and help from lightwave users on skype) to figure out the pitfalls.
    You did a cracking job there and clearly a great way to learn. Hope it earns you a packet!

  10. #10
    Stuck in a very big cube Waves of light's Avatar
    Join Date
    Aug 2007
    Location
    South Yorkshire, England
    Posts
    2,500
    Quote Originally Posted by jeric_synergy View Post
    Hmmmm, I wonder what the deal with speed was? Was the s/w having to reload an accumulating mesh repeatedly or something? Perhaps a different strategy of duplication in LWM might offer significant speed increases?

    Like, possibly, saving out an array of destination points and allowing LWM do the heavy lifting of copying would be faster than whatever is currently happening. --Or not.

    --Also, does an individual point in Modeler have rotation values? --I'd think it must, for spline operations, but I've been wrong a lot lately.
    You can visibly see it slowing down as it gets further into the routine. There needs to be some dump process, so that it bakes say 1000 instances, dumps a temp file, bakes the next 1000 and then joins them all up at the end.

    At the moment it looks like the calculation/process is this

    Bake A
    Bake B, save A and B
    Bake C, save A, B and C
    Bake D, save A,B,C and D

    And so on.

    Quote Originally Posted by lertola2 View Post
    I did not see mentioned in this thread that you can combine your baked instances into a single .lwo by exporting an fbx file and importing it into modeler. That method does have the drawback that each instance gets unique surface names created for it. The best solution to that problem that I know about is to use this script to select similar named surface polys and rename them yourself: https://www.lightwave3d.com/assets/p...lectsurfnames/

    -Joe
    Joe - I did see your response regarding export and import as an fbx file in another thread. However, when I tried it with the overall bake, it crashed Lightwave. I have 32GB of RAM, so I would have hoped that would be enough to hand the export. If I get a chance, I will try the fbx export on sections of the instance placeholders and see if that works.

    Quote Originally Posted by raw-m View Post
    You did a cracking job there and clearly a great way to learn. Hope it earns you a packet!
    I wish, it was for a TurboSquid model, ready for the World Cup in Brazil - you can see it here: http://www.turbosquid.com/3d-models/...stadium/810178

    But yes, the whole design process and making it compatible with other formats was definitely a worthwhile learning experience.

    If I get the chance, I will upload a .lws file with the instance placeholder and the seats and you guys can see if you can come up with a better solution.

    Ricky.


    Systen Spec: i7 4930k (OC @4.5ghz),ASUS p9x79 MB, 32GB Ballistix RAM, H60 cooling, Samsung SSD 120GB, WD 1TB

  11. #11
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,726
    This has been a very informative thread.

    Anytime LWM displays something, it's a big loss: a facility to suppress display updating would probably be worthwhile. (LW12)
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  12. #12
    Stuck in a very big cube Waves of light's Avatar
    Join Date
    Aug 2007
    Location
    South Yorkshire, England
    Posts
    2,500
    Quote Originally Posted by jeric_synergy View Post
    This has been a very informative thread.

    Anytime LWM displays something, it's a big loss: a facility to suppress display updating would probably be worthwhile. (LW12)
    Ok, here's a little breakdown for you:

    Stadium seats - 424 polys each.

    Section 1 - 2522 seats - 9mins to bake
    Section 2 - 2353 seats - 8mins to bake
    Section 3 - 2325 seats - 8mins to bake (only 1 min approx. to get half way on the progress bar)
    Section 4 - 1646 seats - 3mins to bake
    Section 5 - 1901 seats - 4mins to bake
    Section 6 - 4224 seats - 44 mins to bake!

    Here's the scene file with the entire placeholders polys (approx 15,000) and seats (folded and unfolded) for you guys to play with:

    Stadium_Seats_for_NT_Forum.zip

    When you run bake_instance.py or Mike's script, be sure to have the Object properties panel open for the Placeholder layer (if you're using Mike's script) or the seats layer (if using the native baking script) and watch the 'Objects in Scene' rise quickly and reduces to a snails pace when it bakes the higher numbers.

    And the only way to kill the script is to open Windows Task Manager and kill Layout.

    Oh and sorry for the thread hijacking mijaba.

    Regards,
    Ricky.
    Last edited by Waves of light; 05-23-2014 at 07:12 AM.


    Systen Spec: i7 4930k (OC @4.5ghz),ASUS p9x79 MB, 32GB Ballistix RAM, H60 cooling, Samsung SSD 120GB, WD 1TB

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •