Curves

Problems with Canvas, OpenGL, etc...

Curves

Postby Resilient » Sat May 29, 2010 6:38 am

So I am working on trying to get a particular curved shape and am wondering what the best way about doing it is.

What I want is to model a flower blowing in the wind. So as it gets windy the stem will bend more.

As is, I have it modeled as a series of rectangular segments joined by springy joints. It approximates the curve very well. The problem is, when it's really windy the structure of the curve becomes very apparent in the sharp bends. You can essentially see the corners of the rectangles sticking out and the textures stop matching up.

So, I have 50 points easily available that approximate this curve, what is the best way basically draw a line along those points that I can texture with my stem texture?

Thanks!
Resilient
Junior Developer
Junior Developer
 
Posts: 15
Joined: Tue May 18, 2010 1:33 am

Top

Re: Curves

Postby seed » Tue Jun 01, 2010 6:26 pm

Resilient wrote:So I am working on trying to get a particular curved shape and am wondering what the best way about doing it is.

What I want is to model a flower blowing in the wind. So as it gets windy the stem will bend more.

As is, I have it modeled as a series of rectangular segments joined by springy joints. It approximates the curve very well. The problem is, when it's really windy the structure of the curve becomes very apparent in the sharp bends. You can essentially see the corners of the rectangles sticking out and the textures stop matching up.

So, I have 50 points easily available that approximate this curve, what is the best way basically draw a line along those points that I can texture with my stem texture?

Thanks!


I would think that you would want to segment your stem vertically but have each segment share some vertices with the one above and the one below (or at lease have vertices with the same values). Each frame you could reset your vertices based on a spline or some similar mathimatical construct.

Then, the best way to make it look good would be to use SMOOTH shading and make sure the normals of each vertex are created by averaging the normals of the all the trinagles that share that vertex.
Visit Exit 4 Gaming - http://www.exit4games.com/
Home of LavaBall - http://exit4games.com/?page_id=3
Home of Rebound - http://exit4games.com/?page_id=138
Home of Tap Crazy - http://exit4games.com/?page_id=219
Download "Caveman Pool" From the Market Today!
seed
Senior Developer
Senior Developer
 
Posts: 103
Joined: Mon Mar 15, 2010 3:22 pm

Re: Curves

Postby Resilient » Tue Jun 01, 2010 9:34 pm

So if I am using VBO's will I still see a performance gain from them if I have to reload the vertexes every frame? This all ends up being 2d so if I lose the beinnifts of VBO's I may just end up using the standard surface instead of OpenGL because the performance is fairly comparable.
Resilient
Junior Developer
Junior Developer
 
Posts: 15
Joined: Tue May 18, 2010 1:33 am

Re: Curves

Postby seed » Wed Jun 02, 2010 4:43 pm

Resilient wrote:So if I am using VBO's will I still see a performance gain from them if I have to reload the vertexes every frame? This all ends up being 2d so if I lose the beinnifts of VBO's I may just end up using the standard surface instead of OpenGL because the performance is fairly comparable.


Updating vertices dynamically is pretty slow no matter what. I had to do this for my game, attempting to create a wave effect in my Lava, and it worked OK if all I was rendering was the lava. But, when I added the rest of the stuff, dynamically creating the veritices was a killer. Instead, I actually pre-render each frame of my lava in an animation with a buffer for each frame of the animation. I then just point at the right frame of animation each redering cycle. Not sure how much this helps you, but if you are creative, I bet you can find a way to do it fast in GL.

regards
Visit Exit 4 Gaming - http://www.exit4games.com/
Home of LavaBall - http://exit4games.com/?page_id=3
Home of Rebound - http://exit4games.com/?page_id=138
Home of Tap Crazy - http://exit4games.com/?page_id=219
Download "Caveman Pool" From the Market Today!
seed
Senior Developer
Senior Developer
 
Posts: 103
Joined: Mon Mar 15, 2010 3:22 pm

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 2 guests