Well said Kostya.

Pedro - I defined the formula to get your normal above.  A normal is a
unit vector (a 3D vector of length 1.)  Each vertex must have a normal
for proper shading, as that's how light is calculated.  The normal of
a vertex of a sphere is a easy to calculate.  Think of it as the
direction from the center of the sphere through the vertex.  That's
your vector.  I provided a formula, though you'll have to javafy it a
little to make that work for you.  If you're struggling to understand
this, I suggest reading some 3D primer books before moving on.  They
are very, very helpful.

Cheers

On Dec 27, 7:59 am, Kostya Vasilyev <kmans...@gmail.com> wrote:
> Pedro,
>
> A normal is a unit vector (length == 1) that is perpendicular to the
> surface. Normals are used for shading, so don't worry about them too
> much for now.
>
> Texture coordinates, as was already pointed out here, are in 2D space,
> i.e. two coordinates. The reason is that textures are 2-dimensional, and
> texture coordinates specify which point within the texture should be
> mapped to a particular vertex in 3D space.
>
> Imagine that the texture is a stretchable, initially square, piece of
> fabric. Each UV coordinate represents a point within that square.
>
> For each vertex, the point within the texture specified for that vertex
> by UV coordinates is "glued" to the vertex. Then the texture is allowed
> to stretch between vertexes.
>
> What sort of texture coordinates you generate is entirely up to you.
>
> A simple way to texture map a sphere is to wrap the texture into a
> vertical cylinder around the sphere, then pull the top and bottom
> towards the sphere, so you have singularities at the top and bottom of
> the sphere.
>
> If you generate your sphere as a bunch of horizontal bands, each having
> equal angular size, and further subdivided around into equal patches,
> then you can your use loop variables (band / patch index) to compute UV
> coordinates. Just remember that UV are 0 to 1 (unless you want tiling).
>
> -- Kostya
>
> 27.12.2010 18:35, pedr0 пишет:
>
>
>
>
>
>
>
>
>
> > But normal.x what is it?
>
> > Is the abs(x) ?
>
> > On 23 Dic, 20:41, Robert Green<rbgrn....@gmail.com>  wrote:
> >> UV unwrapping/mapping is standard practice in 3d games.  It's how the
> >> artist lines up the textures onto the skin/model.
>
> >> You're doing UV coordinate generation, which is similar but is
> >> mathematically specified instead of placed by a 3D modeling
> >> application.
>
> >> On Dec 23, 12:37 am, pedr0<pulsarpie...@gmail.com>  wrote:
>
> >>> What do you think about it?
> >>>http://en.wikipedia.org/wiki/UV_mapping
> >>> On 23 Dic, 09:19, pedr0<pulsarpie...@gmail.com>  wrote:
> >>>> Thanks a lot,
> >>>> especially at Robert Green for his very good explanation!
> >>>> The absurd thing is that the code which I posted above is 100% right
> >>>> in a iPhone iOS, but when I port the same code on the Android platform
> >>>> I have these issues.
> >>>> I will try to do what you are talking about normals and I let you know
> >>>> about my progress!
> >>>> Thanks again.
> >>>> pedr0
> >>>> On 23 Dic, 04:10, Mario Zechner<badlogicga...@gmail.com>  wrote:
> >>>>> On 22 Dez., 20:42, Robert Green<rbgrn....@gmail.com>  wrote:
> >>>>>> 3DVec normal = (sphereCenter - point).normalize();
> >>>>> 3DVec normal = (point - sphereCenter).normalize();
> >>>>> Or your world will be upside down. Unless my brain is totally
> >>>>> borked :) (could well be, 4am here...)
>
> --
> Kostya Vasilyev -- WiFi Manager + pretty widget 
> --http://kmansoft.wordpress.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to