November 11, 2020

Final Tunnel Construction | Houdini Railsystem | Chapter 3 - Clip 3

A bit late - it is slowly getting close and I might need more  time now. 

This is the final of chapter 3.

I am going to re-record some stuff now since to adjust for Houdini 18.5. But since I have already a finished screen capture it should go quickly. 

But again maybe it takes longer than a week now for the next clip.


Well, I have a wonderful electronic invention. I want you to see,

welcome to the third and last clip of chapter three. We are going to reuse some blocks we have done before and then create the cut in the terrain. But what do I mean by reusing blocks? We previously created a terrain split and we created the tunnel curves. We used both to create masks for the height field, but then we changed the very height field, that was the basis for them. 

Since we obviously need both for future steps and the final result, we have to repeat those steps. And that's one additional benefit of the one container approach. I can simply look up where I made that exact operation, select the node box and I can copy and paste it as one step.

All we have to do to make this block be the split terrain again - block, is to change where the incoming poly terrain comes from. We want the more detailed version. And with that, we have the split using all the parameters, sitting on the control node. Since this is a project meant to be shared and should be as clean as possible, I have to correct the naming of the output Nulls. We now have the partial and rest of the terrain. But taking a closer look at the polygons, I think it could use a bit more resolution, at least with the idea of what I use for the final render. So instead of the default value of one in the density, I am increasing that to two. Again, not important for the system in itself, but that's what I went with for the render.

First, we stole a block from chapter one and now we grab another block from the previous chapter. We changed the landscape. And with that, we might have changed. What is part of the tunnel curve, simply copying the block to create the tunnel. And again, we use the latest poly terrain.

Now we have a better terrain and the matching tunnel, it is just a minor detail. And maybe you could get away with just using the tunnel from the first time. But if you did something more drastic with the height field, you should recalculate where the tunnel is. Worst case scenario, if you don't do that, is that your added noise created a surface beyond the existing tunnel curve.

If that curve does not exceed the boundary of the terrain, we get a problem in the Boolean operation. The boolean is going to cut the hole through the poly terrain for a perfect fit of the tunnel shape.

But take a closer look at the result we have here. With the default subtract boolean, which treats both inputs as solids, we actually get the terrain slice with the tunnel combined. Let's take a second here. I am going for something different. I want the tunnels reach out and be closed by a gate, but if we would keep the setting on this boolean node, we could highlight the openings created by the cut.

 Combined with all elements this could be an interesting look here. You can see how this would look with the full terrain and objects included. I also made a render since I liked how it almost made the openings look natural. But even though this is something worth to play with, I want to follow the idea of Gates. We could combine both ideas and only keep the tunnel section that is reaching out of the terrain.

But at some point I just have to stop building new stuff for the same project, but I still want to give you the ideas so that you can follow them by yourself, if you are interested. For my variant. I want to keep terrain and tunnel separated. So turn the set a, to be treated as surface. Now, the solid shape of the tunnel is only used to cut into the surface.

And this result is where it paid off, to take multiple turns of processing the height field. You can always improve on the idea, but for me, the task of embedding the tunnel into the terrain was successful. I redo the normals at this point with the same settings as before. Sometimes the Boolean cut messes with them, better safe than sorry. Template the tunnel geometry.

And you get a good idea how it will look in the end. This also gives you the opportunity to go back into the distortion, right in front of the erode note. Here, you can still play around with the noise to find something that will give your specific example and interesting look. My goal was to break, open the surface and be able to see parts of the embedded tunnel.

So with an amplitude of 10 and an element size of 42, I have ideal value. Okay. At this point we have finished the terrain. We look into a small scattering example later utilizing our created masks, but otherwise we don't need to change the terrain anymore. We will need it for some testing though. This is the cut terrain.

Now we can take a closer look at the tunnel. Currently, we just have a closed tube. First thing I want to do is to blast off the endings. I don't want to just delete them. I am going to use them for the Gates later. That is why I am creating a measure node to give each primitive an attribute with its area.

When we look at the spreadsheet, we can identify them quickly as the only ones, having a bigger value. For the tunnel itself, I want to get rid of the ending caps and I do that by using a blast node, addressing the area attribute bigger than 300. I could have used 100 or even 10 since the other primitive seem to not go higher than that.

