Category Archives: Silverlight

Balder 0.8.8.9 coming

Things are moving fast these days with Balder and I am closing in on the next release already. Keeping up with my target pace.

At this point these are the things already done or is in progress for the next release:

  • New Skybox, utilizing built in Silverlight perspective projection, which can be hardware accelerated
  • Perspective correct texture mapping – previous version had only affine texture mapping
  • Bilinear filtering for texture mapping
  • Performance boost for the entire rendering pipeline
  • Better, faster and more accurate lighting
  • Subpixel rendering
  • Vertex-shader like functionality for SIlverlight
  • Multiple “Games” in one page
  • Multiple textures during rendering
  • Semitransparent / alpha-channel support for texture mapping
  • Introducing a control for no-game centric applications; Content3D
  • A lot of bugfixing


Balder on Windows Phone 7

BalderOnWP7
After a couple of days of work – actually more like a couple of hours over a couple of days (sneaking away during vacation to feed my computer abstinence), I’ve managed to port Balder to Windows Phone 7, a couple of quirks needed to be fixed – like this one.

For now it uses the same software rendering engine as the Silverlight one. Needless to say, its not exactly the most optimal solution, but at least it proves that most of the code runs across both Silverlight and Windows Phone 7 without doing much to it.

The next goal is now to implement a fully hardware accelerated version of Balder for Windows Phone 7, using Xna.

Wish me luck. 🙂

 

Dynamically discovering assemblies and types on Windows Phone 7

The last few days I’ve been busy porting Balder to other platforms, amongst those; Windows Phone 7 Series. There are some nuances between the different platforms Balder will support, one of these for Windows Phone 7 was that the Load() method does not exist on an AssemblyPart from the deployment object.

Balder has a discover architecture were it discovers different types from the loaded assemblies, in the Silverlight version I could simply go and get all the AssemblyParts and get it as a resource stream and load them to get the actual Assembly instance. Since the Load() method didn’t exist I had to to look elsewhere.
Fortunately, the Assembly class in the Windows Phone 7 version of .net has an overload for the Load() method that takes a string. According to the MSDN documentation it needs to take a fully qualified assemblyname, that turned out to be difficult to acquire. But, it turns out that its sufficient to pass it the short name – this can be derived from the DLL name found in the AssemblyParts property called Source.

From the TypeDiscoverer code in Balder :

