View Full Version : Noob OpenGL polygon question
07-18-2005, 08:50 PM
I'm trying to create a tree model using L-system and OpenGL/C++. What I did was instanciating a series of tapered cylinders in a tree shape. I achieved this through popping and pushing into position matrix. But the final product has unpleasant looking joints. I wanna smooth out the connecting joints and make them look less obtrusive. Any ideas would be greatly appreciated.
07-19-2005, 12:31 AM
One way would be to use piecewise Bezier curves, but beware it will smoothen out the details very much
07-19-2005, 08:07 AM
If you don't want to create a parametric tree at runtime, you should really consider using an external model format like e.g. 3ds or create your own thing. I guess nobody really works with those glut primitves except for training and testing reasons.
If you want to create a paramtetric tree at runtime, well, have fun. You will have to use nurbs / bezier surfaces, subdivision surfaces or something similar, but all of this is quite tricky to handle. One thing for example is managing the texture coordinates at Y branches.
I guess there are some papers around this theme on citeseer ( http://citeseer.ist.psu.edu/ ).
07-19-2005, 08:33 AM
One of our programmers did this for creating the whomping willow for harry potter 3. The tree's branches were basically lots of dynamic curves which were skinned at render-time.
While the solution wasn't perfect, it did the job. The guy first skinned the curves by extruding squares along them. He then projected the end-points of joining branches onto the main branch to find out where to add new vertices to the main branch in order to create a smooth join. The branches were rendered as subdivision surfaces in prman, but you could do a couple of iterations of subdivision yourself to smooth the branches out.
Texture coordinates were a problem, and there's not really a perfect solution for it, especially at junctions. In the end we just used one set of uv's based on the length from the root to the tip, and another repeating set based on world-space distance along the branches. I shaded the branches using mostly procedural noise, blending in a little bit of tiled textures, but I couldn't use the textures very much because the uv's weren't great.
07-21-2005, 07:39 AM
Thank you for all inputs. and yes I am trying to create a tree at runtime for my thesis, which isn't very pleasant to do. I don't know why I bothered with this topic. I will definitely look into bezier for more aesthetic looks. Thanks again guys.
07-21-2005, 07:40 AM
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.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.