[Bf-committers] Blender tangent space calculation

Eugene Minov minov.eug at gmail.com
Sun Nov 20 00:24:16 CET 2011


>
> >If you want to use the indexed result within a Blender context
> >you'd have to put a dummy vertex at the beginning of the vertex array
such
> >that all other vertices are offset by one entry and then you'd add all
the
> >welder-generated indices by +1 to offset to after the dummy vertex.
>

Yes you're right! My first thought was to fix this in the same way.
Seems that I just wanted to find a way to not allocate an extra dummy
vertex :)

Actually I doing this, I put a dummy vertex at the beginning and then do +1
to the
indices.
But only if I cannot find another appropriate vertex within other unique
vertices in the array, on which didn't point any fourth index from any face.
There's almost always must be that vertex.

Then if I find this vertex I swap it with a vertex at the begining.
Then I loop all my indexes and change indexes that
point to fonded vertex, to '0', and otherwise, those indexes that
point to '0', i change to index of founded vertex.

I've tested this on a diferent meshes, wached results and I pretty sure
that it must work correct, but now I think that maybe it'd be better and
easier
to put an extra vertex only :)


On Sat, Nov 19, 2011 at 11:36 PM, Morten Mikkelsen <mikkelsen7 at gmail.com>wrote:

>  >If you want to use the indexed result within a Blender context you'd have
> to put a dummy vertex at the beginning of the vertex array >such that all
> other vertices are offset by one entry
>
> I mean put a dummy vertex in front of the unique vertices of course
> (meaning after welding). And also +1 to the indices you get after welding.
>
>
>
> On Sat, Nov 19, 2011 at 12:35 PM, Morten Mikkelsen <mikkelsen7 at gmail.com
> >wrote:
>
> > I am not 100% sure I understand you correctly but your fix doesn't sound
> > correct but perhaps
> > I am misunderstanding you. Anyway, the welder is going to generate a zero
> > based index list unlike what is used within
> > Blender. If you want to use the indexed result within a Blender context
> > you'd have to put a dummy vertex at the beginning of the vertex array
> such
> > that all other vertices are offset by one entry and then you'd add all
> the
> > welder-generated indices by +1 to offset to after the dummy vertex. This
> > way triangles can still have their fourth index as 0 which points to the
> > dummy vertex and within Blender means no vertex assigned.
> >
> >
> >
> >
> > On Sat, Nov 19, 2011 at 9:27 AM, Eugene Minov <minov.eug at gmail.com>
> wrote:
> >
> >> >
> >> > >Correct, this is how blender does it everywhere in its code-base.
> >> >
> >>
> >> Ok.
> >> I've asked because after weldind I've gotten this problem with some
> quads.
> >> But today seems that I solve it by swapping the first vertex in the vert
> >> array with
> >> the first finded vertex that is not indexed to any of the 4'th face's
> >> index.
> >>
> >> On Sat, Nov 19, 2011 at 1:13 AM, Morten Mikkelsen <mikkelsen7 at gmail.com
> >> >wrote:
> >>
> >> > >
> >> > > I wanted to ask about this line:
> >> > > const int iGetNrVerts= data->mface[face_num].v4!=0 ? 4 : 3;
> >> > >
> >> > > Or there is no way that last index points to zero?
> >> > >
> >> >
> >> > Correct, this is how blender does it everywhere in its code-base.
> >> > Super glad to hear you're getting useful results! Be sure to submit a
> >> patch
> >> > for review.
> >> > _______________________________________________
> >> > Bf-committers mailing list
> >> > Bf-committers at blender.org
> >> > http://lists.blender.org/mailman/listinfo/bf-committers
> >> >
> >> _______________________________________________
> >> Bf-committers mailing list
> >> Bf-committers at blender.org
> >> http://lists.blender.org/mailman/listinfo/bf-committers
> >>
> >
> >
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list