Notifications
Clear all

[Closed] Idea for altering a Bobo script – will it work?

Hi

I need to start putting 3D trees into my scene, obviously the best way to do this is with proxies. However, I want to set up the placement using PFlow. Enter Bobo’s BakePFlowToObjects script!

But… there are a few additional things I would like to do, so I thought I’d ask here if it is even possible before I spend hours (days?) figuring out how to do it.

  1. Is it possible to alter Bobo’s scipt so that instead of assigning one proxy instance to each particle, it randomly picks an instance from a group? By this I mean that instead of picking one tree to be instanced, you could pick ten (maybe in a picklist or similar), and then it would randomly instance one of those ten to each particle.

if so, then is it possible to do this… (a better solution):

  1. Could you set up a material frequency with 10 material ID definitions, and then somehow access this information to determine which tree proxy is instanced at which particle?

For instance, the tree type 1 proxy is instanced onto every particle that is currently assigned material ID #1 etc.

I don’t necessarily need examples (although that would be great!), just a general indication of whether it’s possible or not.

Thanks everyone!

10 Replies

I would say its entirely possible! I haven’t looked at bob’s script but it shouldn’t be much more than a few extra lines of code

Why not just leave the trees as pflow?
You can do everything you want model and material-wise as well inside pflow.

1 Reply
(@mickyg)
Joined: 11 months ago

Posts: 0

Because I will need to have a significant amount of trees in the scene, which means I have to use proxies. As far as I’m aware you can’t instance proxies in a particle flow scene, hence the need to use Bobo’s script as a workaround.

Is this what you meant?

I think he wants VRay or MRProxies. Which can’t be placed except with Bobo’s script.

Adjusting the script to choose a random source object should be reallllly easy.

You would collect the objects you want into an array and then instead of:

proxyobj = $obj

you would use proxyobj = ProxyObjArray[(random 1 proxyobjarray.count)]

1 Reply
(@mickyg)
Joined: 11 months ago

Posts: 0

Thanks thatoneguy. As you can see Bobo has been kind enough to help out, but I also appreciate the help you gave me. I’m still new to this so I’ll analyse your sample script and add it to my knowledge banks!

What I would do is pick a root node and grab its children (which also works great with Groups) – similar to how the Shape Instance lets you pick a group or hierarchy and use each object as an option. This way, all you have to add is a checkbox that says “Use Children” and then add some code to collect the children into an array and assign based on the particle MatID (which is readable via MAXScript).

But that is just me

Edit: Ooops, getting the material ID from outside the system might be tricky if at all possible.

Ok, I updated my copy of the script

http://www.scriptspot.com/bobo/mxs2009/pf2mrproxy/BakePFlowToObjects.zip

with another option to distribute clones of the children of the selected object.
For example, group the proxies, press the >>Pick a Distribution Source… button, hit H to open the Select By Name and pick the group head. Instead of using the group, the members of the group will be distributed randomly. If the group contains one node, it will work just like the first method.

It does not respect the MatIDs of the particles but does its own random generation.

This version also supports the distribution of lights (by setting their multiplier to 0 when the particle is dead) so it can be used to do moving omnis etc.

Hi Bobo, thanks for getting involved!

When I run the script and follow your steps, it seems instead to distribute dummy objects throughout the scene.

Here is my ground, particles and proxy objects:

And then I group the proxies as per your instruction and distribute the group using your script, but these are the results:

Even if I create a group with only one tree, it does this:

Thanks again for your help with this.

Did you switch the script to the SECOND option (Distributing CHILDREN of the selected source)? If you are using the FIRST option on the list, it will copy the head of the Group only.

Sorry, I am sure I forgot to mention there are 3 options now (object, children, shapes).

1 Reply
(@mickyg)
Joined: 11 months ago

Posts: 0

Thanks Bobo, for some reason my system was still referring to the old script even though I saved the new one and made a button for it, so that option was not there for me. All good now though.

Can I just say that I appreciate how you are quick to help everyone out, not just with information but often with actual script. You’ve helped me a few times now, and I am thankful that you are so forthcoming with the Max community.