Adjusting extrusion width with track scale


27-07-2014 01:23:34

I'm working on generating tree trunks using the ogre procedural library. It's been working great with the exception of me getting stuck on adjusting widths of the extrusions... I'm putting in a quick code snippet of my test case.

std::vector<Ogre::Vector3>& positions;
std::vector<Ogre::Real>& radii;


Procedural::CatmullRomSpline3 curve = Procedural::CatmullRomSpline3();

for(int i=0; i<positions.size(); i++)

Procedural::Path p = curve.realizePath();

Procedural::Shape s = Procedural::CircleShape().setRadius(1).realizeShape();

Procedural::Track track = Procedural::Track(Procedural::Track::AM_POINT);

for(int i=0; i<radii.size(); i++)
track.addKeyFrame(i, radii);


I'm basically trying to have a path extruded with a circle and set radius. I'm trying to use the Track object to set adjustments in width, as tree branches get smaller as they come away from the trunk. From what I read in the documentation and code snippets, you can use a Track to adjust the scale of the width at key frames along the path. My incoming data set for a branch will be a series of pairs (position and radius of width). I've marked the numSeg to 1, so only my points are generated. The radius pairs are then added as key frames matching the indexes of the positions. I marked the scales larger differences in this test as you should clearly see the difference. However, in the attached screenshot, you'll see I end up with a large disc end cap, and the rest of the tube is all the same size.

Anyone have any thoughts? Hoping the library maintainers might be able to chime in as I'm probably doing something wrong. There's just not that many examples of using the Track object. Thanks!


28-07-2014 12:40:33

Looks like you found a bug...
I don't have access to a developpement environnement these days, so I fixed the bug directly on google code, hope I didn't break anything!
You can update to the latest revision, I hope your problem is fixed by now..


28-07-2014 17:12:34

Thanks you mikachu! That worked perfect. :D Below is the screenshot of the same code working with your fixed applied to the extrusion class.