Multi/Random -Replication and Instancing Lab: Application and Comparison

akmerlowakmerlow Posts: 1,124
edited December 2019 in Bryce Discussion

In thread about prevention of Bryce crashes we touched a bit on this theme (big thanks to @Slepalex for participation!), and it's pretty interesting topic that deserves it's own thread and discussion. What you use in which situations - multi-replicate, random replicate, instancing lab. And how you mix those approaches. Also, optimisation variants.
https://www.daz3d.com/forums/discussion/353606/could-we-have-a-faq-of-most-usual-situations-that-may-make-bryce-crash

 

akmerlow wrote:

As promised, some pics for last post.

Random-replicated:

Bigger number of copies, without restrictions:

Without collision detection, so it gets funky:

In smaller space:

In 300x200x300 space, collision detection:

Instances in small space, then random replicate into larger space:

Controlled mulltireplicate of group that was made with random instancing, if you zoom in this picture into 150% or more, you ll see separate people on it (open image in fullsize first):

And close-up around center of it:

 

 

However, in 200x200x200 space i get 500 instance copies number put with all setting enabled without problem, as you don't get 500 in small space with collision detection, but it also works fine and gives you 500 instances in that space without detection. So i think that Bryce crashes if he is tasked to calculate all this settings in big space, but manages to do it in smaller space (i think it places less copies to fill it*). Some more tests, again with 500 instances number though it will give less actually depending on space:

 

Slepalex wrote:

Invalid output.
Your first mistake. You need to save the scene, close the file and open it again. Or start in a new file. Bryce accumulates in memory the number of rollbacks after complex operations and there is no memory left.
The second mistake. Your object is too big to fit in a 200x200 space. Reducing the object by 8 times and all 500 clones will fit in this space without collisions.
Here are 500 stones without problems and collisions located on a 900x900 space. The dimensions of the stone are 20.73x18.16x21.55.

 

 

Slepalex wrote:
In general, an interesting topic with multi-replication. I have never dealt closely with this issue.
Here are 500 clones from 6 originals in a space of 200x200x900. I selected all 6 shapes, pressed Alt + R and checked all 4 options. The first attempt to make 999 clones in this space crashed. But here, each of the 6 shapes has a 1024x1024 texture and a bump map of the same size. The bump map in this case is superfluous in my opinion, and the textures can be reduced to 256x256. Each figure has 1,500 polygons (triangles). I got a file size of 12.1 MB. The initial file with 6 figures weighed 12.0 MB.

 

Slepalex wrote:
For comparison. This is obtained in IL in three steps. Here are 988 clones and 6 originals (in the foreground.)
File size 13.5 MB.

 

Slepalex wrote:
Let's continue the experiment. I decided to combine multireplication with existing clones from IL. I twice added in different places closer to the foreground a few more clones of 100 and 200 people. The collision effect works great! That is, clones from multireplication do not overlap with clones from IL. This provides some additional facilities. The number of clones increased to 1288 people except for the originals, and the file size grew to 13.6 MB (0.1 MB).

