I am going to add screenshots and descript correction as soon as I can 🙂
welcome to the last clip of chapter two, a clip so short that it barely made it into its own video. This will only be a short segment, but it is quite important. We are going to block out the tunnels like the terrain. This will not be the final output, but it will be the outline. We need to go back to the height field to find the tunnels we need the terrain slice.
Tunnels can only exist in this area. Then we also need to know where our rail will be. As I said, I don't need to use the rail geometry for that, just the curve. We need to make another intersect test to find out if we are indeed in a tunnel. So I connect the curve into a wrangle that is supposed to only keep the tunnel.
The terrain goes into the second channel and we keep the wrangle as a point wrangle. I begin with the variables I need for the intersect function. And then I create a direction vector in contrast to what I said before for the intersect, you don't want a normalized vector. The length of the vector also defines the range of the test Ray.
So this vector is basically a big up vector. How big is determined by a channel? The intersect itself now uses the geometry on the second input. Starts at each point of the curve and follows the up vector this time. We don't care about the hit position. We just want to check if the returning value is minus one.
If that is the case, the Ray hit no terrain and we can get rid of this point. If it did actually hit the terrain, the variable inter would hold the primitive number. And we know that the curve is below the terrain, click on the icon to generate the parameter and set the up vector to something high, like 1000.
And as you can see, we are left with only the points below the surface. Each of these points have made in successful intersect having these points already isolated. I can now define what is actually used to create the tunnel shape. In fact, I want to have the tunnel reach out of the terrain. So I take the original curve again into a wrangle and connect the tunnel curves into the second input.
I want to find the distance of the normal point to the closest tunnel curve. If that distance is bigger than a threshold, I define with a channel. And also if there is no tunnel curve at all, if the rail never goes below the terrain, we would have no points for the distance test. Any curve would have at least a points.
So that was what I tested against in either of those cases. We want to get rid of the point and it looks as if we just went back to the tunnel curve. But if we increase the threshold by multiple units, you can see how the curve is now going beyond the terrain.
We may need this curve later. So throw down an output. No, this is the tunnel curve initial. Now I can create the blocking geometry. We can use a simple polywire node for this, for the radius. We are going to need something big. Remember, we want to send a train through this. This is not yet what we use for the baleen operation on the terrain, but it is basically the shape we will end up with.
Let's place another, no, the tunnel geo initial. And let's leave it at that for now. We might move the poly wire over to the next step, but I wanted you to see where this is going. The tunnel controls are going to the chapter two folder and allow us to manipulate the size and length of the tunnel segments.
Here. You can make an artistic decision since the curve inside the terrain was not as strongly affected by the loop, but picks up the curve slope. Once it reaches out of the terrain. You might want to set the Y component on one value that way you would get straight tunnel pieces sticking out of the surface.
But I kind of liked the bended tunnel with this short look at the tunnel curve. We can wrap the second chapter and the next chapter, we are going to create additional detail on the landscape by using several height field tools. Then we finalize the tunnel pieces and cut through the finished terrain.
Leave a Reply