A tunnel is not just a thin sheet of material. So I am giving it a bit of thickness. Here we use poly extrude, choose whatever you like for the distance. The only limitation is that the train has to fit through, to see how much place we have left. We first need to reverse the tunnel. At the moment, the extrude is moving outwards, but we use this shape for the cut, which means it should not go beyond that.

With the reverse, the extruded surface points inwards, but something is missing. By default, the back is not activated. To get the full shape we need to select output back. And now we have a complete tunnel shape. We will need the position of the inner wall later for the Gates. That information is provided by the extrude node.

We just need to activate front group. This is what we extruded so we can call it the inner wall. From here, we branch out to export the tunnel itself. So it makes sense to create new normals here, but here I also create the output for just the inner wall. For them  I just blast away, whatever is not part of the inner wall group.

Place the output Null. Always a good time for some cleanup as well. Behind the normal node we also want to create an output for the full tunnel shape, but we also should apply UVS. I am using the labs node: Auto UV. It is immensely useful and often gives perfectly usable results on its own. For a shape like these tubes, the method UV auto Seam does a decent job.

If you want to take a look at how the UVS turned out, follow it up with a UV quick shade node. And with that, we have the tunnel shape ready. There is another part that I mentioned a few times now, the Gates. The Gates will be procedurally controlled by the approaching train. So we will look at them once we have a train to trigger the animation. But this is the point where we extract the primitives that are the base to build the animated parts.

We use the blast to get rid of the end caps. That means we can use the same blast, but activate, delete non-selected.

With the tunnel shape as template, you can see why we needed to grab the inner wall by itself. The gate primitives were created before the extrude node. So they are now bigger than the tunnel itself. This will be easy to fix with the inner walls at hand.

This is a good time to create a first combination of all the current elements of the project. I am creating a temporary merge of all components at the top of the tree. So what do we have? We have a rail, the tunnel shape, the partial and the rest of the terrain. And now with all of those nodes selected, we can all click to create a merge node with all of them connected.

I am really liking how the tunnel and the terrain came together.

What bothers me a bit is the strong drop of the rail in sections where the tunnel is directly over a Valley. It does what it should. It lerps the position down, but the setting is too strong. So let's find a better setting. Here you have another benefit of the one container setup. It would be a bad experience to start changing the lerp value right here. 

There is too much going on with the erosion, the Boolean operation and the render resolution, I am still using. But since we are already in the container where everything is happening, I can pick the two elements that I need to get the right preview. We have the rail right here. You could even pick the pre oriented curve to get even better response. And to get a sense of the environment we template the initial partial terrain.

Now we can see what we want to manipulate. How much should the rail drop when it comes out of a mountain, hanging over a Valley. As a reminder, we have two parameters that we can adjust. Most importantly, we have the lerp multiplier. We started with something above 0.5. If we bring it closer to 0.3, it still has a drop, but it doesn't look that extreme anymore.

The other parameter was the scale, which defined at what distance to the ground, we would get the full transition down to the bottom. If we lower it, the curve over the bigger valleys would get the full transition. Only limited by the lerp multiplier, but we want less of the effect. So we should bring the scale a bit up while the lerp value stays smaller.

That looks like a good compromise. Let's bring everything back in and take a look at the result of chapter three.

There you have it, a glorious terrain with a rail going through it, but it just hangs there in the air. Like it just don't care about gravity. We need some fricking support to hold the rail. In the next chapter, we are going to create the vex logic to find the places for towers and bridges. Come back next time for chapter four, or I will tickle you in your sleep so that you will wet the bed. 

Warning: Undefined array key "preview" in /var/www/ on line 90

Warning: Undefined array key "preview" in /var/www/ on line 102

Warning: Undefined array key "preview" in /var/www/ on line 113

Warning: Undefined array key "action" in /var/www/ on line 113

Warning: Undefined array key "preview" in /var/www/ on line 75

Leave a Reply

Your email address will not be published. Required fields are marked *

Warning: Undefined array key "preview" in /var/www/ on line 79

David Kahl VFX

a Software Developer, Nerd and VFX Artist based in Germany
Visit Patreon
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram