Author Topic: Texture wrapping problem  (Read 459 times)

Offline ap

  • byte
  • *
  • Posts: 12
    • View Profile
Texture wrapping problem
« on: March 23, 2015, 08:58:39 am »
Hello

I'm generating a 3D object of a trail, manually generated from vertices and triangles (using the Object3D constructor using vertices array, indices array and uvs array).

The trail is something like a "thick" line (each segment is constructed from two triangles).
I'm trying to map a texture along the trail by something like this:

uvs[iv++] = tot_dist;    // u plus (right)
uvs[iv++] = 0;      // v plus (right)
uvs[iv++] = tot_dist;    // u minus (left)
uvs[iv++] = 1;      // v minus (left)

for each two points of a segment, where tot_dist is the total distance of the trail up to that point.

I am getting a weird result, where at the beginning of the trail, the texture looks great, and as I "walk" through the trail, the texture starts looking "noisy" and VERY "pixelated".
I tried variations of mipmap and filtering - on and off, with no help.

Any guess what might be the problem?

Thanks
AP

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Texture wrapping problem
« Reply #1 on: March 23, 2015, 09:59:32 am »
That's caused by inaccuracies in mobile GPUs. The effect varies from awful (NVidia Tegra 3) over "a little better" (Mali) to almost perfect (Adreno). There's nothing you can do about it except for not doing it this way...

Offline ap

  • byte
  • *
  • Posts: 12
    • View Profile
Re: Texture wrapping problem
« Reply #2 on: March 23, 2015, 11:06:34 am »
Thanks for your answer.
Any suggestions of other ways for doing something like that? (other than breaking the trail to many objects with "less" wrapping of textures...)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Texture wrapping problem
« Reply #3 on: March 23, 2015, 11:10:30 am »
I used to do something similar in Alien Runner. I used two objects which wrapped. Once the first object wasn't visible anymore, i moved it back to the top of the road.