www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: kkl on October 18, 2013, 06:06:10 pm

Title: Tiling in texture atlas
Post by: kkl on October 18, 2013, 06:06:10 pm
Hi egon, does JPCT-AE support texture atlas, in API level? Im trying it in Blender, but it seems a lot harder, especially tiling in texture atlas (some suggested to edit uv map by hand till all faces are repeating accordingly, which i think it would take ages to do it). If not supported, do I do it in shader, or some uv trick in Blender? Wish to listen to your advice.
Title: Re: Tiling in texture atlas
Post by: EgonOlsen on October 18, 2013, 08:35:46 pm
No, it doesn't. It just uses the uv-coordinates from the file. You can of course change them in code after loading the model, but i'm not sure if that helps here. Then again, i've no idea what your actually want to do. Can explain the problem in a little more detail?
Title: Re: Tiling in texture atlas
Post by: kkl on October 19, 2013, 04:44:51 am
For example, an object uses a part of texture from texture atlas, and the object must has repeating texture (aka tile texture, eg floor). One of the ways to make repeating texture is by making the uv coordinate larger than the image and it would repeat the texture automatically, in Blender. However, it does not apply when the image is a texture atlas.

The first image is single texture. The texture is repeating by making uv coordinates bigger than image.
The second image is texture atlas, which the first part of texture cannot be repeated as there are other textures on the same image.
(Made by Blender)

[attachment deleted by admin]
Title: Re: Tiling in texture atlas
Post by: EgonOlsen on October 19, 2013, 11:23:16 am
Ok,

There are several solutions that come to my mind:

Title: Re: Tiling in texture atlas
Post by: kkl on October 19, 2013, 12:57:31 pm
Hi Egon,

1. There are few reasons I need texture atlas. JPCT engine is certainly doing well in texture changes (by reusing the texture if the previous texture used is the same with the current one, i believe), but i heard alot that glBindTexture slows down the performance if app has tons of different texture. For image content privacy and management, it's easier to pack everything in one big image as well.

2. I'm not sure what "out of the box" means, but i'm guessing it has something to do with packing all uv coordinates into an image by hand to make it looks like repeating texture (my last resolve, though abit tedious).

3. Seems like a good idea. What if a polygon's uv is located between inside and outside of image?

4. Yea. I totally agree with you. I tried messing around with shader and it costs performance ALOT.
Title: Re: Tiling in texture atlas
Post by: EgonOlsen on October 20, 2013, 07:29:18 pm
1. There are few reasons I need texture atlas. JPCT engine is certainly doing well in texture changes (by reusing the texture if the previous texture used is the same with the current one, i believe), but i heard alot that glBindTexture slows down the performance if app has tons of different texture. For image content privacy and management, it's easier to pack everything in one big image as well.
As said, i wouldn't go crazy about the perfomance. Whatever you do, consider that you'll lose flexibility with a texture atlas. Changing a texture is possible, but more hassle than it would be with distinct textures and increasing or decreasing a texture's resolution just isn't possible without affecting all textures or reworking the complete atlas.

2. I'm not sure what "out of the box" means, but i'm guessing it has something to do with packing all uv coordinates into an image by hand to make it looks like repeating texture (my last resolve, though abit tedious).
What i meant with that was to apply the proper u/v-coordinates in the modeller. Don't ask me how, i've no clue about this...

3. Seems like a good idea. What if a polygon's uv is located between inside and outside of image?
Just transform it back into the range that you have for that particular texture. This won't work well for none rectangular tiles though.
Title: Re: Tiling in texture atlas
Post by: kkl on October 21, 2013, 06:36:16 pm
Quote
As said, i wouldn't go crazy about the perfomance. Whatever you do, consider that you'll lose flexibility with a texture atlas. Changing a texture is possible, but more hassle than it would be with distinct textures and increasing or decreasing a texture's resolution just isn't possible without affecting all textures or reworking the complete atlas.
I thought of that too. In fact, I am struggling in adjusting resolution in texture atlas. It has been a big headache. 

Quote
Just transform it back into the range that you have for that particular texture. This won't work well for none rectangular tiles though.
Ahh.. The uv coordinates are non-rectangular. Guess this method doesn't work.

BTW, thanks for the advice. Really appreciate it ; )