Delgine 3D Tools & Content DeleD Community Edition
Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Blender/DeleD - Dude, where's my texture?!

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    DeleD Community Edition Forum Index -> DeleD Community Edition
View previous topic :: View next topic  
Author Message
alienmantis
Member


Joined: 16 Feb 2009
Posts: 2

PostPosted: Mon Feb 16, 2009 3:48 pm    Post subject: Blender/DeleD - Dude, where's my texture?! Reply with quote

Hi! Razz

I'm kinda embarassed, that my first post is a plea for help, but I'd quite urgently need one and I dont know where else to turn. Embarassed

So, the thing is... I'm using DeleD as a middle step in converting .blend files to OGRE meshes (.mesh), and I'm having some problems with textures...

Now, I know the rough process, since I managed to do it a first couple of times, but I simply cant get it working anymore!

T'was something like this:
1. Create a mesh in blender
2. Texture it
3. Export in .obj (settings?)
4. Import in DeleD as .obj
5. Export in OGRE mesh

The problem is, I get no texture in step 4. I can have it textured and rendered in blender no problem, but when I try to put in in DeleD, the texture dissapears. It could be something with blender export settings, but I doubt it. I succeeded in exporting a couple of first meshes w/ textures, but then, it simply stopped working.
The thing is, I dont actually need the texture to show in DeleD, since I assign textures to .mesh trough .cfg files, but it seems that if DeleD doesen't assign some sort of texture layer to .mesh file (which it doesent, since the blender texture isnt copied), the .cfg texture mapping doesent work.
Halp, kitteh? Embarassed
Back to top
View user's profile Send private message
Mr.Fletcher
DeleD PRO user


Joined: 07 Aug 2004
Posts: 1772
Location: Germany

PostPosted: Mon Feb 16, 2009 5:54 pm    Post subject: Reply with quote

Well, I haven't ever touched the .obj importer (well I did, once), but have you tried assigning the texture you applied in DeleD again? If you're lucky, the uv coordinates are exported and only the texture got lost.
//edit
Also, welcome Wink
_________________
Behold! The DeleD Wiki! Please help us expanding it Smile
DeleD on IRC
Back to top
View user's profile Send private message
trucker2000
DeleD PRO user


Joined: 11 May 2005
Posts: 1839
Location: Sacramento, California

PostPosted: Mon Feb 16, 2009 6:35 pm    Post subject: Reply with quote

From my playings around with obj, I would suggest making sure your textures are in the same folder as the obj and mtl files before importing. (I think that's what I had to do. It's been a while)
_________________
Some day I will grow up and be a real modeler.
"Never give up! Never surrender!!"
Sys specs:
asus
8 gigs ram
Invidia gtx560 video card
Windows 8 (worst op sys Ever)
Back to top
View user's profile Send private message Visit poster's website
Paul-Jan
Site Admin


Joined: 08 Aug 2004
Posts: 3066
Location: Lage Zwaluwe

PostPosted: Mon Feb 16, 2009 8:25 pm    Post subject: Reply with quote

Welcome to our forums indeed! Let's separate the two steps:

1. Importing the .OBJ file

Here are the technical specifications of what the importer does:

Quote:
The .OBJ importer looks for materials inside [filename].mtl, once the first usemtl is encountered in the .OBJ file. Filename is either the name of the obj file itself, or any other file specified by mtllib.

The .mtl file needs to be in the same folder as the .OBJ file.

Inside the .mtl file, textures as recognized by the map_Kd tag. Textures need to be in the same folder as the .OBJ file, and should be in .bmp, .jpg or .tga format.


As both .OBJ and .MTL files are pure text, you can simply open them up in notepad and do a quick visual scan to see if the tags mentioned above are present. If this all sounds a bit too technical, feel free to send the exported .OBJ+.MTL file to paul [at] delgine [dot] com, and I'll see if I can figure out what is wrong. If needed, I could also upgrade the .OBJ importer a bit. Smile

2. Export the Ogre Mesh file

Any object in DeleD always contains at least a single texture layer (system texture by default), which gets exported into the mesh. Could you further specify "the .cfg texture mapping doesn't work"? Are the texture coordinates wrong or does the texture not show up at all? Are you getting any error information?

Hope this information helps you resolve your issues. If not, just send me the .obj + .mtl files, and I'll what I can do to fix things...
Back to top
View user's profile Send private message Visit poster's website
alienmantis
Member


Joined: 16 Feb 2009
Posts: 2

PostPosted: Mon Feb 16, 2009 10:02 pm    Post subject: Reply with quote

