Author Topic: How to add more texture maps to obj  (Read 14018 times)

Offline a8451727

  • byte
  • *
  • Posts: 11
    • View Profile
How to add more texture maps to obj
« on: June 04, 2022, 01:24:53 pm »
At present, I only know how to add 1 texture map to an object
But the exported obj has many texture maps

Code: [Select]
#
## Alias OBJ Material File
# Exported from SketchUp, (c) 2000-2012 Trimble Navigation Limited

newmtl FrontColor
Ka 0.000000 0.000000 0.000000
Kd 1.000000 1.000000 1.000000
Ks 0.330000 0.330000 0.330000

newmtl Color_E04
Ka 0.000000 0.000000 0.000000
Kd 1.000000 1.000000 0.600000
Ks 0.330000 0.330000 0.330000

newmtl Color_E03
Ka 0.000000 0.000000 0.000000
Kd 1.000000 1.000000 0.396078
Ks 0.330000 0.330000 0.330000

newmtl Color_007
Ka 0.000000 0.000000 0.000000
Kd 0.227451 0.227451 0.227451
Ks 0.330000 0.330000 0.330000

newmtl Carpet_Loop_Pattern
Ka 0.000000 0.000000 0.000000
Kd 0.650980 0.541176 0.349020
Ks 0.330000 0.330000 0.330000
map_Kd changjing2/Carpet_Loop_Pattern.jpg

newmtl _Wood__Floor_2
Ka 0.000000 0.000000 0.000000
Kd 0.607843 0.411765 0.239216
Ks 0.330000 0.330000 0.330000
map_Kd changjing2/_Wood__Floor_2.jpg

newmtl Stone_Pavers_Flagstone_Gray
Ka 0.000000 0.000000 0.000000
Kd 0.635294 0.635294 0.635294
Ks 0.330000 0.330000 0.330000
map_Kd changjing2/Stone_Pavers_Flagstone_Gray.jpg

newmtl Wood__Floor
Ka 0.000000 0.000000 0.000000
Kd 0.607843 0.411765 0.239216
Ks 0.330000 0.330000 0.330000
map_Kd changjing2/Wood__Floor.jpg

newmtl Stone_Coursed_Rough
Ka 0.000000 0.000000 0.000000
Kd 0.647059 0.627451 0.509804
Ks 0.330000 0.330000 0.330000
map_Kd changjing2/Stone_Coursed_Rough.jpg

newmtl Groundcover_RiverRock_4inch
Ka 0.000000 0.000000 0.000000
Kd 0.529412 0.447059 0.243137
Ks 0.330000 0.330000 0.330000
map_Kd changjing2/Groundcover_RiverRock_4inch.jpg

newmtl _Vegetation_Blur7_1
Ka 0.000000 0.000000 0.000000
Kd 0.325490 0.447059 0.070588
Ks 0.330000 0.330000 0.330000
map_Kd changjing2/_Vegetation_Blur7_1.jpg

newmtl Vegetation_Grass_Artificial
Ka 0.000000 0.000000 0.000000
Kd 0.466667 0.666667 0.352941
Ks 0.330000 0.330000 0.330000
map_Kd changjing2/Vegetation_Grass_Artificial.jpg

newmtl Vegetation_Blur7
Ka 0.000000 0.000000 0.000000
Kd 0.384314 0.529412 0.082353
Ks 0.330000 0.330000 0.330000
map_Kd changjing2/Vegetation_Blur7.jpg

newmtl _Wood__Floor_1
Ka 0.000000 0.000000 0.000000
Kd 0.607843 0.411765 0.239216
Ks 0.330000 0.330000 0.330000
map_Kd changjing2/_Wood__Floor_1.jpg

newmtl Groundcover_Sand_Smooth
Ka 0.000000 0.000000 0.000000
Kd 0.713725 0.580392 0.396078
Ks 0.330000 0.330000 0.330000
map_Kd changjing2/Groundcover_Sand_Smooth.jpg

