I'm animating a model of a robotic manipulator in Irrlicht based on a real-world machine that's actuated by a cable-pulley system. I have the pulleys modeled, but wanted to also model the cables. The only issue is, the cable mesh would change shape a lot, based on the joint angles. It would always be made up of a cylinder, a section of a torus, another cylinder, another torus section, another cylinder, then another torus section. But the torus sections would change angular size as the joints move, so my initial thought was that it'd be best if I just reserved an area in memory large enough to hold the entire mesh buffer, then created it on the fly every frame based on an algorithm. I could go as low as an eight-sided solid-colored cable, which would probably be only a few hundred polygons for the entire thing.
Is there an easier way to do this? And can I do this on a decently high-end computer without suffering a noticeable performance loss? And would it be faster if I made a concerted effort to hold the number of vertices and triangles constant, then just updated their positions based on the joint angles?
Thanks in advance.
Creating a cable/rope mesh on the fly, every frame
-
- Competition winner
- Posts: 688
- Joined: Mon Sep 10, 2012 8:51 am
Re: Creating a cable/rope mesh on the fly, every frame
Consider using IVideoDriver::draw3DLine()
Re: Creating a cable/rope mesh on the fly, every frame
I thought of that, but my program is way too realistic-looking for that to look right. I've actually got another way of doing it that I'm looking into, where I can texture the cable and animate it. It uses an algorithm that someone I work with developed for something else though, so unfortunately I can't say how I'm going to do it. I really wish I could post screenshots, but I'm sure that'd upset my supervisors. It was hard enough convincing them to use an open-source game engine for a commercial simulator, but so far it's looking really nice, and I like the Irrlicht API.chronologicaldot wrote:Consider using IVideoDriver::draw3DLine()
Re: Creating a cable/rope mesh on the fly, every frame
Perhaps Bullet ropes for behavior + one static, but well tesselated cylinder?
It all depends on your target hw.
It all depends on your target hw.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: Creating a cable/rope mesh on the fly, every frame
Since you already seem to have the algorithm for the cable movement, you probably only need an animated mesh which you can position on your own. At least if the joints stay in the same place, you could do so with a skinned mesh based on a simple skeleton positioned at the rotation points of the rope. If you need arbitrary bend points, you might succeeed with the same approach, but multiple joints (would more look like a chain then, not a rope, though). For this approach you don't have to consider the texturing during run-time.
The other way, as you suggested, yould be to create the cylinder each frame or at least each movement. Since you can tesselate the rope at roundings this would give a perfect detail and due to the simple geometry would also be feasible
The other way, as you suggested, yould be to create the cylinder each frame or at least each movement. Since you can tesselate the rope at roundings this would give a perfect detail and due to the simple geometry would also be feasible
Re: Creating a cable/rope mesh on the fly, every frame
Thanks! I think the approach I'm going to use will involve creating a many-segmented cylinder, then come up with an algorithm to move along the cable and bend the cylinder's vertices slightly at each segment to curve it around the pulleys, then keep it straight when it's not on a pulley. In any case, that's a lower-priority goal, since there's a lot I need to first. It just looked odd having the pulleys there with no cables on them.hybrid wrote:Since you already seem to have the algorithm for the cable movement, you probably only need an animated mesh which you can position on your own. At least if the joints stay in the same place, you could do so with a skinned mesh based on a simple skeleton positioned at the rotation points of the rope. If you need arbitrary bend points, you might succeeed with the same approach, but multiple joints (would more look like a chain then, not a rope, though). For this approach you don't have to consider the texturing during run-time.
The other way, as you suggested, yould be to create the cylinder each frame or at least each movement. Since you can tesselate the rope at roundings this would give a perfect detail and due to the simple geometry would also be feasible