This topic is 1698 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I come across this beautiful chain, while trying to update SharpDX's code, for model animation, problem arose from inconsistency in model formats.

3D applications internal workings ->

->AssimpNET implementation->

->SharpDX toolkit model processor, that converts Assimp format to SharpDX specific binary->

->SharpDX code that reads that binary at runtime->

->The application that uses that and, for example, displays the model.

7 whole steps, where something can go wrong.

Its a nightmare, let me tell you. Now, imagine that model you are loading, does not display correctly, where the problem lies?

Is there a bug in 3D application and its not exporting something correctly?

Is there a bug in OpenCOLLADA implementation?

Is there a bug in Assimp?

Is there a bug in AssimpNET?

Is there a bug in SharpDX assimp to binary conversion?

Is there a bug in SharpDX binary to runtime conversion?

Is there a bug display/rendering code?

So then you find it.

Then you load different model, or the same model with different model format...aaand you got something displaying incorrectly and round you go. You see where I'm getting at.

So while I'm thinking that I started to wonder - is there any data formats/ techniques, where you can get something like what you would call "intermediate runtime data format"? Something like .NET's msil that can be used to compile for different processors, but describing some memory data structure for different languages instead of processors?

I would imagine it work something like code and similar to XML+XML scheme. I would have something like XML scheme, that describes the constraints, but also includes support for references and typed data structures, I would have a language specific runtime type/class code generator, that makes runtime code/class from scheme. Then, given *ANY* scheme, any file that is written alongside this whole thing, and a file, that is a running instance of that scheme, I would just need to do 2 steps, that would not change for ANY model (or anything, for that matter) format, written in this way.

1. Generate language specific object/parser/whatever from any given scheme. Input universal scheme file -> Output code file containing language specific implementation of that scheme.

2. Initialize that object in runtime in trivial manner such as loading it from disk using common Load method (interface) available in all schemes.

Is there something like that? Discuss.

EDIT: So I found this http://en.wikipedia.org/wiki/Protocol_Buffers, Google inc. beat me to it. Just have to dig in deeper and find out is it supporting all the necessities.

Edited by Shuuny

##### Share on other sites

So I'm confused by what you mean by updating SharpDX. The current released version should already have animation support. Are you modifying that? Or adding your own animation support? And what do you mean by displaying incorrectly? It may be something simple if more information is provided.

I would bet money that its the exporter or Assimp's collada importer (not unheard of). Certainly can't be AssimpNet (kidding...kidding!). Potentially, given to how the data is constructed, some post-processing flags need to be set that SharpDX isn't setting.

So while I'm thinking that I started to wonder - is there any data formats/ techniques, where you can get something like what you would call "intermediate runtime data format"? Something like .NET's msil that can be used to compile for different processors, but describing some memory data structure for different languages instead of processors?

I would imagine it work something like code and similar to XML+XML scheme. I would have something like XML scheme, that describes the constraints, but also includes support for references and typed data structures, I would have a language specific runtime type/class code generator, that makes runtime code/class from scheme. Then, given *ANY* scheme, any file that is written alongside this whole thing, and a file, that is a running instance of that scheme, I would just need to do 2 steps, that would not change for ANY model (or anything, for that matter) format, written in this way.

1. Generate language specific object/parser/whatever from any given scheme. Input universal scheme file -> Output code file containing language specific implementation of that scheme.

2. Initialize that object in runtime in trivial manner such as loading it from disk using common Load method (interface) available in all schemes.

Interesting, although I think you're basically describing (yet another) model format like collada and an overly generalized run-time component that people may find unusable if they want to do stray off the beaten path and do their own thing (often the problem with frameworks that "do everything" for you). Format's are only going to be as strong/useful as the importers/exporters that are available, and just because they are claimed to be interchange doesn't make it a standard by any means. And you're basically proposing a runtime component a la Assimp (which I'm sure exist out there), I could imagine a C-API that can be hooked into by different consumers...but I just have to ask, why? One size doesn't always fit all.

Content pipelines are inherently difficult, large parts of it can be generalized and componentized such as Assimp, but my opinion is once you're crossing into something very application specific (in the sense, it's specific to *your* application), trying to framework it or standardize it to be consumed by others is most likely going to turn out to be half baked for all parties. SharpDX's runtime model stuff is analogous to XNA's, it's a great generalization that can get the majority of users going and happy, but it's certainly not a catch-all nor was ever intended.

Edited by Starnick

##### Share on other sites

So I'm confused by what you mean by updating SharpDX. The current released version should already have animation support.

No it does not. No animation channels are imported on live version, neither are skin bones or anything alike.

I would bet money that its the exporter or Assimp's collada importer (not unheard of).

Its incorrect handling of colladas "bind_shape_matrix" in skin controller (not to be confused with bone bind pose matrices). So Assimp's collada importer it is. But heck, even 3ds max cant correctly import dae model exported by itself, hilarious.

(not unheard of).

What else? (shiver)

Interesting, although I think you're basically describing (yet another) model format like collada and an overly generalized run-time component that people may find unusable if they want to do stray off the beaten path and do their own thing (often the problem with frameworks that "do everything" for you). Format's are only going to be as strong/useful as the importers/exporters that are available, and just because they are claimed to be interchange doesn't make it a standard by any means.

I don't think you quite got the whole idea about that. I'm suggesting creating programming language, that describes data and data bindings and comes with a compiler, that generates data access code for a programming language.

So first, there would be the language and a sort of scheme/map created by it. Lets assume very simple case - we want to store 10 integers in a file and a name and optional double value. So I would write something like this:

//Data descriptor language

{
required integer(signed, size_32), array(size=10, require_all_elements) called "SomeIntegers"
required string(UTF-16) called "Name"

optional float(signed, size_64, default=0.0) called "JustADouble"
}



Then I would call something called something like "CSHARP Code Generator for UberScheme" and got myself as output a file called something like DataDescriptor.SimpleMessage.cs, containing code something like this:

//AUTO GENERATED DO NOT CHANGE
//UBERSCHEME VERSION 0.0000001
sing System;
using UberScheme.Import;
using UberScheme.Export;

[UberschemeRootMessage]
class SimpleMessage : IUberSchemeInterface
{
int[] SomeIntegers;
string Name;

{
bla
}

UberSchemeInterface.Write(object message)
{
var simpleMessage = message as SimpleMessage;
write...
}


Created the scheme  and generated code once (per language I'm using), I can initialize a C# object called  SimpleMessage, and write and read to it using simple Read/Write methods and then use resulting class object for whatever I want. Something like this (this would be what end user could see):

using System;
using UberScheme;

namespace TestProj01
{
{

//display
..
}
}

Edited by Shuuny

##### Share on other sites

Actually the problem is not in the binary definition of data but lies into data filtering/transformations and semantic/organizational changes performed by each application/libraries.

Having a common binary language would just help a little in this case. Because you will still have datas organized/interpreted differently, stripped down between a big blob collada file and an optimized file suitable for loading at runtime. Data transformation is not an easy topic, well... its even the whole purpose of a program! ;)

Things as simple as bones matrices can sometimes be interpreted/organized differently, handiness is often a concern between applications. A supposedly common format like FBX is quite a challenge to master with its handling (not-always-documented or not documented at all) of matrices/skeleton/skinning/channels/animations/handiness...etc,  Add to this a bit of salt, like Maya or 3DS are exporting things differently to this format...etc

1. 1
2. 2
frob
15
3. 3
4. 4
Rutin
12
5. 5

• 13
• 12
• 58
• 14
• 15
• ### Forum Statistics

• Total Topics
632120
• Total Posts
3004220

×