newmtl _Vegetation_Blur7_3
Ka 0.000000 0.000000 0.000000
Kd 0.278431 0.447059 0.043137
Ks 0.330000 0.330000 0.330000
map_Kd changjing2/_Vegetation_Blur7_3.jpg

newmtl Groundcover_Gravel_1inch
Ka 0.000000 0.000000 0.000000
Kd 0.827451 0.796078 0.635294
Ks 0.330000 0.330000 0.330000
map_Kd changjing2/Groundcover_Gravel_1inch.jpg

newmtl _Vegetation_Juniper2_2
Ka 0.000000 0.000000 0.000000
Kd 0.352941 0.501961 0.254902
Ks 0.330000 0.330000 0.330000
map_Kd changjing2/_Vegetation_Juniper2_2.jpg
« Last Edit: June 07, 2022, 05:01:13 pm by EgonOlsen »

Offline a8451727

  • byte
  • *
  • Posts: 11
    • View Profile
Re: How to add more texture maps to obj
« Reply #1 on: June 04, 2022, 04:00:35 pm »
This is part of my code

Code: [Select]
                world=new World();
                TextureManager tm=TextureManager.getInstance();
                try {
                    Texture _Vegetation_Blur7_1 = new Texture(getAssets().open(
                            "changjing2/_Vegetation_Blur7_1.jpg"));
                    Texture _Vegetation_Blur7_3 = new Texture(getAssets().open(
                            "changjing2/_Vegetation_Blur7_3.jpg"));
                    Texture _Vegetation_Juniper2_2 = new Texture(getAssets().open(
                            "changjing2/_Vegetation_Juniper2_2.jpg"));
                    Texture _Wood__Floor_1 = new Texture(getAssets().open(
                            "changjing2/_Wood__Floor_1.jpg"));
                    Texture _Wood__Floor_2 = new Texture(getAssets().open(
                            "changjing2/_Wood__Floor_2.jpg"));
                    Texture Carpet_Loop_Pattern = new Texture(getAssets().open(
                            "changjing2/Carpet_Loop_Pattern.jpg"));
                    Texture Groundcover_Gravel_1inch = new Texture(getAssets().open(
                            "changjing2/Groundcover_Gravel_1inch.jpg"));
                    Texture Groundcover_RiverRock_4inch = new Texture(getAssets().open(
                            "changjing2/Groundcover_RiverRock_4inch.jpg"));
                    Texture Groundcover_Sand_Smooth = new Texture(getAssets().open(
                            "changjing2/Groundcover_Sand_Smooth.jpg"));
                    Texture Stone_Coursed_Rough = new Texture(getAssets().open(
                            "changjing2/Stone_Coursed_Rough.jpg"));
                    Texture Stone_Pavers_Flagstone_Gray = new Texture(getAssets().open(
                            "changjing2/Stone_Pavers_Flagstone_Gray.jpg"));
                    Texture Vegetation_Blur7 = new Texture(getAssets().open(
                            "changjing2/Vegetation_Blur7.jpg"));
                    Texture Vegetation_Grass_Artificial = new Texture(getAssets().open(
                            "changjing2/Vegetation_Grass_Artificial.jpg"));
                    Texture Wood__Floor = new Texture(getAssets().open(
                            "changjing2/Wood__Floor.jpg"));


                    tm.addTexture("_Vegetation_Blur7_1",_Vegetation_Blur7_1);
                    tm.addTexture("_Vegetation_Blur7_3",_Vegetation_Blur7_3);
                    tm.addTexture("_Vegetation_Juniper2_2",_Vegetation_Juniper2_2);
                    tm.addTexture("_Wood__Floor_1",_Wood__Floor_1);
                    tm.addTexture("_Wood__Floor_2",_Wood__Floor_2);
                    tm.addTexture("Carpet_Loop_Pattern",Carpet_Loop_Pattern);
                    tm.addTexture("Groundcover_Gravel_1inch",Groundcover_Gravel_1inch);
                    tm.addTexture("Groundcover_RiverRock_4inch",Groundcover_RiverRock_4inch);
                    tm.addTexture("Groundcover_Sand_Smooth",Groundcover_Sand_Smooth);
                    tm.addTexture("Stone_Coursed_Rough",Stone_Coursed_Rough);
                    tm.addTexture("Stone_Pavers_Flagstone_Gray",Stone_Pavers_Flagstone_Gray);
                    tm.addTexture("Vegetation_Blur7",Vegetation_Blur7);
                    tm.addTexture("Vegetation_Grass_Artificial",Vegetation_Grass_Artificial);
                    tm.addTexture("Wood__Floor",Wood__Floor);

                    plane =  Object3D.mergeAll(Loader.loadOBJ(
                            getAssets().open("plane.obj"),
                            getAssets().open("plane.mtl"),
                            0.15f));


                       //??????????????????
//                    plane.setTexture("_Vegetation_Blur7_1");
//                    plane.setTexture("_Vegetation_Blur7_3");
//                    plane.setTexture("_Vegetation_Juniper2_2");
//                    plane.setTexture("_Wood__Floor_1");
//                    plane.setTexture("_Wood__Floor_2");
//                    plane.setTexture("Carpet_Loop_Pattern");
//                    plane.setTexture("Groundcover_Gravel_1inch");
//                    plane.setTexture("Groundcover_Gravel_1inch");
//                    plane.setTexture("Groundcover_RiverRock_4inch");
//                    plane.setTexture("Groundcover_Sand_Smooth");
//                    plane.setTexture("Stone_Coursed_Rough");
//                    plane.setTexture("Stone_Pavers_Flagstone_Gray");
//                    plane.setTexture("Vegetation_Blur7");
//                    plane.setTexture("Vegetation_Grass_Artificial");
//                    plane.setTexture("Wood__Floor");


                } catch (IOException e) {
                    e.printStackTrace();
                }

