[osg-users] Strips on AnimatedTexturing on Terrain by GLSL

2008-10-17 Thread Ümit Uzun
Hi All,

I had created animated texturing on terrain with using shaders but I have
already realized some artifacts on the terrain as you see from that
VIDEOhttp://www.fileden.com/files/2007/9/10/1423182/AnimetedTexturing.wmv.
Why have this strips created on the terrain in each loop?
Any advices to get rid of them ?

Note : In vertex shader I only iterate the caustics texture x coordinate by
the way,

causticsCoords = gl_MultiTexCoord0.xy;;
causticsCoords.x = fract( causticsCoords.x + float( timeValue *
causticsSpeed ) );

All of the important pattern about animating texture on terrain is preceeded
dodes.

Best Regards.

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


Re: [osg-users] Strips on AnimatedTexturing on Terrain by GLSL

2008-10-17 Thread David Spilling
Umit,

It's a well known gotcha with texture repeats.

Each vertex has increasing causticsCoord.x. Imagine the vertices with coord
0.0, 0.1, 0.2, 0.3 etc. The fragments in between any of these coords have
_interpolated_ texcoords i.e. a fragment halfway betwen 0.0 and 0.1 vertex
has a texcoord of 0.05.

For the end vertices, you have 0.8,0.9,1.0, 1.1. The fract function turns
this into 0.8, 0.9, 0.0, 0.1

Hence a fragment half way between 0.9 and 1.0 interpolates the texcoord
between 0.9 and 0.0, giving 0.45, not 0.95 as you would want. Between 0.9
and 1.0, then the actual texcoord used decreases rapidly from 0.9 to 0.0.

The artifact you see is all of your caustics texture, mirrored, and shoved
into the last vertex gap.

To get rid if it, try losing the fract instruction. There may also be
dependencies on your texture mode (REPEAT, MIRROR, CLAMP) that you might
need to play with depending on what your texture looks like.

Hope that helps,

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


Re: [osg-users] Strips on AnimatedTexturing on Terrain by GLSL

2008-10-17 Thread Ümit Uzun
Hi David,

I unattached the fract math function and all strips gone away :) I haven't
thought it was a simple bug :)

Thanks so much.
Best regards.

Umit Uzun

2008/10/17 David Spilling [EMAIL PROTECTED]

 Umit,

 It's a well known gotcha with texture repeats.

 Each vertex has increasing causticsCoord.x. Imagine the vertices with coord
 0.0, 0.1, 0.2, 0.3 etc. The fragments in between any of these coords have
 _interpolated_ texcoords i.e. a fragment halfway betwen 0.0 and 0.1 vertex
 has a texcoord of 0.05.

 For the end vertices, you have 0.8,0.9,1.0, 1.1. The fract function turns
 this into 0.8, 0.9, 0.0, 0.1

 Hence a fragment half way between 0.9 and 1.0 interpolates the texcoord
 between 0.9 and 0.0, giving 0.45, not 0.95 as you would want. Between 0.9
 and 1.0, then the actual texcoord used decreases rapidly from 0.9 to 0.0.

 The artifact you see is all of your caustics texture, mirrored, and shoved
 into the last vertex gap.

 To get rid if it, try losing the fract instruction. There may also be
 dependencies on your texture mode (REPEAT, MIRROR, CLAMP) that you might
 need to play with depending on what your texture looks like.

 Hope that helps,

 David


 ___
 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