Textures For .x Files
Textures For .x Files
I am using Blender and have been able to export the .blend files to .x files. I have also been able to use them with the Irrlicht engine. The problem is, they only show up as black shapes when I run my program. How can I use the textures/materials that I used in Blender?
to help you more you should tell at least what is the flag of material on the mesh. called by setMaterialType(), if you have an exporter from blender, make sure the .X mesh is realy valid, you can do that by loading it in DXmeshviewer, and saving it in there, that is a good validation process.
or you can send me the X files with their textures and I will gladly take a look what they are
and I have just find out I have not logged in again , it is me needforhint
or you can send me the X files with their textures and I will gladly take a look what they are
and I have just find out I have not logged in again , it is me needforhint
-
- Posts: 11
- Joined: Wed Apr 19, 2006 6:23 am
I'm having the same problem; model and texture load according to console, but I get a simple black shape when I try to open them in the "Hello, World" example. Exporting a .X file from Blender like the OP. Latest version of Blender. File looks fine when I open it in a text editor. Do I need to use the Blender export script that comes with Irrlicht?
Here's the model and texture:
http://members.gamedev.net/23yrold3yrol ... htTest.zip
I dream one day of a 3D file format as easy to use as a .bmp, I really do. It's enough to drive me back to 2D games.
Here's the model and texture:
http://members.gamedev.net/23yrold3yrol ... htTest.zip
I dream one day of a 3D file format as easy to use as a .bmp, I really do. It's enough to drive me back to 2D games.
23yrold3yrold, pse11,
in most cases it's the setup in blender that is wrong. you have to uv-map textures and not just texture it "blender-style"
if you have not done that before:
http://mediawiki.blender.org/index.php/ ... UV_Mapping
not really complecated. you will get it fast! only drawback no-one tells you on blender: create a new material for each new texture you use! otherwise the exporter seems to get kinda confused you will be able to map everything without creating a new material, but then you end up like before...
at least that is how it worked for me.
as to your question regarding exporter:
with the current version of blender, use this one by ben omari:
http://xoomer.virgilio.it/glabro1/
finally, make sure the .x-file and the textures end up in the same directory. then it should load fine in irrlicht.
it works for me.
hope this helped,
finger007
in most cases it's the setup in blender that is wrong. you have to uv-map textures and not just texture it "blender-style"
if you have not done that before:
http://mediawiki.blender.org/index.php/ ... UV_Mapping
not really complecated. you will get it fast! only drawback no-one tells you on blender: create a new material for each new texture you use! otherwise the exporter seems to get kinda confused you will be able to map everything without creating a new material, but then you end up like before...
at least that is how it worked for me.
as to your question regarding exporter:
with the current version of blender, use this one by ben omari:
http://xoomer.virgilio.it/glabro1/
finally, make sure the .x-file and the textures end up in the same directory. then it should load fine in irrlicht.
it works for me.
hope this helped,
finger007
-
- Posts: 11
- Joined: Wed Apr 19, 2006 6:23 am
That script seems to work for me; at least it's the right shape now, near as I can tell since it's still a black mass. The image is UV mapped fine in Blender, unless I'm missing something (and I guess I must be) ... I have a material for the texture and everything. Hmm.
EDIT: Aha! The console is reporting a syntax error in the .x file in regards to the texture name. Not sure why it should matter, since I'm explicitly setting it in the code (slightly modified version of the Hello, World example) but that must be it. Now, how to fix it ...
Error is "Unknown syntax while reading texture filename string in x file". The zip file I posted above has been updated to contain the .x file exported with the posted Python script.
EDIT2: Commented out the texture file in the .x file; I seem to have a nasty problem with backfaces and distortion but the shape and texture is there. Huzzah!
EDIT3: And now it crashes horribly if that texture bit is commented out. I'll poke at this later; I need a break ... what would the ideal Irrlicht settings for that DirectXExporter241 be? Maybe that's my problem ...
EDIT: Aha! The console is reporting a syntax error in the .x file in regards to the texture name. Not sure why it should matter, since I'm explicitly setting it in the code (slightly modified version of the Hello, World example) but that must be it. Now, how to fix it ...
Error is "Unknown syntax while reading texture filename string in x file". The zip file I posted above has been updated to contain the .x file exported with the posted Python script.
EDIT2: Commented out the texture file in the .x file; I seem to have a nasty problem with backfaces and distortion but the shape and texture is there. Huzzah!
EDIT3: And now it crashes horribly if that texture bit is commented out. I'll poke at this later; I need a break ... what would the ideal Irrlicht settings for that DirectXExporter241 be? Maybe that's my problem ...
hi again!
23yrold3yrold,
i just spent a minute with your files. look at the two screenies here:
http://rapidshare.de/files/18473436/irr ... n.zip.html
what i did was the following: i opened the .x in mview (screenie 1) and resaved it. after that i loaded it into irrlicht. it seems distorted when you get near to it but from further away everything is fine...as you said: backfaces.
as for the settings for export...hmm, terribly hard to tell from an .x for me... but it doesnt have that much to set after all. if you cannot figure it out, send your .blend and i'll have a look at the weekend.
cheers,
finger007
23yrold3yrold,
i just spent a minute with your files. look at the two screenies here:
http://rapidshare.de/files/18473436/irr ... n.zip.html
what i did was the following: i opened the .x in mview (screenie 1) and resaved it. after that i loaded it into irrlicht. it seems distorted when you get near to it but from further away everything is fine...as you said: backfaces.
as for the settings for export...hmm, terribly hard to tell from an .x for me... but it doesnt have that much to set after all. if you cannot figure it out, send your .blend and i'll have a look at the weekend.
cheers,
finger007
-
- Posts: 11
- Joined: Wed Apr 19, 2006 6:23 am
I tried removing the space; didn't help.
I'll try that mview or MeshView, if I can find it. I see a MeshViewer in bin/Win32-VisualStudio but it looks completely different when running and doesn't load the mesh well ... thanks for your help so far; I just wish Blender would export right on it's own ...
I'll try that mview or MeshView, if I can find it. I see a MeshViewer in bin/Win32-VisualStudio but it looks completely different when running and doesn't load the mesh well ... thanks for your help so far; I just wish Blender would export right on it's own ...
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Indeed there's a major bug in the .x loader which reads only one token (word enclosed by whitespace) and requires it to be of the form "..."; In all other cases it throws the syntax error. Can be easily fixed, though, by reading until next quotes are found. The patch has been uploaded to the patch page. Yet untested, though, as I don't have examples or a compiler at hand.JP wrote:i think that syntax error with the texture is probably due to having spaces in the texture file name? I had an error like that before and it was due to spaces.