First of all, REALLY thanks for all the help, I appreciate it a ton! Embarassed

Well... So I checked the .obj and .mtl files, and while the .obj file has all the references (usemtl), the .mtl lacks the reference to the texture. I'll post the text in .mtl in code below:

Code:
# Blender3D MTL File: stalaktit.blend
# Material Count: 1
newmtl Material
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ni 1.000000
d 1.000000
illum 2


The thing is, the texture is present in the same folder (under the name of canyon_tex.jpg and is the texture that blender uses to overlay the mesh (correctly). Perhaps I'm doing something wrong while exporting the .blend files?

Oh, and by "cfg mapping doesen't work", I meant that... Well, when I try to attach the texture to the .mesh file (canyon_tex.jpg) trough the definition in .material file (that accompanies OGRE's .mesh) it shows up in game as white-milky-slightly orange (the texture I want to use is mostly orange, if that's of any relevance), and not as the texture it's supposed to.

I hope I wrote it clearly enough... Thanks again Smile
Back to top
View user's profile Send private message
Grandmaster B
DeleD PRO user


Joined: 03 Jul 2007
Posts: 218

PostPosted: Tue Feb 17, 2009 1:00 pm    Post subject: Reply with quote

In Blender, you need to assign the texture in the UV/Image Editor (UV- or Face-Textures!). Do not use material textures as they will not be exported.

Do the following:
Select your object.
Go into Edit-Mode (TAB)
Select all faces you want to re-texture.
Create a UV-Layer: Press "U" and select a unwrapping method (try Cube Projection first). (This creates the first texture layer.)
Open a "UV/Image Editor" window. (I recommend splitting up the 3D-View to have both in view).
Here select all faces by pressing "A".
Now load the texture by selecting the "Image"->"Open" menu. Or select a loaded one with the dropdown menu.

The selected faces are now textured with the loaded texture.

Now the exporter should export with textures.

You may test your texture assignments in "Texture Face Materials"-Mode (inside the Game menu (Topmost header)). If they show up in "Textured" view they should get exported.
Back to top
View user's profile Send private message
Paul-Jan
Site Admin


Joined: 08 Aug 2004
Posts: 3066
Location: Lage Zwaluwe

PostPosted: Tue Feb 17, 2009 3:14 pm    Post subject: Reply with quote

As long as the .mtl file doesn't contain any reference to the texture, importing it into DeleD will not work. From Blender's OBJ exporter source:

Code:

      # Write images!
      if key[1] != None:  # We have an image on the face!
         img = Image.Get(key[1])
         file.write('map_Kd %s\n' % img.filename.split('\\')[-1].split('/')[-1]) # Diffuse mapping image         
      
      elif key[0] != None: # No face image. if we havea material search for MTex image.
         for mtex in mat.getTextures():
            if mtex and mtex.tex.type == Blender.Texture.Types.IMAGE:
               try:
                  filename = mtex.tex.image.filename.split('\\')[-1].split('/')[-1]
                  file.write('map_Kd %s\n' % filename) # Diffuse mapping image
                  break
               except:
                  # Texture has no image though its an image type, best ignore.
                  pass


I don't know Blender well enough to be able to tell from this how to enable exported textures from the interface, but I'm guessing Grandmaster B's advice will get you a long way. Thanks for that, Grandmaster B!

Once you get things exported from Blender properly (as a quick check, you can probably re-import in Blender and see if the textures still show up), I'm sure import into DeleD and subsequent export to .mesh will work like a charm. If not, make sure to let us know!
Back to top
View user's profile Send private message Visit poster's website
Grandmaster B
DeleD PRO user


Joined: 03 Jul 2007
Posts: 218

PostPosted: Tue Feb 17, 2009 4:31 pm    Post subject: Reply with quote

No problem.

Its a bit confusing because Blender has two options to assign textures to meshes. One with materials (does not work with most exporter!) and with the UV-Editor on a per face basis. The UV-Editor should always be used for game content or for exporting.
Back to top
View user's profile Send private message
Daaark
DeleD PRO user


Joined: 01 Sep 2004
Posts: 2696
Location: Ottawa, Canada

PostPosted: Thu Feb 19, 2009 10:43 pm    Post subject: Reply with quote

Grandmaster B wrote:
No problem.

Its a bit confusing because Blender has two options to assign textures to meshes. One with materials (does not work with most exporter!) and with the UV-Editor on a per face basis. The UV-Editor should always be used for game content or for exporting.
The materials are for the renderer, and the textures are for real time and viewport.
_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    DeleD Community Edition Forum Index -> DeleD Community Edition All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum