www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: kkl on October 09, 2013, 03:20:31 pm

Title: Multiple texture UV mappings from 3ds file
Post by: kkl on October 09, 2013, 03:20:31 pm
I got a 3ds model made from Blender with multiple textures and different UV mapping for each texture. Does JPCT-AE support multiple UV mappings when loading 3ds file? I tried loading the 3ds model but both textures from the model uses the first texture UV map.
Title: Re: Multiple texture UV mappings from 3ds file
Post by: EgonOlsen on October 09, 2013, 05:07:35 pm
The 3ds format doesn't support multi-texturing and neither does the obj-format. If you want to use multiple uv-coordinates per vertex, you have split the mesh into two (one for each texture layer), load them both and merge them together. This can be done in a preprocessing step. IIRC, there should be some example code for this hidden some where in forum (in the context of loading a quake 3 level).
Title: Re: Multiple texture UV mappings from 3ds file
Post by: Wolf17 on October 09, 2013, 08:05:19 pm
 Hi kkl!
   have a look at this -
http://www.jpct.net/forum2/index.php/topic,3451.msg24812.html#msg24812  (http://www.jpct.net/forum2/index.php/topic,3451.msg24812.html#msg24812)
and this-
http://www.jpct.net/forum2/index.php/topic,1790.msg13191.html#msg13191 (http://www.jpct.net/forum2/index.php/topic,1790.msg13191.html#msg13191)

 See if  that helps. ;)
Title: Re: Multiple texture UV mappings from 3ds file
Post by: kkl on October 10, 2013, 03:37:45 pm
I'm using the codes from Wolf17's post, and it WORKED!

Thanks for the helps ;)
Title: Re: Multiple texture UV mappings from 3ds file
Post by: kkl on May 06, 2014, 05:33:53 pm
Sry to bring this up again. I was wondering if we split the mesh to two and merge them back, does polygon count becomes double for renderingt? Says, a model with 3000 polygons. After combining, it turns to 6000 polygons? Does it affect alot for the rendering performance? 
Title: Re: Multiple texture UV mappings from 3ds file
Post by: EgonOlsen on May 06, 2014, 08:26:02 pm
Says, a model with 3000 polygons. After combining, it turns to 6000 polygons? Does it affect alot for the rendering performance?
No, it doesn't. At least not if you are doing in the way that the thread above describes. It uses the second file only as a holder for the uv coordinates of the second layer.
Title: Re: Multiple texture UV mappings from 3ds file
Post by: kkl on May 07, 2014, 03:18:43 am
I checked again from the code and it has the method addTriangle(). Im guessing it should add polygons to the model? I notice I missed the getMesh().compress(). Was wondering if that would affect it?
Title: Re: Multiple texture UV mappings from 3ds file
Post by: EgonOlsen on May 07, 2014, 07:27:38 am
I checked again from the code and it has the method addTriangle(). Im guessing it should add polygons to the model? I notice I missed the getMesh().compress(). Was wondering if that would affect it?
It creates a new object out of the loaded ones. It takes two polygons, one from each mesh, combines the u/v coordinates to multiple layers and adds them to one new polygon.
Title: Re: Multiple texture UV mappings from 3ds file
Post by: kkl on May 07, 2014, 08:24:30 am
Thanks for the detailed info. It really helps me understanding the whole part of the process. Im actually in the middle of optimizing performance for my app while having >6000 polygons. It turns out slow and takes battery alot. Im finding ways to optimize it by any mean.
Title: Re: Multiple texture UV mappings from 3ds file
Post by: EgonOlsen on May 07, 2014, 08:27:54 am
As long as you render frame after frame without any pause, battery usage won't be affected by object complexity. The only way to reduce it would be add a Thread.sleep(...) here and there, but that will reduce performance.
Title: Re: Multiple texture UV mappings from 3ds file
Post by: kkl on May 08, 2014, 06:07:39 pm
I'll try it out adjusting the Thread.sleep() and see if it goes well. Thanks alot for ur help ; )