Itoo Software Forum

Author Topic: Look At Boundary with falloff and normal direction  (Read 1374 times)

UB8512

  • Newbie
  • *
  • Posts: 34
Look At Boundary with falloff and normal direction
« on: August 10, 2016, 02:05:20 PM »
Hi

I am using Look At Boundary effect on grass billboards. It works good except few things:
1. I need to set much higher Distance to edge value than width of surface mesh, if I want to affect all grass billboards. My idea was, that the value should be same as width of surface mesh.
2. After I turned effect ON, normal direction of grass seems to be not working.
3. How to revers falloff direction funcionality?

Is there any way how to modify the script, or do I something wrong?  :)
I also attached max scene.

Michal Karmazín

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2447
Re: Look At Boundary with falloff and normal direction
« Reply #1 on: August 12, 2016, 01:14:40 PM »
Hi,

Unfortunately, in case of open splines (as yours), such effect will not behave "correctly"- fpItem.areaIncNearest / pItem.areaIncDistance functions will not return "desired" values (the Thickness value affects such effect the way it'll consider distance to "virtual thickness" border as the closest one). Also towards spline ends it'll not behave as expected.

To reverse the falloff, the easeOut interpolation can be used instead and it'll "limit" such effect from the other side.

vector v = fpItem.areaIncNearest - fpItem.Position;
fpItem.rotation.z = easeOut(fpItem.areaIncDistance, 0, effectLimit,fpItem.rotation.z, -atan2(v.x, v.y));


Actually, for your scenario you might useful a slightly different work-flow - the UV Surface mode with UV Transfrom - Align applied. To map your surface you might find handy the Spline mapping (thought to get uniform distribution a manual tweaking might be required - like use of Straighten Selection & Relax tools).

Hope that helps.

Best regards,

UB8512

  • Newbie
  • *
  • Posts: 34
Re: Look At Boundary with falloff and normal direction
« Reply #2 on: August 13, 2016, 05:25:04 PM »
Thanks for tip, workflow using UV surface works great, but in this case I can not use areas falloff density and scale functions, which are important for me.

What would really help me is if the effect script will rotate items according their local axis...I think the script do not preserves normal direction. All items are oriented up.

Help for "fpItem.rotation" says: "Rotation of Forest Item in local coordinates (expressed in radians)"...but it seems to be in world coordinates.

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2991
Re: Look At Boundary with falloff and normal direction
« Reply #3 on: August 15, 2016, 02:13:08 PM »
Hi!

Please take a look at the attached Effect file. It's will rotate all objects to face the nearest boundary using their local coordinate system.

I hope it helps but please let me know if you have further questions.

Many thanks,

Paul
Paul Roberts
iToo Software

UB8512

  • Newbie
  • *
  • Posts: 34
Re: Look At Boundary with falloff and normal direction
« Reply #4 on: August 16, 2016, 05:50:25 AM »
Thanks Paul, it works perfectly now  8) . It speeds up my work a lot, because I am doing grass for 43km of roads in racing game.