Jump to content

  • Log In with Google      Sign In   
  • Create Account

Meshes


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 DmitryNik   Members   -  Reputation: 199

Like
2Likes
Like

Posted 05 December 2012 - 04:02 AM

Hello.

I've read about different methods, how can be loaded the mesh into the game written with DirectX 11. These methods were from loading meshes with Assimp to writing own loader for .OBJ -files. As everybody know, .OBJ is a well documented. I assumed that too before I've seen this

f 54 34
f 34 78
f 100 -100
and so on

and also this:

vt -1.546 0.578 -3.10098 (very strange behavior for texture coordinates, isn't it?)

I'm about to ask three questions. First: how it's possible that texture coordinates are negative or greater than one?
Second: How it's possible that faces consist of only 2 points without normal vectors and texture coordinates, even they are defined for them?
Third: What do you use for loading meshes in DirectX 11 in Windows 8/WIndows 7?

Thank you in advance for your answers.

p.s. program used for exporting to .OBJ-file is Blender 2.64

Edited by DmitryNik, 05 December 2012 - 05:20 AM.


Sponsor:

#2 Zaoshi Kaba   Crossbones+   -  Reputation: 4588

Like
5Likes
Like

Posted 05 December 2012 - 08:27 AM

1. Textures can be tiled. So point (1.1, 1.1) is same as (0.1, 0.1).
2. Are you sure it's not lines? Faces have to have at least 3 points.
3. Well I guess you're going to load from file, so ifstream is a good choice.

#3 DmitryNik   Members   -  Reputation: 199

Like
2Likes
Like

Posted 05 December 2012 - 08:39 AM

1. Textures can be tiled. So point (1.1, 1.1) is same as (0.1, 0.1).
2. Are you sure it's not lines? Faces have to have at least 3 points.
3. Well I guess you're going to load from file, so ifstream is a good choice.


Thank you.

It's too bad Microsoft didn't implement anything for meshes loading. It could an OBJ or FBX file(like it was in XNA).

And, yes, you are right it's simple line.

#4 NightCreature83   Crossbones+   -  Reputation: 3032

Like
5Likes
Like

Posted 05 December 2012 - 10:40 AM

The OBJ format can actually have faces that consist of 4 verts or quads. A face can consist of only vertex data so the absence of texture coordinates or normals is just fine, it's just there is no way to light or texture that particular face. Face data can be combines in an OBJ file as well, you can find 3 vert face data and 4 vert face data in the same face description list in an obj file, or at least I have encountered this before.

Most engines use their own formats to load meshes, and often this is just a straight dump of the vertex array in to a text or binary file so that runtime loading is extremely fast and no other operation than a straight forward memcpy are needed. Mesh loading and saving is a problem for which there is no standard way that is fast, for example Max and editing tools need to know about all information about a mesh, so material, shader, textures and meta data(vertex is connected to which edge, etc.), a game engine doesn't need to know about faces, edges and all kinds of other stuff that is stored in a model file. There for we write our own exporters and importers for the data we care about and make it load fast, one standard format doesn't cover all performances for all engines sadly.
Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, Mad Max

#5 DmitryNik   Members   -  Reputation: 199

Like
2Likes
Like

Posted 05 December 2012 - 04:12 PM

The OBJ format can actually have faces that consist of 4 verts or quads. A face can consist of only vertex data so the absence of texture coordinates or normals is just fine, it's just there is no way to light or texture that particular face. Face data can be combines in an OBJ file as well, you can find 3 vert face data and 4 vert face data in the same face description list in an obj file, or at least I have encountered this before.

Most engines use their own formats to load meshes, and often this is just a straight dump of the vertex array in to a text or binary file so that runtime loading is extremely fast and no other operation than a straight forward memcpy are needed. Mesh loading and saving is a problem for which there is no standard way that is fast, for example Max and editing tools need to know about all information about a mesh, so material, shader, textures and meta data(vertex is connected to which edge, etc.), a game engine doesn't need to know about faces, edges and all kinds of other stuff that is stored in a model file. There for we write our own exporters and importers for the data we care about and make it load fast, one standard format doesn't cover all performances for all engines sadly.


Yep, this one is a big ugly problem(no universal format)... In Blender you can make all faces to consist of only 3 vertices. At least, it could be done in Blender 2.64. If I'm right, then an "triangular faces" -option is responsible for that.

#6 NightCreature83   Crossbones+   -  Reputation: 3032

Like
2Likes
Like

Posted 05 December 2012 - 06:12 PM


The OBJ format can actually have faces that consist of 4 verts or quads. A face can consist of only vertex data so the absence of texture coordinates or normals is just fine, it's just there is no way to light or texture that particular face. Face data can be combines in an OBJ file as well, you can find 3 vert face data and 4 vert face data in the same face description list in an obj file, or at least I have encountered this before.

Most engines use their own formats to load meshes, and often this is just a straight dump of the vertex array in to a text or binary file so that runtime loading is extremely fast and no other operation than a straight forward memcpy are needed. Mesh loading and saving is a problem for which there is no standard way that is fast, for example Max and editing tools need to know about all information about a mesh, so material, shader, textures and meta data(vertex is connected to which edge, etc.), a game engine doesn't need to know about faces, edges and all kinds of other stuff that is stored in a model file. There for we write our own exporters and importers for the data we care about and make it load fast, one standard format doesn't cover all performances for all engines sadly.


Yep, this one is a big ugly problem(no universal format)... In Blender you can make all faces to consist of only 3 vertices. At least, it could be done in Blender 2.64. If I'm right, then an "triangular faces" -option is responsible for that.

Yeah there was when I last check, it is also present in the Max export I think. If you forget to set this you can end up with some weird crashes in your OBJ loader as you are expecting 3 ints to follow an f put there is actually 3 of em. And if you only read 3 when 4 are specified your mesh will end up having holes when you render it.
Also as an aside OBJ is not the most efficient format either it stores a lot of combined vertex, texture coordinates and normals for the same vertex in space, this can lead to artifacts when you render the object and sometimes you need to combine this data into one vertex. The combining is a time consuming problem and increases with the complexity of the model sadly enough. Also you can't use this format if your model has animations in it as obj doesn't support animation frames in the data streams.

FBX is slightly better in this case although harder to figure out what's where in the model, even with the SDK it takes a fair amount of delving into documentation until you get at the data you are interested in. But because there is an SDK this format is actually better documented then the simple obj format, and allows animation and other options which OBJ doesn't.
Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, Mad Max

#7 Carver413   Members   -  Reputation: 157

Like
1Likes
Like

Posted 09 December 2012 - 04:29 PM

with blender you can create your own exporter. that way you can export what you want the way you want it.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS