Loading, modifying and animating models

Jun 17, 2010 at 11:28 AM
Edited Jun 17, 2010 at 11:31 AM
Hello, For all the contributors, congratulations for your great work. I've tried some of the samples provided and tried to understand the programming model for Balder. It is clear that Balder is suitable for creating 3D scenes with pre-loaded models. My questions are:

> Can I create a 3D model only with geometric information, provided by a collection of 3D points and a collection of triangle indices ?
> If so, can this model be loaded to the application on some startup event ? For example, I have a model on some txt or xml file with organized geometric data. Can I take this values on the startup and build the model for presentation?
> With the model loaded into some data structure, can I modify vertex information, i.e take vertex 180 and assign a new position for this vertex. Can I animate vertices individually over some kind of timeline?

Those questions are important for me, since my project relies on some of this issues.
Thanks in advance,

Best regards
Jun 17, 2010 at 1:52 PM
Edited Jun 17, 2010 at 1:53 PM


There are programatic ways of generating what you need, but possibly the easiest way for now is to create a class that inherits from Balder.Core.Objects.Geometry. In there you can access a property called FullDetailLevel, it has a bunch of methods on it for generating the geometry data. You can also manipulate the data realtime after that.

The object you then create can be added directly into the Xaml of your page (inside a Game tag). If you look at the implementation of the Box, which is the simplest primitive, you can see how it uses all the features of the IGeometryDetailLevel interface that the FullDetailLevel property is representing.

Hope that helps.

Jun 17, 2010 at 3:10 PM

Thanks for the quick reply!

But then, if the model is added to the Xaml, how could I load it on the runtime, or how could i fetch geometry data from a file ?

    The class I must inherit is Balder.Core.Objects.Geometries.Geometry, right ? I can't see the FullDetailLevel property. How can I generate geometric data? Is it with GeometricContext.SetVertex, etc?




Jun 17, 2010 at 6:46 PM

Ahh.. Sorry, you're probably using the binaries from the release, if you download the entire source of Balder and compile it using the SampleBrowser.sln (VS2010), you'll get the latest version which has the FullDetailLevel property. If you don't want to do that, you will have to use the GeometryContext property instead, it exposes the same functionality - it has just been moved and improved a bit in the latest version.

With that object you would create, you could expose methods for loading things, after you had parsed whatever you needed parsing and put into the GeometryContext/DetailLevel, it will render it.

Jun 22, 2010 at 3:04 PM
Edited Jun 22, 2010 at 3:20 PM


So, I have to build a class, which derives from Geometry, and then it has a method, Load which can take for example an XML file. With this XML I would specify (X, Y, Z) coordinates, triangles, texture image, etc. I don't know how I can do this yet. I'm still used to WPF3D model :(

 Wouldn't be easier to implement my own format loader, as XLoader, AseLoader etc ?

Jun 22, 2010 at 3:58 PM

Sure, if you implement your own AssetLoader you'll be able to load it. But for now, loading is limited to things included in the XAP as resources. So you won't be able to read from anywhere.