« Last Edit: June 07, 2022, 05:00:58 pm by EgonOlsen »

Offline AeroShark333

  • float
  • ****
  • Posts: 320
    • View Profile
Re: How to add more texture maps to obj
« Reply #2 on: June 04, 2022, 04:36:14 pm »
I believe the general logic should be:
- Load textures with full names
- Load model file
- Load MTL file
- Load 3D object using model and MTL files

If used properly then Object3D#setTexture(...) is not necessary
The model loader will find the texture names that are specified in the MTL file. But these names should be properly set in the texture manager.

Instead of this:
tm.addTexture("_Vegetation_Blur7_1",_Vegetation_Blur7_1);

Try one of these:
tm.addTexture("changjing2/_Vegetation_Blur7_1.jpg",_Vegetation_Blur7_1);

Or:
tm.addTexture("changjing2/_Vegetation_Blur7_1",_Vegetation_Blur7_1);

Offline a8451727

  • byte
  • *
  • Posts: 11
    • View Profile
Re: How to add more texture maps to obj
« Reply #3 on: June 04, 2022, 05:27:26 pm »
I believe the general logic should be:
- Load textures with full names
- Load model file
- Load MTL file
- Load 3D object using model and MTL files

If used properly then Object3D#setTexture(...) is not necessary
The model loader will find the texture names that are specified in the MTL file. But these names should be properly set in the texture manager.

Instead of this:
tm.addTexture("_Vegetation_Blur7_1",_Vegetation_Blur7_1);

Try one of these:
tm.addTexture("changjing2/_Vegetation_Blur7_1.jpg",_Vegetation_Blur7_1);

Or:
tm.addTexture("changjing2/_Vegetation_Blur7_1",_Vegetation_Blur7_1);

Hello, aeroshark333

