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 

XML Exporter Plugin

 
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 Plugins
View previous topic :: View next topic  
Author Message
Spk
Member


Joined: 16 May 2006
Posts: 8

PostPosted: Sat May 20, 2006 1:44 pm    Post subject: XML Exporter Plugin Reply with quote

Im almost done writting the XML Exporter plugin I was talking about in my previous thread. Most noticeable features include:
- Materials info and geometry are provided in the same XML file for easy loading
- Per-face normals
- Per-vertex normals
- Splits a mesh using several different materials on its faces into "atomic" submeshes using only 1 material. For instance, a cube using a different texture for the top and bottom faces will be split into 3 submeshes (1 for the top face using material A, one for the bottom face using material B, and one for the side faces using material C).
- Merge meshes using the same material into a unique one. The vertex lists are also merged intelligently to avoid redundant data
- Support for multiple texture coordinate sets (lightmaps, etc)
- Can rescale the map geometry
- Can export all the textures used in the scene to the desintation folder, in the same directory structure as they were in DeleD\Textures (ie: DestFolder\Wood\Wood12.jpg)

Here's an exemple output:
http://www.silent-planet.org/will/multiplanes.xml

Scene in DeleD:


Scene in my engine:


Now I've got a last problem to solve before I can release the plugin: I couldnt find a good way of describing my problem with words so I'll just post a picture instead Smile

The test scene is a simple cube textured using the same texture on each face. This is how it looks like in the editor:


This is the XML file generated using my plugin:
http://www.silent-planet.org/will/cube_simple.xml

Ths is how it looks like in my engine:


The left screenshot is taken with the same angle as the editor, and the right one is taken from the opposite side. As you can see, there are some faces on wich the texture displays correctly, but some where it's totally messed up. My guess is it's because at the moment the faces share some vertices, which means that only 1 texture coordinate is used for multiple faces. So it would work fine on one face, but the faces sharing vertices with this first face would not be using the correct texture coordinates.

I've exported this scene using the Ogre mesh exporter, in XML output, and the plugin generates 24 vertices for the cube, instead of the 8 my plugin generates. 24 is 4 vertex * 6 faces, which means that the faces arent sharing any vertices.

Now the question is, how do I go about implementing the same mechanism?
Back to top
View user's profile Send private message
CMe
Member


Joined: 30 Jun 2005
Posts: 72
Location: Ontario Canada

PostPosted: Sat May 20, 2006 5:52 pm    Post subject: Reply with quote

At first glance it looks like you're attempting to share texture coordinates along with vertex positions. Usually this isn't possible as each face won't map the same coordinate at each vertex position. So for a cube you would normally end up with 8 unique vertex positions and 24 texture coordinates.
_________________
drop into #delgine on irc.scene.org
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Spk
Member


Joined: 16 May 2006
Posts: 8

PostPosted: Sat May 20, 2006 5:55 pm    Post subject: Reply with quote

Yeah that's what I concluded too. My question was actually about how to generate this set of 24 vertices from the 8 vertices provided by DeleD from the scene data. Any idea?
Back to top
View user's profile Send private message
CMe
Member


Joined: 30 Jun 2005
Posts: 72
Location: Ontario Canada

PostPosted: Sat May 20, 2006 6:09 pm    Post subject: Reply with quote

Not sure I follow. You shouldn't have to generate anything. All the data is available from deled. In the case of the cube, it will give you 8 vertex positions for the object and for each face in that object a set of texture coordinates for each point.

So with the file format you have there, what I would do is similar to deled's file format. If possible, store the texture coordinates in the face instead of the vertex. Something like this perhaps.

Code:

- <face>
  <indices v0="5" v1="4" v2="6" />
  <normal x="0.000000" y="0.000000" z="-1.000000" />
  <texcoord s="-0.500000" t="0.000000" />
  <texcoord s="-0.500000" t="1.000000" />
  <texcoord s="-0.500000" t="0.000000" />
  </face>

- <vertex>
  <position x="-32.000000" y="0.000000" z="-32.000000" />
  <normal x="-0.408248" y="-0.408248" z="-0.816497" />
  </vertex>


_________________
drop into #delgine on irc.scene.org
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Spk
Member


Joined: 16 May 2006
Posts: 8

PostPosted: Sat May 20, 2006 6:35 pm    Post subject: Reply with quote

Alright I get it now... That's what the texcoord.vertices[] was for =p Thanks, it was a bit confusing. I think Ill get this working now.
Back to top
View user's profile Send private message
jwatte
DeleD PRO user


Joined: 26 Apr 2006
Posts: 513

PostPosted: Sat May 20, 2006 11:58 pm    Post subject: Reply with quote

http://www.mindcontrol.org/~hplus/graphics/vertex-arrays.html has an explanation of what you have to do.

Note that if you want to support sharp creases along edges, you have to do the same thing for normals, too!
Back to top
View user's profile Send private message
Spk
Member


Joined: 16 May 2006
Posts: 8

PostPosted: Sun May 21, 2006 12:42 am    Post subject: Reply with quote

Thanks, but Ive sorted it out already Wink I will post the plugin tomorow when I get to write a decent readme.
Back to top
View user's profile Send private message
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 Plugins 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