Multiple texture UV mappings from 3ds file

Started by kkl, October 09, 2013, 03:20:31 PM

Previous topic - Next topic

kkl

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.

EgonOlsen

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).


kkl

I'm using the codes from Wolf17's post, and it WORKED!

Thanks for the helps ;)

kkl

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? 

EgonOlsen

Quote from: kkl on May 06, 2014, 05:33:53 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.

kkl

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?

EgonOlsen

Quote from: 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?
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.

kkl

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.

EgonOlsen

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.

kkl

I'll try it out adjusting the Thread.sleep() and see if it goes well. Thanks alot for ur help ; )