How to render only what's inside a box?


#1

Hi! Is it possible to limit the render to a bounding box? Imagine a big scene and a camera travelling along and rendering only the part of the landscape that is part of an invisible box, which is linked to the camera.
I am able to do it with boolean, but it slows down the scene and was wondering if it could be done by clipping the camera. C4D’s camera clip is close to what I need, but it only cuts out the front and rear of the scene, and I want to cut out also the sides.
Playing with box field maybe?

Thanks!


#2

Do you want to achieve this due to artistic needs or performance needs?

IIRC C4D cameras have a basic camera clipping function which you can limit the near and far distances at which objects render.

If you want a more complex solution almost certainly you’re going to need to get your fingers dirty with Xpresso or Scene Nodes.

There’s a couple of approaches to consider, Camera Frustum culling i.e. delete anything not in the camera view and delete anything not in Cube. Both will give a slightly different render.

There are a number of tutorials for Camera frustum culling (anything not in the camera FOV will be deleted.) on YT for other 3d Apps which should be able to be repurposed for C4D.

Testing what’s in a cube and deleting everything else should be simple task for Scene Nodes.


#3

This post was flagged by the community and is temporarily hidden.


#4

The effect you’re after is very simple, it’s *probably nothing more than a highly subdivided cube with a number of moving noise textures acting as displacement maps for the main landscape, big rocks and finer detail. You just restrict the displacement to the up facing polygons.

You can do this with standard mograph tools and a shader effector set to displacement. You can work procedurally and low subdiv levels until bumping them up for final render. This project will turn c4d’s viewport to molasses at high subdiv levels, just one of the joys of working with c4d I’m afraid.

I said ‘probably’ because there are several ways to skin this particular cat. I’d avoid boole like the plague especially c4d’s boole. I can think of several ways to make this effect each with their own pros and cons but the displacement one is very easy to pull off.

Some versions of this effect clearly use booleans to move trees through the ‘cube’ but it unlikely to have been done with c4d’s boole!!

I hope that points you in the right direction to get you started.


#5

What you are looking for is something like a clipping shader or a slicer shader to literally slice things away as they exit the bounding geometry. This way you build your scene however you want, and just add different objects to inclusion or exclusion from the clipping shader. Using this method you could have clouds that are within your container and outside your container and not affected by it, while having the landscape stay completely square if you wanted.

Doing it at render time will help minimize any slow down in your viewport.

Corona render for c4d does this in the latest release. I believe Arnold and perhaps octane or red shift also have this feature. But looking at the instructional videos on the YouTube channel, it might be the easiest to implement in corona. I’d say download the demo and try it, and if it does what you want, you could probably rent the rendering engine for a month which is $40. Worth it if this is absolutely important for your project.

I’m looking at corona myself simply because of how easy it is to use. Looks like a joy to play with.

Corona 8 slicer in c4d:

Clip geo in Arnold:

Geometry clipping on octane:


#6

Whoa! Thanks Bubblegumdimension! You totally nailed it! :slight_smile:
That’s exactly what I’m after… shame C4D renderer can’t do it; time to put my hands in one of this options!!


#7

I did a bit of digging and this particular effect was very likely done using the Boolean method. Both credited artists are Houdini users and Houdini has the best Boolean tool in the known universe, well, the best I’ve ever used anyway.

If you can do this with shaders at render time then so much the better, the Arnold example of render time Booleans looks great.

If I was asked to copy this effect and wasn’t allowed to use Houdini I would do it with moving large scale displacement map on a Cube and Boole method for the Rocks. A multitude of sins can be hidden with decent texture and displacement mapping for the fine landscape detail. If I get time I might knock up an example.

Anyway, thanks for making Optical Arts known to me, they’ve got an awesome showreel of the highest quality. They’re one of those rare studios that produce real in camera work that looks like 3d mograph and vice versa.


#8

Given how renderers can do this and you can get one for a month, I say try it.

Corona is SO easy to use.

The corona method also lets you assign other shaders to the sliced edge. I’m sure arnold does as it is quite powerful.

The cool thing is - Corona creates nodes in the background, so they are there if you want them. Its a lot more friendly to the “classic” c4d workflow if that is important for you. It is to me. :slight_smile:


#9

infograph Yep, awesome work by Optical Arts!
For my project, I don’t think the displacement method would work, as my landscape includes a road and various elements.
Never used Houdini, but if you say it has a good boolean, it might be the method used in the example. Boolean works in C4D also, and you can apply the desired material to the intersecting cube. It just makes the scene heavy and unpleasant to work with.
BubblegumDimension, I downloaded the trial of Corona, and indeed is easy to use! But I found that its method only substracts geometry, it doesn’t intersect. I found a workaround, but still playing with different options.
Another issue I am dealing with is motion blur. The camera is linked to a car that’s moving along the road inside this cube. I tried different render engines, and they all blur the car as it was passing by, when it shouldn’t be blurred because the camera is following it. The only renderer that gave the desired result is Redshift. No blur in the car, blurred wheels because they are spinning, and blur in the landscape because it’s passing by.

Thank you all for your help!


#10

Yowza, sounds like you’ve got some crazy problems to solve.

Post the final result!


#11

What sad person or persons flagged the post above?

Anyway @WANMAN now you mention there’s a road and car my advice would be different than previously given. It’s really difficult to give accurate answers if certain big details are left out. If you ask other questions in the future, please do as I’m happy to help, think about posting a style frame or sketch of what you are trying to achieve.

Even knowing there’s a road and car I don’t know if you want the road to follow the landscape or the road to be flat and cut through the hills. There’s so many ways to approach this shot but without knowing exactly the look you’re going for it’s just a best guess.

I still think a moving displacement map for the landscape with finer displacement map for sub polygon displacement. I would ray cast a spline onto the landscape and from this spline extrude out road geometry. It’s cheap to delete curve points that miss the landscape at the beginning of the setup than boole away heaps of unnecessary geo at the end. I would use the road geometry proximity to pass an attribute or create a mask that can be used in your landscape shader to limit the sub poly displacement of the landscape under the road.

edit. You don’t even need to ray cast the spline, doh, you can just displace it with the landscape displacement, as I said there’s several ways to skin this cat.

If the landscape displacement texture and spline move together job’s a good 'un. There may be some jitter with low res landscape and low res spline so a reasonable landscape and spline subdivision might be necessary but would provided better performance than c4d’s boole.

With the above method you’re only creating the geometry you intend to render which should make the scene much more manageable than creating a huge landscape then booling most of it away.

I’m confident Scene Nodes has all the tools you need to pull this off. I seem to remember a spline projection plugin (free) being available from somewhere in the dim and distant past.

edit.
As an FYI I rigged my idea together in Blender with a procedurally generated landscape and a road raycast onto it and it ran in real time no jitters at all.