Hi Enrico,
Enrico Borrione wrote:
> Hi OpenSG users,
>
> While working on texture coordinates, i came across a problem:
> using cylindrical and spherical textures i can't find a way to
> avoid the singularity problem in the texture wrapping area.
> The only solution i could think about was the vertex splitting
> where the texture starts, so there are a series of vertices with
> texcoord 0, and a copy of them with texcoord 1 overlapping and making
> the texture melt correctly where the singularity lays.
>
> Now I looked at the starting guide where it talks about geometry, indexing,
> and primitives, but I still can't get a very clear idea on how indexing
> works in
> OpenSG.
>
> Right now i am using a FaceIterator to sweep along the scene and spot which
> faces
> cross the singularity area. The next step will be finding the vertices
> crossing it and
> splitting them between the two triangles on the opposite sides.
>
> In pseudo code it would be like:
>
> 1) find the crossing face (done)
> 2) find the crossing vertex (almost done)
> 3) make a copy of the vertex
> 4) change the index in the faceiterator so that it points to the new vertex
> 5) try to make the process easy to invert (since i would like to update
> texture
> coordinates often, i'd like to melt again the vertices before applyng this
> algo again).
>
> Keeping aside the multi indexing for the moment (i'd like to get it straight
> the single indexing first) I don't seem able to find a funcion
> osg::FaceIterator::setPositionIndex that allows me to change on the fly the
> topology of the primitives in the geometry core.
>
> Since the subject is quite difficult to describe in wrote language,
> i'll look forward to exchange some more messages with u on the subject
Carsten covered it pretty well, I don't really have much to add. The iterators
are not designed to be used for changing anything, as they map the internal
structures into something that's not really there. If you use the FaceIterator,
that's pretty close to what is really there, but all the others abstract a lot
away.
Just that I'd be interested in the result if you get it to work, as it is a
non-trivial problem to solve in general (due to the need for triangle-splitting
in case the crossing is inside a triangle). ;) Especially the inversion is
going
to be a challenge.
If you 'only' want to be able to work without splits it's still not totally
trivial, again, the inversion can be tricky. I would probably just ignore the
inversion part and keep a copy of the original data around for that.
Thanks
Dirk
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users