Thank you for your help, but I tried it. It didn't solve the problem

I found that it can only recognize one texture map, which is the first one in the MTL file

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12298
    • View Profile
    • http://www.jpct.net
Re: How to add more texture maps to obj
« Reply #4 on: June 04, 2022, 05:40:26 pm »
It should work that way. Have a look at the log output when loading the file. You should get log messages if a texture name can't be found and you should be able to see what exactly these names are.

Offline a8451727

  • byte
  • *
  • Posts: 11
    • View Profile
Re: How to add more texture maps to obj
« Reply #5 on: June 04, 2022, 06:15:34 pm »
It should work that way. Have a look at the log output when loading the file. You should get log messages if a texture name can't be found and you should be able to see what exactly these names are.

I am a beginner. I don't know why I failed. Here is the log
Thank you for maintaining jpct for more than 10 years, very cool!

Code: [Select]
I/jPCT-AE: Loading Texture...
I/jPCT-AE: Texture loaded...262144 bytes/256*256 pixels!
I/jPCT-AE: Loading Texture...
I/jPCT-AE: Texture loaded...262144 bytes/256*256 pixels!
I/jPCT-AE: Loading Texture...
I/jPCT-AE: Texture loaded...262144 bytes/256*256 pixels!
I/jPCT-AE: Loading Texture...
I/jPCT-AE: Texture loaded...262144 bytes/256*256 pixels!
I/jPCT-AE: Loading Texture...
I/jPCT-AE: Texture loaded...262144 bytes/256*256 pixels!
I/jPCT-AE: Loading Texture...
I/jPCT-AE: Texture loaded...262144 bytes/256*256 pixels!
I/jPCT-AE: Loading Texture...
I/jPCT-AE: Texture loaded...262144 bytes/256*256 pixels!
I/jPCT-AE: Loading Texture...
I/jPCT-AE: Texture loaded...262144 bytes/256*256 pixels!
I/jPCT-AE: Loading Texture...
I/jPCT-AE: Texture loaded...262144 bytes/256*256 pixels!
I/jPCT-AE: Loading Texture...
I/jPCT-AE: Texture loaded...262144 bytes/256*256 pixels!
I/jPCT-AE: Loading Texture...
I/jPCT-AE: Texture loaded...262144 bytes/256*256 pixels!
I/jPCT-AE: Loading Texture...
I/jPCT-AE: Texture loaded...262144 bytes/256*256 pixels!
I/jPCT-AE: Loading Texture...
I/jPCT-AE: Texture loaded...262144 bytes/256*256 pixels!
I/jPCT-AE: Loading Texture...
I/jPCT-AE: Texture loaded...262144 bytes/256*256 pixels!
I/jPCT-AE: Loading file from InputStream
I/jPCT-AE: Text file from InputStream loaded...2908 bytes
I/jPCT-AE: Processing new material FrontColor!
I/jPCT-AE: Processing new material Color_E04!
I/jPCT-AE: Processing new material Color_E03!
I/jPCT-AE: Processing new material Color_007!
I/jPCT-AE: Processing new material Carpet_Loop_Pattern!
I/jPCT-AE: Processing new material _Wood__Floor_2!
I/jPCT-AE: Processing new material Stone_Pavers_Flagstone_Gray!
I/jPCT-AE: Processing new material Wood__Floor!
I/jPCT-AE: Processing new material Stone_Coursed_Rough!
I/jPCT-AE: Processing new material Groundcover_RiverRock_4inch!
I/jPCT-AE: Processing new material _Vegetation_Blur7_1!
I/jPCT-AE: Processing new material Vegetation_Grass_Artificial!
I/jPCT-AE: Processing new material Vegetation_Blur7!
I/jPCT-AE: Processing new material _Wood__Floor_1!
I/jPCT-AE: Processing new material Groundcover_Sand_Smooth!
I/jPCT-AE: Processing new material _Vegetation_Blur7_3!
I/jPCT-AE: Processing new material Groundcover_Gravel_1inch!
I/jPCT-AE: Processing new material _Vegetation_Juniper2_2!
I/jPCT-AE: Loading file from InputStream
I/jPCT-AE: Text file from InputStream loaded...1223894 bytes
I/jPCT-AE: Processing object from OBJ-file: Mesh1 Golf_Flag1 Model
I/jPCT-AE: Object 'Mesh1 Golf_Flag1 Model_jPCT0' created using 860 polygons and 441 vertices.
I/jPCT-AE: Processing object from OBJ-file: Mesh2 Model
I/jPCT-AE: Object 'Mesh2 Model_jPCT1' created using 8712 polygons and 5366 vertices.
I/jPCT-AE: [ 1654358539719 ] - WARNING: This OBJ-file contains n-polygons with n>4! These polygons wont be displayed correctly!
I/jPCT-AE: Normal vectors calculated in 24ms!
I/jPCT-AE: Adding Lightsource: 0
I/jPCT-AE: Memory usage before compacting: 16958 KB used out of 16958 KB. Max. memory available to the VM is 262144 KB.
I/jPCT-AE: Memory usage after compacting: 7394 KB used out of 19618 KB. Max. memory available to the VM is 262144 KB.
I/jPCT-AE: Saving master Activity!
I/jPCT-AE: OpenGL vendor:     Qualcomm
I/jPCT-AE: OpenGL renderer:   Adreno (TM) 660
I/jPCT-AE: OpenGL version:    OpenGL ES-CM 1.1
I/jPCT-AE: OpenGL renderer initialized (using 2 texture stages)
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 579/195 vertices in 3ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 48/32 vertices in 0ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 27/14 vertices in 0ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 3384/773 vertices in 18ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 516/172 vertices in 1ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 21/14 vertices in 0ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 2481/790 vertices in 3ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 60/24 vertices in 0ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 84/42 vertices in 0ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 1086/363 vertices in 0ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 6/4 vertices in 0ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 54/35 vertices in 1ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 42/28 vertices in 0ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 1284/400 vertices in 0ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 18168/4203 vertices in 6ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 300/100 vertices in 1ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 288/104 vertices in 0ms!
I/jPCT-AE: Subobject of object 2/plane compiled to indexed fixed point data using 288/104 vertices in 0ms!
I/jPCT-AE: Object 2/plane compiled to 0 subobjects in 61ms!
I/jPCT-AE: Object 'plane' uses multiple texture sets!
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
I/jPCT-AE: Creating buffers...
I/jPCT-AE: VBO created for object 'plane'
« Last Edit: June 07, 2022, 05:00:37 pm by EgonOlsen »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12298
    • View Profile
    • http://www.jpct.net
