coudl someone show me an example please. Like who one is supposed to create a curved surface. I chose x control points, but how do I control the curve?
coudl someone show me an example please. Like who one is supposed to create a curved surface. I chose x control points, but how do I control the curve?
you need to calculate n intermediate points using your x control points and generate a line (for 2D) or a mesh (for 3D). NeHe has a bezier example. There are a few different ways to do the calculation, the most popular seems to be the using the bernstein polynomial, but there are alternative approches.
I found this link helpful as well.
Is there a way to choose control points if you know the curve and it's equation, but want to play with it a bit.
All examples and articles speak of using the control points, but none really address how to arbitrarily choose them.
thanks
Last edited by just2peachy; 12-16-2004 at 08:56 AM.
Here's the formula for a bezier surface with m*n control points called P.
(u,v) are the surface parameters and they should be in the interval [0,1].
Calculate as many points as you wish and then connect them with triangles.
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
OK, the image didn't turn out that well when I saved it as gif.
To use lightning on your surface you need to calculate normals
to the surface. For this, to need to be able to derive the surface. Here's the formula for d/du and d/dv looks very similar.
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
Hmm, I forgot the definition of B(u).
This is called a Berstein polynomial and is defined as following:
BTW, my suggestion is that you learn Bezier curves before starting to work with surfaces. If you need any matlab code I posted some here a while ago.
Last edited by Sang-drax; 12-16-2004 at 10:15 AM.
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
thanks I'll check it when I get home
One thing about that site: It suggests using cross-product to obtain the surface normals:Originally Posted by just2peachy
I haven't studied multi-variable calculus yet, so someone please correct me if I'm wrong, but isn'tOriginally Posted by gamedev.net
grad f + (0,0,-1) a normal to the plane z = f(x,y)?
Could there be some similar way to calculate normals to the bezier surface without cross product?
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
I'm not sure what the role of + (0,0,1) does. Could you explain what you mean by that?
I think there are conditions to your proposal.
Here's what MathWorld states:
If grad f is nonzero, then the gradient is perpendicular to the level curve through (Xo,Yo) if z=f(x,y) and perpendicular to the level surface through (Xo,Yo,Zo) if F(x,y,z)= 0.
Consider the surface z = f(x,y).
Create a new function g(x,y,z) = f(x,y) - z. Then our surface is equivalent to g(x,y,z)=0.
But g(x,y,z)=0 is a level surface, so grad(g) must be perpendicular to the surface.
grad g = (dg/dx , dg/y , dg/dz ) = (df/dx , df/dy , -1) = grad f - (0,0,1)
Hmm, the plus sign should've been a minus sign.
Last edited by Sang-drax; 12-23-2004 at 02:11 AM.
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling