Re: [osg-users] Stitching together sphere geometry in OpenSceneGraph

2012-03-02 Thread Preet
Thanks, setting the texture's wrap mode to CLAMP_TO_EDGE worked perfectly!


Regards,

Preet

On Thu, Mar 1, 2012 at 10:45 PM, Jean-Sébastien Guay
jean_...@videotron.ca wrote:
 Hello Preet,


 * The issue I've run into involves where my 2D texture wraps around
 and meets itself on the sphere:
 http://i.imgur.com/ftVH2.png


 I don't think there's anything wrong with your geometry and texcoords. Good
 work!

 The problem looks like you may be using the default texture wrap mode, which
 is CLAMP. This mode can also be called clamp to border, which when texture
 coordinates run outside the range of 0-1 will give a border color, which
 defaults to black. The problem is that when the texture coordinates are
 exactly 0 or 1, when you have linear interpolation enabled as filter mode
 (again the default), then the border color will still get sampled (since
 it's trying to filter using that texel and the one next to it, which is
 outside the 0-1 range). So you get those black lines around your textures.

 Try to specify the CLAMP_TO_EDGE wrap mode instead. This will simply sample
 the same texel at the border and should eliminate the black line.

 Hope this helps,

 J-S
 --
 __
 Jean-Sebastien Guay              jean_...@videotron.ca
                    http://whitestar02.dyndns-web.com/
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Stitching together sphere geometry in OpenSceneGraph

2012-03-01 Thread Preet
Hey all,

I'm trying to draw a simple sphere (yes, I know there's a drawable
type available) to learn how to build up simple geometry, by
specifying vertices, normals, texture coordinates and indices. I
eventually want to create a function that will give me vertices for
spheroids that aren't perfect spheres, but follow the same principles.

I've been doing okay so far, and used a spherical coordinate transform
to get cartesian coordinates. I have vertices, normals, texture
coordinates and indices.

* The issue I've run into involves where my 2D texture wraps around
and meets itself on the sphere:
http://i.imgur.com/ftVH2.png

Like shown in the picture, there's a visible seam there. There are
also shadows where multiple identical vertices are present at the
poles. I'd like to know how to get rid of the seam and shadows!

I am manually mapping the texture using the simplest 2d
texture-sphere, shown here:
http://paulbourke.net/texture_colour/texturemap/texture.gif

If I use the bare minimum vertices (no duplicates) to define the
sphere then the seaming and shadows disappear but I'm unable have the
2D texture wrap all the way around, and see extreme warping at the
poles (which makes sense):
http://i.stack.imgur.com/l9baA.png


Regards,

Preet
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Stitching together sphere geometry in OpenSceneGraph

2012-03-01 Thread Jean-Sébastien Guay

Hello Preet,


* The issue I've run into involves where my 2D texture wraps around
and meets itself on the sphere:
http://i.imgur.com/ftVH2.png


I don't think there's anything wrong with your geometry and texcoords. 
Good work!


The problem looks like you may be using the default texture wrap mode, 
which is CLAMP. This mode can also be called clamp to border, which 
when texture coordinates run outside the range of 0-1 will give a border 
color, which defaults to black. The problem is that when the texture 
coordinates are exactly 0 or 1, when you have linear interpolation 
enabled as filter mode (again the default), then the border color will 
still get sampled (since it's trying to filter using that texel and the 
one next to it, which is outside the 0-1 range). So you get those black 
lines around your textures.


Try to specify the CLAMP_TO_EDGE wrap mode instead. This will simply 
sample the same texel at the border and should eliminate the black line.


Hope this helps,

J-S
--
__
Jean-Sebastien Guay  jean_...@videotron.ca
http://whitestar02.dyndns-web.com/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org