Skip to main content

Place items on a displaced surface


If you use Displacement maps to create terrain, then this effect can help. It allows you to position the objects on the Z axis to match the displaced mesh with additional controls to randomise each item's position on the Z axis. To use it download and load items on displaced surface.eff and follow these steps:

  1. Add item(s) in the Geometry rollout in the usual way. You can mix items of different heights.

  2. Align Forest Pack with the displaced plane on the Z axis.

  3. In the Transform rollout, enter a value of 100% for both the Z Min and Z Max parameters. Activate Z > Map and Probability map.

  4. Apply the displacement texture to the Map input slot.

  5. Feel free to add any Scale randomisation, the effect can compensate for differently sized items.

  6. In the Distribution rollout, set the Collision Height to 100%. Once the value has been changed, collisions can be turned off if you don't need them.

  7. Go to the Effects rollout and click DisplacementSize select the Amount Controller of the V-Ray Displacement modifier (or other similar plugin) that is applied to the surface. The tree's Z position is now driven by this value, changing the parameter also automatically updates Forest Pack's distribution.

  8. Use zRandMin and zRandMax to add additional Z position randomisation to the items after displacement.

  9. Use AltitudeLimitTop to hide objects above a certain height.

  10. Use AltitudeLimitBottom to hide objects below certain height.

  11. Use topFalloff to gradually scale objects to 0 as they approach the height set in AltitudeLimitTop.

  12. Use bottomFalloff to gradually scale objects to 0 as they approach the height set in AltitudeLimitBottom.


This effect will not allow you to use the Slope or Direction controls in the surface rollout.

Effect Script

#set position
real actualHeight = (fpItem.collisionHeight/fpItem.scale.z)*1;
real displacedPercentage = fpItem.position.z/actualHeight;
fpItem.position.z =(displacedPercentage*DisplacementSize)+randomReal(zRandMin, zRandMax);

#Limit by altitude
fpItem.visible = if(fpItem.position.z<AltitudeLimitTop,if(fpItem.position.z>AltitudeLimitBottom,1,0),0);

#Size by altitude
vector falloffScale = if(fpItem.position.z>AltitudeLimitTop-topFalloff, ((topFalloff-(fpItem.position.z-(AltitudeLimitTop-topFalloff)))/topFalloff)*fpItem.scale,fpItem.scale);
fpItem.scale = falloffScale;

falloffScale = if(fpItem.position.z<AltitudeLimitBottom+BottomFalloff, (((fpItem.position.z-AltitudeLimitBottom))/BottomFalloff)*fpItem.scale,fpItem.Scale);
fpItem.scale = falloffScale;

You can find this Effect within the Forest Effects Library.

Sample scene: displacementEffect.max

This Effect Uses


  • DisplacementSize

    Type: Scene Units

    This reads the value of another controller in the scene. Use it to select the Amount parameter of a displacement modifier.

  • zRandMin

    Type: Scene Units

  • zRandMax

    Type: Scene Units

  • AltitudeLimitTop

    Type: Scene Units

  • AltitudeLimitBottom

    Type: Scene Units

  • topFalloff

    Type: Scene Units

  • bottomFalloff

    Type: Scene Units


  • fpItem.position

    Position vector of individual fp Item.

  • fpItem.collisionHeight

    The collision height of collision sphere for the current item.


  • randomReal(a,b)

    Returns a real random number in the range a,b