Itoo Software Forum

Forest Pack => Forest Pro (*) => Topic started by: in3des on October 06, 2020, 06:36:10 PM

Title: scatter objects and align rotation by color map
Post by: in3des on October 06, 2020, 06:36:10 PM
Hi,
I'm trying to scatter roof stuff on top of the buildings using forest.
created rotation color map, it works somehow - but still objects not following desired direction.
screen_496 - UVs for roof
screen_500 - how I want all objects to be directed

Could you please help with the correct color map for this case?

Thanks!
Title: Re: scatter objects and align rotation by color map
Post by: Rokas on October 07, 2020, 08:42:59 AM
Hi. Thanks for the question.

You can use this Slope Angle Face Towards effect:
Code: [Select]
vector v = fpItem.surfnormal;
real angle = atan2(v.y,v.x)-degtoRad(Angle1);
fpItem.rotation.z = angle+fpItem.rotation.z;
fpItem.surfDirection = 100;

Full scene attached for Your reference. I have used reference mode and placed items on their pivots. Effect aligned them to face away from roof.
(https://i.imgur.com/i0oXzt4.png)

Hope this helps.
Title: Re: scatter objects and align rotation by color map
Post by: in3des on October 07, 2020, 09:38:03 AM
Hi, Rokas!
Thanks for reply.
The thing is - I have all roof absolutely flat (forgot to attach perspective view).
Is there any solution in this case?

PS. cannot open your example because my max version is 2018.

Thx!
Title: Re: scatter objects and align rotation by color map
Post by: Rokas on October 07, 2020, 01:02:14 PM
In that case use Surface- UV mode and Align feature:
(https://i.imgur.com/Y2uc8lJ.png)
Title: Re: scatter objects and align rotation by color map
Post by: in3des on October 07, 2020, 02:23:26 PM
Cool! Thanks a lot, Rokas!
That works for me  :)
One more thing - is there any way to combine my custom distribution map + default scattered?  So boxes populated not on every roof but with some randomness?
Thx

P.S. and I forgot how to avoid objects being scattered too close to the surface edge. Thx
Title: Re: scatter objects and align rotation by color map
Post by: Rokas on October 07, 2020, 02:38:43 PM
That is now controlled by Your UVs. Move UV ilands to (re-)move items.
Title: Re: scatter objects and align rotation by color map
Post by: in3des on October 07, 2020, 02:44:36 PM
Ok, I see...
Any way to select random objects in 'Custom Edit' mode? So I could delete those manually.
Title: Re: scatter objects and align rotation by color map
Post by: Rokas on October 07, 2020, 02:59:26 PM
Not really built in,  You can use this scripts (https://forum.itoosoft.com/forest-pro-(*)/scripts-for-forest-pack/msg28260/#msg28260) Limit to feature.
Title: Re: scatter objects and align rotation by color map
Post by: in3des on October 07, 2020, 03:15:33 PM
Thanks!
Will give it a try
Title: Re: scatter objects and align rotation by color map
Post by: in3des on October 08, 2020, 07:12:27 PM
Hi,
Limit works fine!
Got another issue - if I want to scatter 2 types of objects then it scatters only object #2 in UV align mode... object #1 is missing
Any walkaround for this?
Thx
Title: Re: scatter objects and align rotation by color map
Post by: Rokas on October 09, 2020, 08:17:37 AM
That is UV mode in effect. They are in the same UV position, so they get the same element scattered.

You can run this command while FP is in custom edit mode to randomly assign geometry items:

Code: [Select]
(for i = 0 to ($.trees.count()-1) do $.trees.setGeomID i (random 1 $.cobjlist.count) ; $.trees.update())

(https://i.imgur.com/8Oq0i59.gif)
Title: Re: scatter objects and align rotation by color map
Post by: in3des on October 09, 2020, 09:05:57 AM
Thank you, Rokas!!!  :)
Title: Re: scatter objects and align rotation by color map
Post by: in3des on October 09, 2020, 01:21:55 PM
In that case use Surface- UV mode and Align feature:
(https://i.imgur.com/Y2uc8lJ.png)

Hi, Rokas.
Another one tiny thing...
can we combine UV align + stepped rotation?
looks like it doesn't work in UV mode (actually it works, but breaks UV alignment)
Title: Re: scatter objects and align rotation by color map
Post by: Rokas on October 09, 2020, 03:17:18 PM
once again UV mode controls distribution and rotation as well.

You can once again override it in custom edit mode:
Code: [Select]
(step= 90 ; for i=0 to ($.trees.count()-1) do $.trees.setRotation i [0,0,(($.trees.getRotation i)[3]+ pi/180*step*(random 0 360/step))] ;$.trees.update())
Title: Re: scatter objects and align rotation by color map
Post by: in3des on October 09, 2020, 03:49:39 PM
Thank you!
Works like a charm! ))
Title: Re: scatter objects and align rotation by color map
Post by: Pierre on February 20, 2021, 10:50:07 AM
In that case use Surface- UV mode and Align feature:
(https://i.imgur.com/Y2uc8lJ.png)

Hello Rokas,
is it possible to have your max file to see how it is done. I tried to reproduce it but it does not work.
Best
Pierre
Title: Re: scatter objects and align rotation by color map
Post by: Rokas on February 22, 2021, 07:39:42 AM
Hello Rokas,
is it possible to have your max file to see how it is done. I tried to reproduce it but it does not work.
Best
Pierre
Sure, Pierre.
Nothing special here, apart that that is uses UVs. Let me know if You need any further explanations.