[code:c#]
private void CollectTypes()
{
if( null != Deployment.Current )
{
var parts = Deployment.Current.Parts;
foreach (var part in parts)
{
var assemblyName = part.Source.Replace(“.dll”, string.Empty);
var assembly = Assembly.Load(assemblyName);
var types = assembly.GetTypes();
_types.AddRange(types);
}
}
}
[/code]


Balder 0.8.8.7 out

I promised a release last month, but I had to do surgery and got a bit sidetracked with feeling sorry for myself being in pain. Anyhow, all is good and finally got the release out the door.

Its been almost 6 months since the last release. So this better be good. 🙂

The following are as complete a list I could compile of whats new and improved, btw. you’ll find the new release here. A new version of the SampleBrowser can be found here.

Performance improvements

  • Scanline renderers has improved quite a bit
  • Lighting calculations
  • NodesControl
  • Startup improvements
  • Content caching – loading the same content twice will only clone existing in cache
  • Color class – conversion plus operations are rewritten, introduced ColorAsFloats
  • Dependency properties now represented as Property with caching in it

Bugfixes

  • World matrix + general matrix fixups
  • NodesControl fixed, one can now nest these, plus a massive performance improvement during databinding using the ItemsSource.
  • Mouse events actually working – 0.8.8.6 had quite a few bugs with this, they are pixel perfect
  • PivotPoint fixed – working recursively
  • Completely rewritten rendering pipeline for stability, expandability and performance
  • Memory leaks in mouse event handling
  • Fixed Asset handling system – had a few bugs in it. Still has to revisit this.
  • Parsing of ASE files now use invariant culture all over the place. Had a couple of places it didn’t.

New features

  • Manipulation events on objects, implemented using mouse events.
  • They contain more detailed information about the object being manipulated, such as material information. Also, the events are not like the mouse events, they actually contain delta information about the manipulation occuring.
  • Tooltips, there is a property on all objects called Tooltip, you can create tooltips as you please, as you’d do with the TooltipService in Silverlight for other objects. The TooltipService will not work, hence the specialized property for it.
  • DirectionalLight – basic directional lighting
  • ViewLight – lighting that is “attached” to the camera/view
  • ArbitraryHeightMap – heightmap that can have its corners placed arbitrarily
  • SmoothingGroups implemented
  • New ASE parser – supporting multiple objects, world matrix. Also a lot faster.
  • Ring – geometry type
  • Started implementation of a ChamferBox – very basic at this point
  • Passive Rendering, will draw in wireframe during interaction and flip to full rendering when interaction has stopped. When no interaction, it will not render, Balder goes idle.
  • Pausing – for pausing everything.
  • Grabbing a frame from the Display can now be done
  • Container for renderable nodes – has its own world coordinate system that can be manipulated, lights can’t be placed in this container.
  • BubbledEvent system for events that needs to bubble up in the hierarchy
  • Messenger system for decoupling and stability
  • IGeometryDetailLevel – basically only used for Passive rendering at this point
  • Geometry artifacts such as Face, Vertex and so forth are now classes and has been generalized. Its now up to the implementing platform to create specialized versions of them.
  • Removed MEF and introduced a specialized TypeDiscoverer instead.

Development environment

  • Changed to Visual Studio 2010
  • Build server up and running with a more complete Balder.build file for continuous integration

Breaking changes

  • IGeometryContext does no longer hold the geometry data directly, introduced something called IGeometryDetailLevel. One can get the full detail level, which is the default (and only for now), by calling the method GetDetailLevel() on the IGeometryContext. In addition, any Geometry has a property called FullDetailLevel for convenience.
  • Mouse events has been specialized – they are named the same as one is used to from Silverlight, but the MouseEventArgs has been “duplicated” in Balder.Core.Input. The reason for this is that the Silverlight class for this is sealed and does not have a public constructor, and the mouse event handling needs to handled in a special manner in Balder. Also, the events are now bubbled as well through the geometry hierarchy.


Balder 0.8.8.7 out

I promised a release last month, but I had to do surgery and got a bit sidetracked with feeling sorry for myself being in pain. Anyhow, all is good and finally got the release out the door.

Its been almost 6 months since the last release. So this better be good. 🙂

The following are as complete a list I could compile of whats new and improved, btw. you’ll find the new release here. A new version of the SampleBrowser can be found here.

Performance improvements

  • Scanline renderers has improved quite a bit
  • Lighting calculations
  • NodesControl
  • Startup improvements
  • Content caching – loading the same content twice will only clone existing in cache
  • Color class – conversion plus operations are rewritten, introduced ColorAsFloats
  • Dependency properties now represented as Property with caching in it

Bugfixes

  • World matrix + general matrix fixups
  • NodesControl fixed, one can now nest these, plus a massive performance improvement during databinding using the ItemsSource.
  • Mouse events actually working – 0.8.8.6 had quite a few bugs with this, they are pixel perfect
  • PivotPoint fixed – working recursively
  • Completely rewritten rendering pipeline for stability, expandability and performance
  • Memory leaks in mouse event handling
  • Fixed Asset handling system – had a few bugs in it. Still has to revisit this.
  • Parsing of ASE files now use invariant culture all over the place. Had a couple of places it didn’t.

New features

  • Manipulation events on objects, implemented using mouse events.
  • They contain more detailed information about the object being manipulated, such as material information. Also, the events are not like the mouse events, they actually contain delta information about the manipulation occuring.
  • Tooltips, there is a property on all objects called Tooltip, you can create tooltips as you please, as you’d do with the TooltipService in Silverlight for other objects. The TooltipService will not work, hence the specialized property for it.
  • DirectionalLight – basic directional lighting
  • ViewLight – lighting that is “attached” to the camera/view
  • ArbitraryHeightMap – heightmap that can have its corners placed arbitrarily
  • SmoothingGroups implemented
  • New ASE parser – supporting multiple objects, world matrix. Also a lot faster.
  • Ring – geometry type
  • Started implementation of a ChamferBox – very basic at this point
  • Passive Rendering, will draw in wireframe during interaction and flip to full rendering when interaction has stopped. When no interaction, it will not render, Balder goes idle.
  • Pausing – for pausing everything.
  • Grabbing a frame from the Display can now be done
  • Container for renderable nodes – has its own world coordinate system that can be manipulated, lights can’t be placed in this container.
  • BubbledEvent system for events that needs to bubble up in the hierarchy
  • Messenger system for decoupling and stability
  • IGeometryDetailLevel – basically only used for Passive rendering at this point
  • Geometry artifacts such as Face, Vertex and so forth are now classes and has been generalized. Its now up to the implementing platform to create specialized versions of them.
  • Removed MEF and introduced a specialized TypeDiscoverer instead.

Development environment

  • Changed to Visual Studio 2010
  • Build server up and running with a more complete Balder.build file for continuous integration

Breaking changes

  • IGeometryContext does no longer hold the geometry data directly, introduced something called IGeometryDetailLevel. One can get the full detail level, which is the default (and only for now), by calling the method GetDetailLevel() on the IGeometryContext. In addition, any Geometry has a property called FullDetailLevel for convenience.
  • Mouse events has been specialized – they are named the same as one is used to from Silverlight, but the MouseEventArgs has been “duplicated” in Balder.Core.Input. The reason for this is that the Silverlight class for this is sealed and does not have a public constructor, and the mouse event handling needs to handled in a special manner in Balder. Also, the events are now bubbled as well through the geometry hierarchy.


Balder – Upcoming release

Its been some 4 months since the last official binary drop of Balder and its just about time to get a new version out. The reason for the "hold up" is that I've been quite busy with working 2 jobs; my daytime job and Balder related freelance work at night. Combining that with having a family of 2 kids and a wife, there simply hasn't been any time left get binaries out there. 

But, as part of the work that I've been doing freelance, Balder has gotten a lot of improvements. Among these are the following : 

– Further optimizations in the rendering pipeline

– Rewritten NodesControl, speed up and more capable

– General cleanups

– More Xml comments for documentation purposes

– Retrofitted some unittests

– Mouse events working properly

– Tooltip for Nodes

– Arbitrary Heightmap – corners of heightmap can be placed anywhere

– New AseLoader with more support than before (Smoothings groups, more objects, more material details, colors++)

– Rewritten AssetLoader system

– Fixed bugs with primitives

– More samples in SampleBrowser

– Visual Studio 2010 solution + project files

– Optimized lighting

– Added ViewLight – lighting relative to view, basically directional lighting

– Passive Rendering, making the rendering halt unless properties are changed on any object in the scene

– Content caching for faster startups

– A lot of code cleanups for decoupling the platform even more

– Material detection for mouse events 

 

And a whole bunch of other improvements.

The only thing left before a release can be done is to tie together some lose ends and fix a couple of bugs – then its ready for deployment. I'll be sure to post about all the new features and how they can be used in a post when the release is ready.

The next iteration will focus more on increasing code quality, more cleanups, get more documentation up and running, continuous integration server up and running and things that will improve further development on the project. 

4 hours optimizing later…

After just 4 hours of dedicated optimizations with the aid of the EQATEC profiler for Silverlight – I managed to speed up the rendering pipeline of Balder quite dramatically. The profiler has a great comparison feature – simple and straight to the point. It shows that the rendering pipeline for Balder got optimized at an average og 2.28 times. (RenderingManagerRender) :

Comparison

First go with the EQATEC Silverlight Profiler

Its been a little more than 24 hours since I started playing with the EQATEC profiler and have identified bottlenecks in Balder that is close to impossible to discover without a profiler. One of things I really liked about the EQATEC profiler was its really easy to use user interface, its super-intuitive and I got up and running in seconds and could drill down straight to the bottlenecks just as fast. What impresses me with the profiler is the speed of it, I've worked with quite a few profilers in the past for the desktop – and they have always surprised me in a negative way with the amount of memory they use and not to mention the enourmous datafiles they generate. EQATECs just feels right, kudos to Richard Flamsholt and his team in Denmark for this product. You can download a free/personal license from here.

I thought I just give a quick guide into how its used.

The profiler is not integrated in Visual Studio and does not need to instrument your assemblies during compiletime, it works on the binary output of your compiled output. After starting the profiler, you need to point the profiler to your output directory in which the binaries for your application resides, typically the bindebug directory in your Visual Studio project folder. Click the browse button as shown below:

The first time you run it and if you have 3rd party assemblies that are signed you'll be asked to include or exclude these – the default recommendation is to exclude these. There is a resigning option included as well, but I didn't need this so I just skipped them. After it completes gathering your assemblies and recognizes the Silverlight app by finding the testpage and everything, you can go ahead and click the Build button in the lower right corner. It will instrument your binaries and add hooks for all your methods.

Then you just simply click the "Run App" button and your application will start and performance samples will be collected. You now need to play around in your application for the profiler to get enough data to play with.

After stopping your application, you'll be presented with the sample output with details of when it was profiled, its size and total time it ran.

Double click the session you want to view (if you have more than one) and you can start to drill into method calls with the summary sitting on top and a more visualized version of the method with drilldown capabilities at the bottom.

 

 Simple drill down and you'll see the amount of time spent in every method you drill down into:

 

And further: 

 

 

This is by far, in my oppinion, the best tool that has been released since Silverlight was released. It completes the developer experience and finally we can really show the full potential of Silverlight and the power the CLR actually gives us.

Thanks again to EQATEC for the donation to Balder – we will certainly make use of the license and optimize as close as we can to clock-cycles. 🙂 

 

 

EQATEC donates profiler license to the Balder project

One of the things that has been missing in the Silverlight development story is a proper profiler that is simple to use and does not require you to hack the registry or do complex command line hacks to get it working. The Danish company called EQATEC has been making profilers for a while for the compact framework, but now they have implemented a Silverlight version that I must say I'm really impressed with. EQATEC has donated a professional license to the Balder project and I have already started using it, and my findings are very interesting. I've found more bottlenecks the last 24 hours than I have during the entire course of the project without a profiler. So I'm expecting Balder to get even more speedier in the near future.

If you want to have a look at how the profiler works, Channel 9 has a great video on it here.

 

Balder 0.8.8.6 is out

UPDATE 8th of July 2010 : 0.8.8.7 is out – read more here.

Finally after a couple of months of hard work and polishing the code, API and performance, version 0.8.8.6 ofBalderis out. A SampleBrowser can be found here for viewing most of the features ofBalder.
The features that has changed or is new are as follows:

* Introduced Silverlight in Core, but still maintaining platform independence
– Using core objects directly in Xaml can now be done

* Removed all controls in Balder.Core.Silverlight.Controls – not needed anymore

* Introduced View namespace with IView interface and Camera implementing it

* Viewport has View property insted of Camera

* Moved rendering from a multithread environment to run synchronously on the CompositionTarget. It gives better performance, due to synchronization issues between all threads. Will be revisited in the future.

* New drawing routines, optimized

* Heightmap primitive

* Box primitive

* Rotation, Scale on nodes

* Cylinder primitive

* DebugLevel is known as DebugInfo

* Material system in place

* Support for ReflectionMapping on materials

* Double sided materials

* Sprite rendering with alpha channel

* NodesControl – datadriven nodes control with templating – In Balder.Silverlight.Controls

* NodesStack – datadriven stacking of nodes with templating – in Balder.Silverlight.Controls