Crystal Space
Welcome, Guest. Please login or register.
October 20, 2014, 01:14:50 pm

Login with username, password and session length
Search:     Advanced search
9010 Posts in 2044 Topics by 8757 Members
Latest Member: Paoalmeta
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  Loading 3D Models
« previous next »
Pages: [1] Print
Author Topic: Loading 3D Models  (Read 1415 times)
Tredpath
Newbie
*
Posts: 2


View Profile Email
« on: June 04, 2010, 08:25:16 am »

Hello,

I am currently using walktest to display a custom xml world file.  I have successfully setup the world file to load a terrain and overlay a satellite map on it.  This worked really well and took almost no effort to complete.  I then moved on to loading a 3ds object into the sector and everything started to go downhill.  I know that there are no problems in the 3ds file as I am able to view it in an OSG based 3D model viewer.  It appears that the walktest app cannot load any of the texture/material data that seems (at least to me) like it should be loaded by default as part of the model.  Is this (ie. from the xml world file) the best/easiest way to load a 3ds file into a crystal space app or should I be looking at loading it directly from the code?  Would that help or would there still be problems with locating and using textures?  Also, from the xml world file is there a way to scale and rotate the mesh?

Thanks
Logged
Crystalfur
Newbie
*
Posts: 30


View Profile Email
« Reply #1 on: June 06, 2010, 01:54:53 am »

I'm neither familiar with the OSG viewer nor 3ds (I use Blender), so I don't know how much help I'll be.

Is the OSG viewer compatible with CS map/world file formatting? Did you export it from 3ds Max with the exporter? (I'm really not sure how well the exporter is maintained. I think most people use the blender exporter and even that is nearly poorly maintained.)

In any case, you should be able to use viewmesh to see if the mesh will load. In addition, walktest makes use of vfs.cfg, as do all CS apps, so you'll want to make sure you have files where they need to be.

Generally, using a world file to load meshes, textures, materials, etc. is easier and more flexible. There shouldn't be much difference between manually loading from code and using xml and letting the engine load it for you. As long as you indicate where the texture files are located, and make use of vfs.cfg, you should be fine.

As for rotating, use the 'matrix' tag. Something like this:
<meshobj name='Cube'>
      <plugin>genmesh</plugin>
      <params>
        <factory>genCube</factory>
        <material>no</material>
      </params>
      <zuse/>
      <move>
        <v y='0' x='0' z='0'/>
        <matrix>
          <roty>-1.23502</roty>
          <rotz>-1.04741</rotz>
          <rotx>1.41551</rotx>
        </matrix>
      </move>
    </meshobj>
« Last Edit: June 06, 2010, 01:57:55 am by Crystalfur » Logged
Crystalfur
Newbie
*
Posts: 30


View Profile Email
« Reply #2 on: June 09, 2010, 02:49:34 am »

My apologies, I seem to have mislead you. I thought there was a 3ds exporter like there is for Blender, but according to the doc. there is a 3ds loader within the engine. See: http://www.crystalspace3d.org/docs/online/1.4/manual/Model-Loading.html#0
Logged
kickvb
Global Moderator
Jr. Member
*****
Posts: 79


View Profile
« Reply #3 on: June 09, 2010, 04:11:20 pm »

I thought there was a 3ds exporter like there is for Blender

There is one also. You can find the documentation about it in your CS installation directory, at crystalspace-src-1.4.0/scripts/max/exporterguide/index.htm

For the problem of the initial post, with textures not found, what have you done exactly? You have created by yourself an XML file with a sector, then you have included in your XML file the description generated by the 3DS exporter? If doing so, have you also included the description of the materials and textures? Have you set up correctly the VFS paths to your textures? What are exactly the error messages?
Logged
Tredpath
Newbie
*
Posts: 2


View Profile Email
« Reply #4 on: June 11, 2010, 06:21:20 am »

Hello,

I do not have 3d studio max, I had the 3ds file given to me.  I have no description from a 3ds exporter, all that I have is the 3ds file and its image files.  What I've done is modify the world file from the terrainf example to load my own world file and materials for it.  Then using other examples I loaded the 3ds file (and linked any necessary plugins).  If I create the materials that the give errors myself in the world file then they show on the model.  The errors that I get are all along the lines of "cannot find material XXX, creating material.  This behaviour is depricated" and "cannot load image file".  The 3ds file and it's corresponding images are located in the same directory as the world file which I have mapped to a Unix style directory in the vfs.cfg file.  I have used several different 3d engines (ex. OGRE, OSG, Irrlicht) and they have all been able to load the file given only a reference to the location of the 3ds file.  If I'm not mistaken, information about the required image files and how to map them to specific textures is already located in the 3ds file, is it not?

Thanks for your help.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 6.167 seconds with 15 queries.