Re: How to add more texture maps to obj
« Reply #6 on: June 04, 2022, 06:30:54 pm »
That looks a bit strange....I expected some texture names to appear in the log. Can you upload the file so that I can have a look at it (next week...)?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12298
    • View Profile
    • http://www.jpct.net
Re: How to add more texture maps to obj
« Reply #7 on: June 04, 2022, 07:00:18 pm »
Are these materials really used in the obj file? Maybe the export went wrong?

Offline a8451727

  • byte
  • *
  • Posts: 11
    • View Profile
Re: How to add more texture maps to obj
« Reply #8 on: June 05, 2022, 03:21:38 am »
That looks a bit strange....I expected some texture names to appear in the log. Can you upload the file so that I can have a look at it (next week...)?

I'm sorry I didn't reply in time, because we are in different time zones, so my English level is also very low

At first, I planned to upload the attachment, but the file size exceeded 64KB

Offline a8451727

  • byte
  • *
  • Posts: 11
    • View Profile
Re: How to add more texture maps to obj
« Reply #9 on: June 05, 2022, 04:00:53 am »
Are these materials really used in the obj file? Maybe the export went wrong?

Yes, I can find some keywords about texture in the obj file


Code: [Select]
[color=red]usemtl _Vegetation_Blur7_1[/color]
vt -89.2149 91.5022
vn -2.70439e-15 1 1.28628e-17
v -1082.47 986.237 -572.951
vt -90.2059 47.7459
vt -89.2149 48.6595
f 875/6426/1413 2350/6427/1413 2349/6428/1413

