Create a tunnel in 3D space

This topic is 785 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hello

I am trying to create a tunnel in 3D space as follows:

1. Use a series of 3D control points to form a 3D curve.

2. Use some algorithm (?) to produce geometry for its surface, assuming a constant radius.

Is it possible, what's the level of difficulty and where do I start?

Thanks in advance for helping out.

Share on other sites

More information is needed. Are we talking procedural generated content? or are you looking for a Blender tutorial?

But to answer with the answer most relating to the forum, I would use a series of Cubic or Quadratic Bezier curves, as the control points, and then spawn edge loops along the way, each with the same amount of vertices, so they are easy to connect with triangles.

If you want the tunnel to turn, rather than just sliding from side to side, you can use the derived Bezier curve to calculate the tangent. (https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Specific_cases)

Keep in mind that these curves are not inherently uniform, but if you keep the midpoints evenly distributed, it should be fairly uniform.

What framework are you using?

Share on other sites

Thanks for the reply. What kind of information do you require?

I want to implement an algorithm that creates a tunnel in 3D space that bends and curves.

The tunnel's (i.e. cylinder's) geometry is generated procedurally. Some module X takes the series of cubic/quadratic Bezier curves as input and produces the tesselated surface area of the tunnel which I can then render.

Share on other sites

Each point interval along the curve (you decide the interval) is a 3D point in space. If you take 2 points you can define a line segment. That line segment could have any number of points around it in a circle perpendicular to the line segment (you decide the number of points). Those points would be one or two vertices of a triangle primitive. The next line segment, using the same idea would be the other side making a set of complete triangles. Repeat this as long as the curve goes and render. You will need to make sure of the vertex ordering so it renders with faces toward the camera; or you could tell DX to cull none.

If you need code, I can help, but not till I'm home.

Share on other sites

I think I understand it but I'll enumerate the steps anyway.

1. Form a 3D curve from a series of control points.

2. At 'n' interval, pick a point on the curve and calculate the tangent to the curve, then the unit normal.

3. Using the unit normal, form a circle around the initial point (of radius 'r') that consists of a fixed number of points.

4. At 'n+1' interval, repeat the process above.

5. Use the points on the two successive circles to form patches of geometry (quads or triangles).

6. Repeat for the entire length of the curve.

I do need code (or pseudocode) for this because the devil is in the detail.

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• Forum Statistics

• Total Topics
633704
• Total Posts
3013457
×