View Full Version : Random tube generator

09 September 2009, 07:47 PM
Hi all,
do you know if there are some script or plugin that create random tubes over a surface?
i need to obtain an effect like the one in the following picture:

basically my surface is this:
but it could be also a plane, or any surface.

I googled and seems like there isn't something similar. So i wrote a small script, but it is pretty difficult to create it, probably because i don't know basically nothing about maxscript.
Maybe in the next post i can post the script i've done (i have to add some comments before).
Thanks in advance for the replys.

09 September 2009, 04:33 AM
You could try my splinepainter script. It lets you paint a spline ontop of any surface, even surfaces that are oddly shaped like this one. Then make them all renderable.

Another method is to build a bunch of renderable splines flat, and then use something like an fdd modifier to deform the splines onto your mesh.

- Neil

09 September 2009, 10:06 AM
ohh wow, really nice script! it'll be helpfull for sure to draw the spline on the top of that ship! The second method is also nice! :beer:

Anyway i want to try to create that script, basically to learn a bit more about maxscript, so i've attached the script i've done so far (not much) in this post. (you have to change the extension to ".ms").
It's very rough, so please be kind with the comments. :)

I have some question:
1) How to recognize the end side of the surface:
my thought: if i select on edge, i can create a loop and check if the one of the 2 verts of the last selected edge of the loop, is a border vert.
Are there any other ways?

2)choose the new direction:
my thought: i selected the end vert of the current selected edge, and i've obtain a list containing the indexes of the edges that share that vertex.
I assumed the surface wasn't previusly modifyed, so the edges that share the same vert has the indexes as shown in the picture below. Now, if i've got selected the edge 82 and i want to change the direction, i look in the list and take the (82+1)=83 edges.
This works good if the mesh wasn't previusly modifyed. But if it was modifyed (picture B), the edges index aren't arranged in the correct way.

(Sorry for my bad english! )

09 September 2009, 04:38 PM
I'm sorry dude, but I just don't have the time to look at your code. Hopefully someone else has the time to poke at it.

But to quickly answer your question, I am using the paint system in max. The paint system has some nice stuff built in, like it automatically detects when you've left the surface and it ends the spline for you. Sounds like you may be looking for a more "ordered" solution, as in something that will build the pipes in a more orderly fashion. The splinePainter script is a little more haphazard because it doesn't let you snap splines to straight lines or such. So it may not do exactly what you want, the second technique may be better.

Just out of interest, I saw an interview with the guy whose image you like in the first post, and he says his technique is mostly haphazard, so sounds like he doesn't have a perfect solution either. Good luck with your work!

- Neil

09 September 2009, 06:25 PM
don't worry Neil, in this period i don't have the time to work on it.
This is the time to get some suggestions! :)
Thanks Neil for the answer!

CGTalk Moderation
09 September 2009, 06:25 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.