vt -91.1048 92.4257
f 877/6429/1413 2350/6427/1413 875/6426/1413

v -1094.23 986.237 -561.842
vt -91.1856 46.8202
f 877/6429/1413 2351/6430/1413 2350/6427/1413

v -1105.85 986.237 -550.591
vt -92.154 45.8826
f 877/6429/1413 2352/6431/1413 2351/6430/1413

vt -93.1108 93.0412
f 878/6432/1413 2352/6431/1413 877/6429/1413

v -1117.33 986.237 -539.198
vt -93.1108 44.9332
f 2352/6431/1413 878/6432/1413 2353/6433/1413

[color=red]usemtl Vegetation_Grass_Artificial[/color]
vn -4.20317e-15 1 1.3581e-16
v -1128.67 986.237 -527.666
vt -47.0279 21.9861
vt -46.5554 22.4666
f 878/2323/1414 2354/6434/1414 2353/6435/1414

f 880/2325/1414 2354/6434/1414 878/2323/1414

v -1139.87 986.237 -515.996
vt -47.4946 21.4998
f 880/2325/1414 2355/6436/1414 2354/6434/1414

v -1150.93 986.237 -504.189
vt -47.9552 21.0079
f 880/2325/1414 2356/6437/1414 2355/6436/1414

f 881/2326/1414 2356/6437/1414 880/2325/1414

v -1161.47 986.237 -492.644
vt -48.3948 20.5268
f 2356/6437/1414 881/2326/1414 2357/6438/1414

[color=red]usemtl _Vegetation_Blur7_1[/color]
vt -96.7895 93.7789
vn -4.72179e-15 1 3.07317e-16
v -1168.87 986.237 -484.664
vt -97.4061 40.3887
vt -96.7895 41.0537
f 881/6439/1415 2358/6440/1415 2357/6441/1415
« Last Edit: June 07, 2022, 05:00:20 pm by EgonOlsen »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12298
    • View Profile
    • http://www.jpct.net
Re: How to add more texture maps to obj
« Reply #10 on: June 05, 2022, 04:02:00 pm »
Can't you upload it to some file host? Or just mail a zipped version to info@jpct.net

Offline a8451727

  • byte
  • *
  • Posts: 11
    • View Profile
Re: How to add more texture maps to obj
« Reply #11 on: June 06, 2022, 02:59:30 am »
Yes, I just sent an email

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12298
    • View Profile
    • http://www.jpct.net
Re: How to add more texture maps to obj
« Reply #12 on: June 07, 2022, 05:05:47 pm »
I had brief try on loading (but not rendering) the object and I can't see anything wrong with it. This is an excerpt  from the log output:

Code: [Select]
2022-06-07 16:56:12.146 6204-6234/com.example.androidtestcase I/jPCT-AE: Text file from InputStream loaded...2796 bytes
2022-06-07 16:56:12.147 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material FrontColor!
2022-06-07 16:56:12.147 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material Color_E04!
2022-06-07 16:56:12.147 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material Color_E03!
2022-06-07 16:56:12.147 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material Color_007!
2022-06-07 16:56:12.147 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material Carpet_Loop_Pattern!
2022-06-07 16:56:12.147 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material _Wood__Floor_2!
2022-06-07 16:56:12.148 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material Stone_Pavers_Flagstone_Gray!
2022-06-07 16:56:12.148 6204-6234/com.example.androidtestcase I/jPCT-AE: Texture named 02/Stone_Pavers_Flagstone_Gray.jpg added to TextureManager!
2022-06-07 16:56:12.148 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material Wood__Floor!
2022-06-07 16:56:12.148 6204-6234/com.example.androidtestcase I/jPCT-AE: Texture named 02/Wood__Floor.jpg added to TextureManager!
2022-06-07 16:56:12.148 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material Stone_Coursed_Rough!
2022-06-07 16:56:12.148 6204-6234/com.example.androidtestcase I/jPCT-AE: Texture named 02/Stone_Coursed_Rough.jpg added to TextureManager!
2022-06-07 16:56:12.148 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material Groundcover_RiverRock_4inch!

