Itoo Software Forum

Author Topic: Build Geometry only on visible spline segments.  (Read 503 times)

Klonsemann

  • Newbie
  • *
  • Posts: 42
Build Geometry only on visible spline segments.
« on: November 14, 2017, 05:45:01 PM »
I got a huge Spline with a lot of segments.

Is it possible to have a arithmetic expression that generates
geometrie only on spline segments that are actualy visible to the camera ?

Thanks for any feedback.

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 3109
    • iToo Software
Re: Build Geometry only on visible spline segments.
« Reply #1 on: November 15, 2017, 08:57:04 AM »
Hi, that's not possible because the position (and other properties) of each segment may depend on the previous ones. Everything need to be processed in sequence.

Anyway, on a first step RailClone computes only the segment's bounding box and other parameters needed to build the object.
The final geometry is processed only when needed: normally when render starts, except in V-Ray which is done dinamically, when the raytracer hits the bounding box of each segment.

This feature is configurable by the following registry key, and it's enabled by default:

HKEY_LOCAL_MACHINE\SOFTWARE\Itoo Software\RailClone Pro\DynamicGeometry

Therefore, if you use V-Ray, RailClone already is using a 'camera clipping' feature, although is transparent for the user. In fact, this is much more advanced than the standard camera clipping included in Forest.

Carlos Quintero
iToo Software

Klonsemann

  • Newbie
  • *
  • Posts: 42
Re: Build Geometry only on visible spline segments.
« Reply #2 on: November 15, 2017, 09:36:22 AM »
We are using RC also as FP Source Object.
So would be great to clip that geometry away.

I found a way with DataChannel modifier,
but we are still on Max2016 so this is actually no solve.

I attached some images to describe.

The hedges in different styles, the grass areas,
the curb stones and pebble beds all driven with one spline.
And during WIP should be keept as this for easier changings.

Espacialy the curbstone and hedge drives the RAM crazy when
generated for the whole area.

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 3109
    • iToo Software
Re: Build Geometry only on visible spline segments.
« Reply #3 on: November 16, 2017, 09:03:26 AM »
If i understand well, hedge leaves are generated with a FP object, and RC is used only to create the scatterring surface. That's correct ?
In this case, the RC object should not be too heavy.

Do you use V-Ray or other renderer ?
It would be interesting to see what RC segments are generated as instances. In V-Ray, it can be done using Display->Debug mode, as described here.

Carlos Quintero
iToo Software

Klonsemann

  • Newbie
  • *
  • Posts: 42
Re: Build Geometry only on visible spline segments.
« Reply #4 on: November 16, 2017, 09:35:24 AM »
Yes, thats correct. (RC as FP source)
The RC segments for the hedge is already as low as possible.

But for more natural looking shape, we add details with subdivide turbosmooth and displace.
Have a look at the stack.
Therefore instancing is not so important, more to reduce the faces the stack has to work with.

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1538
Re: Build Geometry only on visible spline segments.
« Reply #5 on: November 16, 2017, 05:31:47 PM »
Hi,

If you just need to reduce the poly count so that it can be more easily processed through the stack then there might be a couple of workarounds. First of all it depends on if your camera is animated or not. If it's not animated you could draw a simple clipping spline to match the camera frustum and use this to show only those segments that are in view. The process for that would be as follows.

1 - Draw a spline from the top view the size of the camera frustum, ensuring that it includes all the parts of the RailClone object that are in the final render.
2 - Add a clipping spline to the generator(s).
3 - Change the clipping mode to Include.
4 - For more efficiency, and if the style allows it, you should also turn off slice for all the segments. Set the generator's No Slice mode to Preserve to ensure you don't lose geometry around the edges of the shot.

Unfortunately if your camera is animated this won't work because animated splines do not currently update clipping operations. Instead you could just try a simple volume select to delete those parts of the mesh that aren't visible before you pass them up the stack. To do this.

1 - Create a geometry object that matches the camera frustum. I find the ViewFrustum script by Martin Breidt really handy for this, it generates a geometry object that is linked to the camera, so if you change the field of view then the geometry object also updates.
2 - Turn off the RC object's instancing engine.
3 - Add a Volume Select modifier.
4 - Change Stack Selection Level to Face.
5 - Change Selection Method to Invert.
6 - Add a DeleteMesh modifier.

I've attached a sample file illustrating both techniques.

I hope that helps, please let me know if you have any further questions.

Many Thanks,

Paul
Paul Roberts
iToo Software

Klonsemann

  • Newbie
  • *
  • Posts: 42
Re: Build Geometry only on visible spline segments.
« Reply #6 on: November 17, 2017, 08:41:24 AM »
Thanks for your tips. Didnt know about the ViewFrustum script.
The camera is not animated, but there are currently 12Cams in the scene.
To setup the volume select for all cams would be a mess.
Maybe i try a position script and move the frustum object to the active camera instead of linking.

When on max 2017.1 or above, here is a SelectVertsFacingCamera DataChannel modifier solution by Changsoo Eun.
Actually its not exact the same, because it is not selecting the backfaces of the current view.
But maybe someone else does this find usefull.
« Last Edit: November 17, 2017, 08:47:00 AM by Klonsemann »