Author Topic: Multiple texture UV mappings from 3ds file  (Read 4069 times)

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Multiple texture UV mappings from 3ds file
« 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Multiple texture UV mappings from 3ds file
« Reply #1 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).

Offline Wolf17

  • int
  • **
  • Posts: 77
    • View Profile

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: Multiple texture UV mappings from 3ds file
« Reply #3 on: October 10, 2013, 03:37:45 pm »
I'm using the codes from Wolf17's post, and it WORKED!

Thanks for the helps ;)

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: Multiple texture UV mappings from 3ds file
« Reply #4 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? 

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Multiple texture UV mappings from 3ds file
« Reply #5 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.

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: Multiple texture UV mappings from 3ds file
« Reply #6 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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Multiple texture UV mappings from 3ds file
« Reply #7 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.

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: Multiple texture UV mappings from 3ds file
« Reply #8 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Multiple texture UV mappings from 3ds file
« Reply #9 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.

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: Multiple texture UV mappings from 3ds file
« Reply #10 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 ; )