Author Topic: Importing OBJ from sketchup  (Read 3090 times)

Offline IZACIZAC

  • byte
  • *
  • Posts: 19
    • View Profile
Importing OBJ from sketchup
« on: June 25, 2013, 05:38:23 am »
Has anyone succesfully imported OBJ files from sketchup, if so, how?

My model (block) is initially completed gray, I think its a problem with the MTL file, I'm seeing

Code: [Select]
map_Kd block_Textures/Concrete_Aggregate_Smoke.PNG
block_Textures is a folder sketchup created, that I deleted as I load them from some other place. My textures are added to the texturemanager just as the png name, so

Code: [Select]
Texture named Concrete_Aggregate_Smoke.PNG added to TextureManager!
So I changed the line in the MTL file to

Code: [Select]
map_Kd Concrete_Aggregate_Smoke.PNG
But still its just grey. If I delete that line entirely though its draw in one solid colour, roughly the right colour but not a texture

The OBJ file contains

Code: [Select]
mtllib block.mtl
and

Code: [Select]
usemtl Concrete_Aggregate_Smoke
 Anyone know what I am doing wrong?




Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Importing OBJ from sketchup
« Reply #1 on: June 25, 2013, 10:13:09 am »
jPCT loads the texture information but not the texture itself. You have to load some texture and assign it to the TextureManager with exactly the name that you have in your mtl file before loading the actual object. If you don't do that, jPCT creates a white default texture with that name that can be replaced later.

More information: http://www.jpct.net/wiki/index.php/Loading_models

Offline IZACIZAC

  • byte
  • *
  • Posts: 19
    • View Profile
Re: Importing OBJ from sketchup
« Reply #2 on: June 26, 2013, 01:45:30 am »
I am adding the texture to the manager with the exact same name, its just the models from sketchup that I cant get to display textured.  As a test I downloaded a bunch of free 3ds and obj textured models which all work with my code.
« Last Edit: June 26, 2013, 04:37:05 am by IZACIZAC »

Offline IZACIZAC

  • byte
  • *
  • Posts: 19
    • View Profile
Re: Importing OBJ from sketchup
« Reply #3 on: June 26, 2013, 04:55:49 am »
Nevermind I had inadvertently deleted .PNG from the names I added to the texture manager.. ignore me from now on ^^, thanks anyway