-
Besides this, there was a question i wanted to get advice on. In one of my recent scenes i had a thought of using Instancing Lab to place nice amount of people on sidewalk/pavement/footpath,  but street model that i used had sidewalk part going under buildings, so when i was trying to use IL for placing people on it, i often was ending up with instances appearing where buildings are, which was not intended (and in IL itself you only see preview of a surface/object you use as target for instance landing, and can't see any other objects/geometry in the scene you may want to evade colliding with.)

Post edited by akmerlow on
«1

Comments

  • Electro-ElvisElectro-Elvis Posts: 883
    edited December 2019

    Nice examples here akmerlow. Thank you for sharing them.

    With regard to your question. You can select two or more objects in the IL and then you see all selected objects in the preview. In my example below, I used a cube as target for instancing landing, but did not want to have my objects within the shed. Hence I selected it as well. And so it was much easier to place the components in the preview outside of the shed.

    Instancing Lab

    I have also a question. Where did you and slepalex get your low poly characters? They are looking nice.

    Example_InstancingLab.jpg
    640 x 479 - 78K
    Post edited by Electro-Elvis on
  • akmerlowakmerlow Posts: 1,124

    Electro-Elvis, thanks for solution proposal!

    Now, where you can get those characters - those are freebies over here:
    https://skfb.ly/6HoRX

  • Electro-ElvisElectro-Elvis Posts: 883
    edited December 2019

    akmerlow, you are welcome and thanks a lot for the link. 

    But I'm afraid, I faced a problem. I was able to load the lowpoly people directly into Bryce though, but they were not textured.

    Post edited by Electro-Elvis on
  • SlepalexSlepalex Posts: 911

    akmerlow, you are welcome and thanks a lot for the link. 

    But I'm afraid, I faced a problem. I was able to load the lowpoly people directly into Bryce though, but they were not textured.

    Select the model, go to the Materials Lab, press the P button and you are in the Pictures tab. Click on the free gray square (or on the "Load" button in the left window) and in the dialog box specify the path to your texture on the disk. Click on the "Load" button in the middle window and specify the path to the "Bump" map. Enter!

  • SlepalexSlepalex Posts: 911

    Important Note! I don’t know why, but Bryce does not understand the JPEG extension in the file when loading the texture. Therefore, first remove the letter "E" from the extension and convert it to JPG.

  • SlepalexSlepalex Posts: 911

    Some free low-poly models of people I got here https://www.cgtrader.com/ (registration is needed).

  • SlepalexSlepalex Posts: 911

    akmerlow, there is nothing easier than placing people on the sidewalk so that they do not intersect with the building or other objects. One little trick. Put on the sidewalk 2D Face the desired size and specify it as a target in IL. You can put several 2D Faces and seed them one at a time with people. But you can make it easier: Duplicate the first 2D Face (Ctrl + D) and move it to the desired location on the sidewalk. The object is duplicated together with a group of people attached to it. Just select a group and in the "Object Attributes" window on the "Linking" tab you will see what this group is attached to. Here you can delete all the bindings and the group will be independent.
    Do not forget to periodically press Ctrl + S!

  • SlepalexSlepalex Posts: 911

    Experiment with Random Replicate.
    Create a terrain, a cube with dimensions Y = 100 X = any, Z = 100 and two stones with dimensions from the calculation so that all the clones fit in the selected area in the Random Replicate window (Fig. 1). Select both stones and press Alt + R (Random Replicate), Fig. 2.
    All 400 clones landed on the ground, but ignored the cube. Moreover, along the northern side of the cube there is only a narrow strip of clones. The second I can not explain. I also can not explain the first. I do not know whether it is a virtue or a disadvantage. Most likely this is a virtue.

     

    1.jpg
    800 x 600 - 410K
    2.jpg
    801 x 600 - 64K
    3.jpg
    802 x 602 - 203K
    4.jpg
    800 x 600 - 510K
  • SlepalexSlepalex Posts: 911
    edited December 2019

    For akmerlow.
    We have: a house, sidewalk, two characters. Put on the sidewalk 2D Face or whatever.
    We select it as a target for IL (Fig. 1). We select the quantity, density, and rotation angle in Y. We obtain Fig. 2, where on the Linking tab we see that the group is attached to 2D Face 1. Some characters may intersect. This is fixed manually.
    Select 2D Face 1, press Ctrl + D and in the top view we move 2D Face 2 together with Group 2 attached to it. I repeated this operation 6 times here.
    You can put 6 pieces of 2D Face on the sidewalk and apply IL one by one, but it seems to me that the first option is simpler and faster.

    Then you can remove or hide all 2D Face, but before that, unlink the groups to the parent object or ungroup.

     

    1.jpg
    640 x 476 - 82K
    2.jpg
    776 x 478 - 98K
    3.jpg
    827 x 562 - 115K
    4.jpg
    800 x 600 - 319K
    Post edited by Slepalex on
  • Electro-ElvisElectro-Elvis Posts: 883
    edited December 2019
    Slepalex said:

    Experiment with Random Replicate.
    Create a terrain, a cube with dimensions Y = 100 X = any, Z = 100 and two stones with dimensions from the calculation so that all the clones fit in the selected area in the Random Replicate window (Fig. 1). Select both stones and press Alt + R (Random Replicate), Fig. 2.
    All 400 clones landed on the ground, but ignored the cube. Moreover, along the northern side of the cube there is only a narrow strip of clones. The second I can not explain. I also can not explain the first. I do not know whether it is a virtue or a disadvantage. Most likely this is a virtue.

    Hi slepalex

    That's an interesting behaviour and in my opinion rather unexpected, but actually very nice to have. I would also say it is rather a welcome feature, than a disadvantage. Thanks for sharing.

    Additional thought: Actually Bryce's approach to put the stones outside the cube but inside the boundaries of Random Replicate if Collision Detection is ticked is merely logical.

    Post edited by Electro-Elvis on
  • SlepalexSlepalex Posts: 911

    Here is another experiment with Random Replicate. With these dialog box and stone size settings, all 400 clones are placed around the cube. Only emptiness remains unclear along the northern face of the cube. What would that mean?

     

    1.jpg
    266 x 204 - 15K
    2.jpg
    515 x 485 - 73K
    3.jpg
    800 x 600 - 364K
  • SlepalexSlepalex Posts: 911

    Let's continue the experiment with Random Replicate with the same settings. I replaced the cube with a second terrain. As you can see, the stones fell on the second terrain too. And yet in the north there is an empty space.

     

    4.jpg
    800 x 600 - 381K
  • HansmarHansmar Posts: 2,929

    Very interesting experimenting and explanation, Slepalex, Elvis and Akmerlow!

  • SlepalexSlepalex Posts: 911

    I pushed Terrain 1 to the side and removed Plane 1. The stones lay evenly around the cube on an imaginary infinite plane. And on the north side too.

     

    5.jpg
    800 x 600 - 78K
    6.jpg
    800 x 600 - 201K
  • HansmarHansmar Posts: 2,929
    edited January 2020

    OK, so I did some testing with random replicate (Alt-R). Maybe some or all of this was known to some or all of you, but it was largely new to me. Here are the results.

    Replicating stones on a plane

    I used 3 different stones. Tried 500 stones on 1000x1000 (with instance, collision detection and landing) : crash.

    Up to 400 stones on 1000x1000 worked well (slow), but 500 stones led to a crash. I repeated 400 stones several times and it works with collision detection and instancing.

    The stones are actual instances (same form, different sizes and with rotation though).

    Replicating stones on a terrain

    I again started with 3 stones. I tried to replicate 50 stones on 200x200 with collision detection and landing (and instancing): nothing happens! Also tried to put them on the plane (instead of the terrain): nothing happened. And similar when I put the stones in the air. However, when I put the stones in the air and instanced them without landing, it worked.  Also from the terrain without landing, it works, with and without collision detection.

    Replicating trees on a plane

    There was no way to do random replication with trees on a plane when collision detection was on. It always leads to a crash in Bryce. However, when putting a tree in the air or on a plane and replicating it without collision detection and without landing is successful with 50 and 100 instances (though 100 is very, very slow). Strangely enough, even if I do not choose to land, the trees do land on the plane. And, they do land on top of each other (or on each other’s bounding box).

    Replicating trees with a terrain

    The same (instances, no collision detection, no landing) with a terrain has the same strange effect: the trees are instanced, but land on the plane instead of the terrain, independent of whether I put the tree on the plane, on the terrain or in the air. The instances are indeed instances, but not of the same form as the original tree. From the top they all have the same form, though different sizes, but from the front the ratio vertical / horizontal is also different. See picture, where the original is on the terrain and the random replicated instances on the plane:

    Replicating with lattices

    50 lattices are replicated with collision detection and landing. Lattices are not replicated with ‘instance’ selected. However, when selecting all options (constrain rotation, collision detection, landing and instance) it starts working, but takes so long, that I do not want to wait any longer. I tried with 10 lattices and everything selected, but again a long time ‘running’, too long for patience. Final attempt with 2 instances: no luck again; running without result. So, do not choose 'instance' for lattices when doing random replicate.

    Replicating with terrains

    Same as for lattices: no instances are created.

    But without selecting instances, the terrains are randomly replicated. Landing works partly as expected: when landing is selected, they are landed, when not then not. However, when landing is not selected the terrains are all at the height of the originally replicated terrain. So, independent of the height chosen, they do not go up or down, but they stay e.g in the air. This is different to both stones and trees. However, independent of the selection of rotation only on the Y axis, they are not rotated at all (on any axis).

    Replicating with metaballs

    Same as for lattices: no instances are created. Landing and collision detection appear to work correctly. I only tried spherical, so you do not see rotation.

    Spheres, cylinders, cubes, tori, pyramids and cones: they do not instance, but the rest works correctly, including landing on a terrain (when starting on or above one) and not on the plane.

    Some other items, e.g. additional primitives, i.e. ‘simple’ meshes
    These do instance and everything, including collision detection and landing, appears to work. They land on the terrain (if there is a terrain on which the original is placed).

    Grouped meshes

    They do not instance, but you can random multireplicate them normally. After ungrouping and instancing and regrouping, they do multireplicate as instances, but if they are complex (groups in groups) not all groups were restored (which was my fault). I tried this with ‘Pier light 1’. The instanced groups have lower memory use than the non-instanced ones, but due to not regrouping within the groups, the lights do not shine through the lamp.

    Special trees

    As for trees, the grouped instances from special trees (which are actually grouped sets of trees), the random replication (Alt-R) does not work when ‘collision detection’ is chosen: Bryce crashes. However, the instancing works with the ungrouped instanced tree, resulting in separate parts being instanced.

    You can also instance the separate parts, regroup them and then do random replicate. This leads to items called ’10’ or ‘4’ for the separate parts and ‘Group 2’, or ‘Group 7’ for the groups. The items look like instances (they have dashed lines). The replicated grouped instances are slightly smaller in memory, than the replicated grouped originals. For ‘special maple’ the non-instanced set of 121 (including) the original was 3.84 MB and for the replicated 121 grouped instances, it was 2.39 MB. So, ungrouping, instancing re-grouping and then random replicating does pay off in memory use.

    In conclusion

    Alt-R, random replicating, works rather differently on different types of items. Sometimes not all options (eg, instancing, collision detection) work. But in general, nice results can be reached.

    Here some renders with random replicated trees, which I manually moved (since they do not land on the terrain) and to get a nicer picture.

    These are 1002 trees (two originals, 500 instances of each). I instanced them in groups ohf 50 (using Alt-R and lots of patience) and put them in the air above the terrain, after which I landed them in groups (too many together leads to crashing). Then I tried to land as many as I could see that landed on top of each other onto the terrain and then I moved the terrain upward to cover the lower part of the roots.

    These are about 200 trees random replicated from one original. I moved them to a smaller strip (could have done that via the replication, but did not think of it in time). Again, I landed them on the terrain and then put the terrain slightly higher.

    This pile of 1102 stones was made by instancing 1 original in groups of 50 without landing and then landing each group after instancing. First I made it on 200 x 200, followed by a group of 150 x 150 and then the cross-form using 50 x 600. I like the effect, although some of the balances are unrealistic.

     

    instanced trees on plane.JPG
    577 x 545 - 76K
    1000 trees.jpg
    875 x 875 - 993K
    testtree_instance.jpg
    875 x 875 - 948K
    pile of stones.jpg
    875 x 875 - 456K
    Post edited by Hansmar on
  • SlepalexSlepalex Posts: 911

    Hans, you wrote too much and haphazardly.
    Terrains, lattices, metabols and primitives are not mesh objects, so the "instance" option does not make sense. You can convert these objects to a mesh.
    With trees, this is a different story. I downloaded two Bryce Trees and applied Alt + R with all the options. Bryce crashed with 500, 100, and 50 pieces. Then I made one clone from the originals (Ctrl + I) and applied Alt + R (100 copies) to them. Bryce has long considered this command. I managed to smoke a cigarette or drink a cup of coffee. In general, it lasted 5-10 minutes, but still I got 102 clones + two originals. All clones landed on the ground without collisions.
    Conclusion: it makes sense to work with Bryce trees only in IL.

    ***
    How to clone grouped mesh objects I have explained many times in several topics.

     

    1.jpg
    778 x 533 - 117K
    2.jpg
    605 x 544 - 92K
  • SlepalexSlepalex Posts: 911

    In IL, 500 tree clones were created without problems. True, some instances intersect. But this can be fixed manually. File size 10.4 MB. The size of the previous file is 9.47 Mb.

    3.jpg
    800 x 600 - 445K
  • @Hansmar: These very green trees look excellent. I like them very much. But I agree with slepalex (who explained it to us in its inimitable way) for trees IL is the better choice. With Random Replicate you must have the patience of Buddah.

  • HoroHoro Posts: 10,641

    Do not forget Rashad's "HOW TO USE THE INSTANCING LAB IN BRYCE 7.1 PRO/ A complete tutorial": https://www.daz3d.com/forums/viewthread/3381/ (July 2012). I made a 8 page PDF from it long ago and have it on my website with Rashad's permission.

  • HansmarHansmar Posts: 2,929

    Sorry if I wrote too much for some. I just tried several options to see what happens. I did not try to find the best way for trees or anything else. I am aware of the options with IL (though maybe not all of them), but for me Alt-R was an untested option sofar. Anyway, thanks for all the suggestions.

  • HansmarHansmar Posts: 2,929
    edited January 2020

    I did some more experimenting with a tree. It was a BTO, but I forgot to write down which one, not that it matters.

    First: 20 instances via IL

    Now, is that not a great hedgerow of exactly the same trees?

    Then I was trying to be like Buddha again and made 20 with random replication. I did it on a small stretch, but still needed quite some replacement to make a relatively nice row.

    Sorry for the difference in light: I made a mistake in camera and director rendering, I think. And, I did not tree to put them with the roots in the ground, that was not the purpose of this 'show'.

    Now what happened here? The trees still have the same general shape, but rather different sizes (even ridiculously different, if you ask me). Nevertheless, somehow this appeals more to me than all the same trees. Now, I know, you can instance five or six or more trees to have five, six or more forms and sizes and that is probably better still. But I thought, let's show tis difference and let's also consider that this probably is why random replication takes (much) more time than instancing: it makes more changes. Random replication resizes and rotates, while IL simply instances (with the settings I used).

    I also tried making on instance and then multireplicating it (with instancing), That was probably the fastest method, but I did not really time it. However, the result was (logically): 20 exactly the same trees. 

     

    tree instanced.jpg
    875 x 875 - 90K
    trees random replicated.jpg
    1754 x 875 - 336K
    Post edited by Hansmar on
  • SlepalexSlepalex Posts: 911

    Hans, you forgot to indicate in the last experiment that you did not mark "Instance". Therefore, you received copies (duplicates), but not clones (instances). And this is very important when explaining your actions. Fig. 1.
    In your last experiment, the trees do not have the same shape. They are simply squeezed or stretched along the Y axis. I did the same thing. Why such a mistake? Ask the programmers. Fig. 2.
    And I also got such a strange result. Fig. 3. All options Alt + R are marked as in fig. 1.
    All these results were obtained with the checkmark "Constrain Rotation to Y-axis". If there is no checkmark, the result is the same.
    ***
    But IL allows you to resize objects over a wide range when you save the form. Fig. 4.
    ___
    And yes, I still got 10 clones with options like in fig. 5. If there is a checkmark "Collision Detection" the program crashes.

    1.jpg
    482 x 387 - 36K
    2.jpg
    791 x 299 - 39K
    3.jpg
    780 x 421 - 46K
    4.jpg
    802 x 602 - 167K
    5.jpg
    652 x 459 - 78K
  • SlepalexSlepalex Posts: 911
    Hansmar said:

    Random replication resizes and rotates, while IL simply instances (with the settings I used).

     

    Il can not only resize objects, rotate along Y, but also create copies (duplicates). Just need to uncheck "Instance". 

    6.jpg
    642 x 478 - 81K
  • HansmarHansmar Posts: 2,929
    edited January 2020

    Slepalex: I was quite convinced that I did have 'instance' on in IL or my fig. 1. But a new try indeed gave similar results asyou found. I must have either accidentally turned 'instance' of or I had set the size at 100% (no range). This is the picture with the IL instancing 20 trees, where I made sure that rotation was 0-360, instance was on and scale was 56-147.

    You're results with all four options ticked in random replicate with trees are the same as mine (crash) and indeed, as I mentioned in my long comment before, whether or not you tick 'Constrain rotation on y-axis' does not make a difference.

    Thanks for your patience in explaining. I hope I won't forget anymore to check all the settings.

     

    tree instance again.jpg
    1754 x 875 - 201K
    Post edited by Hansmar on
  • SlepalexSlepalex Posts: 911
    edited January 2020

    For mermaid.
    How to distinguish clones (instances) from duplicates (copies) of originals?
    The clones are shown with a dashed line, and the duplicates of the originals are solid.

    On the left is the original, on the right is a clone.

    2.jpg
    794 x 535 - 270K
    Post edited by Slepalex on
  • SlepalexSlepalex Posts: 911
    edited January 2020

    For mermaid.

    The file with duplicates of flower has a size of 3.89 Mb, with clones - 665 Kb, although outwardly they do not differ.

     

    3.jpg
    800 x 600 - 149K
    4.jpg
    800 x 600 - 150K
    Post edited by Slepalex on
  • mermaid010mermaid010 Posts: 5,489

    Thanks Slepalex, mine are definitely duplicates, blush I will need to re-read Carter's and Kine_magiK's pdfs which I downloaded from Horo's site.

  • SlepalexSlepalex Posts: 911
    edited March 2020

    Thanks Slepalex, mine are definitely duplicates, blush I will need to re-read Carter's and Kine_magiK's pdfs which I downloaded from Horo's site.

    Hi mermaid.
    Mostly for large plant arrays I use Instancing Lab. Sometimes I clone objects manually using Ctrl + I, then Alt + I. Then, from a top view, I distribute the objects in the scene. In the right view, if necessary, raise the object to a certain height with the Page Up key (or Shift + Page Up, or Alt + Page Up). Then I land the object with the arrow.
    ____
    The most subtle nuance is as follows. All Bryce trees and stones can be cloned into Instancing Lab. All Bryce primitives can only be duplicated, but this is not scary, since they are lightweight and described in the program not by polygons, but by a formula.
    Any groups cannot be cloned manually in Instancing Lab! This is the fault of the programmers. If you import a single mesh object into Bryce, then it can be cloned manually or in Instancing Lab. If you import a group of mesh objects, then it cannot be cloned, but only duplicated. You will run out of memory. All xFrog objects usually consist of mesh groups: trunk, branches, foliage, etc. But there is one trick when cloning a group. It’s just hard for me to write a long text and correctly translate it into English. A lot of effort and time. I do not speak English. So read my correspondence with Hansmar here:
    https://www.deviantart.com/hansmar/art/Treeline-494128484


    Regards, Alexey.

    Post edited by Slepalex on
  • HoroHoro Posts: 10,641

    Groups cannot be instanced, correct. However, if you Ungroup the object and keep all parts selected, then it can be instanced and the instance grouped again. I never tried objects that have several levels of grouped parts (groups within groups). If I remember correctly, Rashad came up with this method. See http://www.daz3d.com/forums/viewthread/3381/ and more specific http://www.daz3d.com/forums/discussion/comment/43403/#Comment_43403

  • mermaid010mermaid010 Posts: 5,489

    Thanks Slepalex and Horo for your input, Im trying to instance some xFrog flowers for a scene for the current challenge, but so far no luck except crashes.I will refer to the links posted by both of you.

Sign In or Register to comment.