Prior to loading the model, I assigned two textures to the manager:

Code: [Select]
TextureManager.getInstance().addTexture("02/Carpet_Loop_Pattern.jpg", texture);
TextureManager.getInstance().addTexture("02/_Wood__Floor_2.jpg", texture2);

Note that these textures don't show up in the log, only the ones that have no matching names in the TextureManager do. As all working as expected.

I'm not sure, what your actual issue is...you loaded the textures and the model but the textures don't show on the model? If that's the case, maybe you can post a screen shot of how the model looks instead?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12298
    • View Profile
    • http://www.jpct.net
Re: How to add more texture maps to obj
« Reply #13 on: June 07, 2022, 05:06:57 pm »
Oh, and please wrap larger chunks of text or code into code-Tags (the # in the forum's editor). I did that for your former posts.

Offline a8451727

  • byte
  • *
  • Posts: 11
    • View Profile
Re: How to add more texture maps to obj
« Reply #14 on: June 08, 2022, 03:38:44 am »
I had brief try on loading (but not rendering) the object and I can't see anything wrong with it. This is an excerpt  from the log output:

Code: [Select]
2022-06-07 16:56:12.146 6204-6234/com.example.androidtestcase I/jPCT-AE: Text file from InputStream loaded...2796 bytes
2022-06-07 16:56:12.147 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material FrontColor!
2022-06-07 16:56:12.147 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material Color_E04!
2022-06-07 16:56:12.147 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material Color_E03!
2022-06-07 16:56:12.147 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material Color_007!
2022-06-07 16:56:12.147 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material Carpet_Loop_Pattern!
2022-06-07 16:56:12.147 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material _Wood__Floor_2!
2022-06-07 16:56:12.148 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material Stone_Pavers_Flagstone_Gray!
2022-06-07 16:56:12.148 6204-6234/com.example.androidtestcase I/jPCT-AE: Texture named 02/Stone_Pavers_Flagstone_Gray.jpg added to TextureManager!
2022-06-07 16:56:12.148 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material Wood__Floor!
2022-06-07 16:56:12.148 6204-6234/com.example.androidtestcase I/jPCT-AE: Texture named 02/Wood__Floor.jpg added to TextureManager!
2022-06-07 16:56:12.148 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material Stone_Coursed_Rough!
2022-06-07 16:56:12.148 6204-6234/com.example.androidtestcase I/jPCT-AE: Texture named 02/Stone_Coursed_Rough.jpg added to TextureManager!
2022-06-07 16:56:12.148 6204-6234/com.example.androidtestcase I/jPCT-AE: Processing new material Groundcover_RiverRock_4inch!

Prior to loading the model, I assigned two textures to the manager:

Code: [Select]
TextureManager.getInstance().addTexture("02/Carpet_Loop_Pattern.jpg", texture);
TextureManager.getInstance().addTexture("02/_Wood__Floor_2.jpg", texture2);

Note that these textures don't show up in the log, only the ones that have no matching names in the TextureManager do. As all working as expected.

I'm not sure, what your actual issue is...you loaded the textures and the model but the textures don't show on the model? If that's the case, maybe you can post a screen shot of how the model looks instead?

I loaded textures and models, but only one texture can be displayed on the model