Itoo Software Forum

Forest Pack => Forest Pro (*) => Topic started by: Rokas on April 16, 2018, 01:31:33 PM

Title: Scattering Groups
Post by: Rokas on April 16, 2018, 01:31:33 PM
Sometimes ForestPack users wants to scatter groups (instead of collapsed mesh) and wants randomization which does not "explode" their composed geometry.
Lets see how can we do just that by creating floating lanterns on the river scene.

Step 1
Starting with basic geometry items. Total of 4 pieces: Frame, Candle, Candle Flame, and Paper:
(https://i.imgur.com/BFV2X8f.png)

Step 2
Let`s move every item to its intended position.
We should prepare Geometry, so all of the items have the same pivot location.
(https://i.imgur.com/OF0JPxY.png)
First picture shows pivots in different positions. Second- in the same position, just as we need.

If You have a lot of objects, You can use script to set pivots for all the objects at once:
Code: [Select]
for obj in selection do obj.pivot = [Selection.center[1],Selection.center[2],0]
Step 3
Easy one- Group Objects.

Step 4
Now the fun part. Let`s add ForestPack object to the scene.
(https://i.imgur.com/LqFha2o.png)

Step 5
Choose "Custom Object": and select None to initiate object picking...

Step 6
This where it is tricky. Instead of direct clicking your grouped composition, press "h" to open max "Select From Scene" dialog.
Double click Your group name.
This how to add a group instead of only one object if You directly clicked.
(https://i.imgur.com/thT2mHK.png)
*Tip. If group were opened, You could click group's bounding box. It would be the same.
(https://i.imgur.com/7IDUE9s.png)

This is what we have right now:
(https://i.imgur.com/fLp7G7h.png)

Step 7
Randomization.
Too bad default randomization messes up("explodes") whole composition.
(https://i.imgur.com/uozSyZa.png)

Thankfully we can make randomization the same for all grouped objects, by sampling a map.
And since we made pivots in the same location, all composition items will get the same randomization.
Hooray.

Lets create a simple noise map:
(https://i.imgur.com/sIWc7iP.png)
... and instance it in all "Transformation" roll-out Map slots:
(https://i.imgur.com/zxRfbQs.png)

Result haven't changed, as we need to enable that map:
Check all "Map" Check-boxes and Uncheck "Probability Map"
(https://i.imgur.com/db0gVuv.png)

I disabled rotation along X and Y axis by putting values to 0.
(https://i.imgur.com/bpQdgtM.png)

Result start to look like good:
(https://i.imgur.com/W0E67ie.png)

Step 8. Lights.

Easy way to make candles emit light is to apply light material to the sphere we created.
I use vray, so I chose VRayLightMaterial and added Forest Color for randomization:
3 maps to variate flame color and
Tint Override -black and white gray-scale map with multiply blending mode to variate light intensity:
(https://i.imgur.com/VnjWJzV.png)

My final scene looks like this:
(https://i.imgur.com/efWH6Ls.png)


Bonus
There is another way to distribute real lights instead of object with light-material.
Caveat: Lights will not be dynamically linked. So do it as the last step.

What we done so far is good, and only few steps are needed:
Step 1
Detach Flame object from the group.

Step 2
Geometry wont refresh automatically, so refresh it by adding the same group the same way.
This time there will be no flame:
(https://i.imgur.com/nwAOz3T.png)

Step 3.
Lets copy (not instance) ForestPack object and replace Composition object with our flame object:
(https://i.imgur.com/I5iKeGm.png)
We got flames back as separate ForestPack object. Yey..!

Step 4.
Replacing ForestPack with real light:

There is script to do just that. Realy easy, user friendly. Download it from forum  here (https://forum.itoosoft.com/forest-pro-(*)/scripts-for-forest-pack/msg15208/#msg15208).
Create Light You want to distribute.

Run the script.
(https://i.imgur.com/GpgOf06.png)

Choose "Pick object to instance" Select Light object.
Select Your ForestPack Flame Object, and press "Instances to Forest" and press "Del" to delete ForestPack object.
Variable light intensity and color can be achieved using other scripts, like this one (http://www.scriptspot.com/3ds-max/scripts/random-lights)
That is it!

(https://i.imgur.com/TOXkqeU.png)
Final scene with scatter lights:
(https://i.imgur.com/9eoBdHL.jpg)

P.S.
Should You want to randomize a Transform->Translation You need to make sure that Bounding Box of each object in the group is the same. It is possible to add empty vertices:
(https://i.imgur.com/iKsh9DK.gif)


Hope You find techniques described here useful.
Now You should understand how to add groups to scatter. What are their limitations. And how to work around them.
How to scatter real lights with ForestPack Pro and this method drawback.
Let me know if all the steps were clear to understand. I attach my max file for You to check any details.
Title: Re: Scattering Groups
Post by: sarfrazsaifi on July 22, 2019, 03:49:00 AM
Useful indeed...thankyou. One thing i need to ask.. This works if we use some distribution maps. As soon as we do custom edits to forest objects, like i needed to change positions of some objects.. then i tried adding flame geometry group(that i want to replace with vray lights), all flame objects were not showing. Rather one for each object was created. Can't we add lights to custom edited/positioned objects?

Hope i am clear in putting my question/problem...
Title: Re: Scattering Groups
Post by: Rokas on July 22, 2019, 08:51:23 AM
Everything seems to work as expected:
(https://i.imgur.com/YVq388N.gif)

Which step gives You trouble?
Title: Re: Scattering Groups
Post by: sarfrazsaifi on July 22, 2019, 01:48:46 PM
No this step is working fine... But steps after that creating problem..After custom editing objects.. I did :-

1. Copy forest object and renamed.
2. Remove geometry.
3. Add vray lights dummy geometry group by selecting from selection list.

Problem is that not all group is added but just a part of it is added....

If you want i can attach screenshots step by step
Title: Re: Scattering Groups
Post by: Rokas on July 22, 2019, 01:51:54 PM
Please add. and maybe max file as well?
Title: Re: Scattering Groups
Post by: sarfrazsaifi on July 22, 2019, 02:09:52 PM
ok then i am sending max file. contains chandelier, 1 vray sphere light, dummy spheres group to be replaced with vray sphere lights in scattering..
Chandelier and dummy spheres have same pivot.
Please give it a try.. i tried with same steps you told but failed....

file download link:-
https://wetransfer.com/downloads/fb678e2eb858d90fedf4ce2d550f966920190722120828/c12cd6589fbc128cb8ffdbd60025df3320190722120828/66809e
Title: Re: Scattering Groups
Post by: sarfrazsaifi on July 22, 2019, 02:13:00 PM
P.S .. it is working... lights scatter on dummy spheres... if we don't do custom editing... Please first custom edit chandeliers and move them from their positions .. then try scattering vray sphere lights on them...
Title: Re: Scattering Groups
Post by: Rokas on July 22, 2019, 02:15:43 PM
Oh ok. Now I understand. We will check the problem. Thanks.
Title: Re: Scattering Groups
Post by: sarfrazsaifi on July 22, 2019, 02:40:02 PM
Problem solved after all trying probable things.... Actually i skipped that flame detachment step... Thankyou anyways :) 
Title: Re: Scattering Groups
Post by: Rokas on July 22, 2019, 02:41:24 PM
Yes. That is what I was replying already. I see no problem with Custom Edit workflow.
Title: Re: Scattering Groups
Post by: sarfrazsaifi on July 22, 2019, 02:46:40 PM
yeah i was doing a step wrong....
Title: Re: Scattering Groups
Post by: Rokas on July 22, 2019, 02:48:13 PM
No problem. I am happy to hear it is working for You now.
Title: Re: Scattering Groups
Post by: gabu on March 06, 2020, 02:13:27 PM
Hi, would this be possible with lights? I' would like to scatter for example a group that contains corona lights as well. The group scatters fine but the lights don't.
Title: Re: Scattering Groups
Post by: Rokas on March 06, 2020, 02:31:00 PM
Hi, would this be possible with lights? I' would like to scatter for example a group that contains corona lights as well. The group scatters fine but the lights don't.

Hi, unfortunately not.