Does Balder support the same features as WPF 3D API

Aug 3, 2010 at 3:11 PM
Edited Aug 3, 2010 at 3:13 PM

Hi author,

First I'll say it is a very promising project, thanks for creating it.

I'm familiar with WPF 3D API and I'm looking for a silverlight replacement.

I've tried the Kit3D, but it is obviously lack of some important features and has some strange bugs when I ported a very simple WPF 3D app.

I'm not looking into Balder deeply, I just tried your samples and skim your tutorials.

I feel Balder has more features than WPF 3D API but I'm not sure whether it support all features provided by WPF 3D.

And How difficult to port a WPF 3D app to Balder? Is it suitable to use Balder to develop a business application, not a game?

Could you give me your opinion on this topic?

Best wishes,
Oliver

Coordinator
Aug 3, 2010 at 8:12 PM
Edited Aug 3, 2010 at 8:14 PM
Hi and thanks, I'm not too familiar with WPFs 3d features, it would be easier if you specify what you're looking for and I can say wether or not Balder supports it or it would be something that could be implemented. Balder is not necessarily targeting Games. In fact I've was hired for a few months earlier this year implementing Balder in a business app. I've been thinking more and more about creating more features such as charting, as I think there are quite a few usages for realtime 3D charting. As for porting a WPF app to use Balder, I'm not sure how much work is involved. One thing to mention is that I am planning on making a WPF version, but probably use XNA under the hood for the rendering, as I've heard quite a few mention performance issues with the WPF 3D API. Hope this helps and please let me know what you're looking for. Cheers, Einar (sorry about lack of formatting here - my iPhone is apparently ruining the postback)
Aug 4, 2010 at 2:11 PM

Hi Author,

Thanks for your quick reply.

I've taken a lot time today to play with Blader.

I download the 0.8.8.8 source code and compile the samples.

Today I mainly focus on the primitives with different lights, materials and transformations. 

It is really amazing to see the well designed API compared to WPF 3d.

Since the documentation is not completed, I've to debug into the Balder source code to figure out how it works, but I've to give you a big thumb up for you coding style and design.

Currently I found a serious bug in the samples (pretty much in _materialSet variable in Geometry class somehow doesn't get updated as it should be).

The reproduce steps is as follows:

Open the sample browser, switch to "Primitives->Ring", you will see the ring is in "Blue" although it has a OmniLight in the scene. I figured it out maybe we need give the Ring some materials.
So I add something like this:

<Geometries:Ring.Material>
     <Material:Material Shade="Gouraud"/>
</Geometries:Ring.Material>

And I can see the correct color anyway. But if I changed any property by using the slider on the UI, it will become blue again. It looks like it lost the material.

Another bug I found is in the "PieChart" example. If I clicked Add value, the only one pie slice will be shown, other slices disappeared somehow.

Hopefully it helps.



Coordinator
Aug 4, 2010 at 4:12 PM
Edited Aug 4, 2010 at 5:17 PM

Thanks for the kind words, glad you liked it and thanks for debugging and reporting the bug.

I fixed this bug earlier today, as I noticed it myself. It was introduced in 0.8.8.8 but is fixed in the current repository.

 

Let me know if there are things you're missing. I really want to have more features in it, and make it helpful for people to use it.

 

Also worth mentioning, in the latest source code, a few other bugs has been fixed as well. I had quite the embarrassing bug with regards to projecting the 3D coordinates to screen coordinates, which caused the display to be wrong - in fact everything was scaled to twice its size and camera positions seemed off. Now its corrected. I've also optimized quite a few things, especially the rendering pipeline in the latest source. And have a few optimization tricks still up my sleeve. :) 

Aug 5, 2010 at 3:31 AM
Edited Aug 5, 2010 at 10:06 AM

Thanks for fixing the "critical bug", after downloading the latest code, right now the pie chart can work well and the viewport looks good, the dimension will be half as the previous I think it should be expected, right?

But the material is still lost, please copy the following code into Ring sample, and try to move the slider on UI, you should be able to see the difference.

 

<Execution:Game Width="640" Height="480">
			<Execution:Game.DebugInfo>
				<Debug:DebugInfo ShowVertices="False"/>
			</Execution:Game.DebugInfo>
			
			<Execution:Game.Camera>
				<View:Camera Position="0,50,-150" Target="0,0,0"/>
			</Execution:Game.Camera>

            <Lighting:OmniLight Position="-100,100,0" />

            <Geometries:Ring x:Name="Ring" 
							 InnerRadius="10" 
							 OuterRadius="30"
							 Size="20">
                <Geometries:Ring.Material>
                    <Material:Material Diffuse="Blue" Specular="Red" Shade="Gouraud"/>
                </Geometries:Ring.Material>
            </Geometries:Ring>
        </Execution:Game>

 

As far as missing features compared to WPF 3D I concerned, it should be the design time support.

Right now, although Balder can make declarative programming like WPF 3D, but in the design window you see nothing, you have to compile and run the program to see the result. It's not very convenient to adjust the camera, light, material...

And two more questions:
It looks like Balder doesn't support Anti-alias rendering. Is it possible to support anti-alias in the future?

Is there a way to know the scene has been rendered since my latest change to the scene (assume there's no animation running)? The reason why I ask this question is right now even there's no change in the scene and no animation running, the rendering thread is still running and consume a lot of CPU.

Coordinator
Aug 5, 2010 at 12:47 PM

Thanks for finding that bug, I wasn't aware .

I'll look into the Material problem. I'm working on refactoring the Material system, so that will fit perfectly into my schedule.

Design time support for VS2010 and Blend is something I really want to get in there. Just got to wrap my head around how the designer works properly.

 

Anti-aliasing - I did some testing earlier, and the simplest anti-aliasing that can be done is to render to a larger surface and transform its size down and let the Silverlight runtime scale with filtering. You can actually just do that now, just set the Width + Height to larger (say 2x) and put a Transform on the Game that says 0.5.

 

As for the CPU load - I've been working on something called PassiveRendering which makes it only render if there are changes. It is not fully functional yet, but there is already a property on the Game called PassiveRendering and PassiveRenderingMode where you can specify the rendering type that will occur between full-frames when it actually renders.

Aug 7, 2010 at 7:34 AM
adept wrote:

Thanks for finding that bug, I wasn't aware .

I'll look into the Material problem. I'm working on refactoring the Material system, so that will fit perfectly into my schedule.

Design time support for VS2010 and Blend is something I really want to get in there. Just got to wrap my head around how the designer works properly.

[ozhou] Glad to hear that it's on your list.

Anti-aliasing - I did some testing earlier, and the simplest anti-aliasing that can be done is to render to a larger surface and transform its size down and let the Silverlight runtime scale with filtering. You can actually just do that now, just set the Width + Height to larger (say 2x) and put a Transform on the Game that says 0.5.

[ozhou] I tried it, looks great, thanks!

As for the CPU load - I've been working on something called PassiveRendering which makes it only render if there are changes. It is not fully functional yet, but there is already a property on the Game called PassiveRendering and PassiveRenderingMode where you can specify the rendering type that will occur between full-frames when it actually renders.

[ozhou] Sounds great! But I failed to make it work, anyway, it's important for a business app because unlike a game, usually the scene is static, not changed frequently.

Another thing I found Blader is missing is currently there is only ONE "Game" element in the visual tree at one time. That's not a problem for a game but it is a big problem for business application.

Since a typical business application usually only embed a few 3D elements in it, most of other thing are still 2D elements. In WPF 3d, Viewport3D is a FrameworkElement which can be placed in any layout container. In Balder, Game inherited from Grid plays the same role. However, when I add two Game elements into a grid, the application crash, in the debugger, somehow the second game Game elements can not get a viewport to render.

BTW, I am developing a Dashboard silverlight application which requires embedding some 3D rendered chart, in general I think Passive Rendering and Multiple Game elements in the visual tree are pretty critical features for Blader to be popular in the business application.

What do you think, Einar?

 

Coordinator
Aug 7, 2010 at 9:08 AM
Edited Aug 7, 2010 at 9:09 AM

Definitely, the multiple Games in one VisualTree was something that was supported before - with business apps in mind. 

On Monday I will start fixing the PassiveRendering - as I've done a lot of the thinks I had scheduled. And can probably fit into the schedule for next week doing the multiple Games in the VisualTree. Btw: I want to subclass the Game introducing a type that Business app developers won't be intimidated by - any idea for a good name?  I'm not sure, but I think some business app developers will think that having "Game" in their Xaml seems just off. Also, the "business app container" could set the PassiveRendering to true by default.

Also what I'll see if I can fit into the schedule for next week is the design-time support - at least make it render what you have in your Xaml, and also use the PassiveRendering explicitly when in design-mode. This is also something I find crucial. 

Coordinator
Aug 7, 2010 at 9:10 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Aug 8, 2010 at 1:26 PM

Thanks, Eniar.

It sounds very promising.

In terms of the name, I have to admit when I first saw the "Game", I am also confused, it gave me a feeling that I can have only one "Game" instance which represent the whole app. That's obviously not the case.

Maybe you can name it "3DContentControl/3DContentHost", since English is not my first language, I am not very good at "naming" staff-:)

Coordinator
Aug 8, 2010 at 6:07 PM

Something with Content sounds right. Content3D maybe, or similar.  Thanks for the input. 

 

Coordinator
Aug 9, 2010 at 8:09 AM

Passive rendering has been fixed - in fact it worked, I just had a wrong dependency injected into one of the classes. 

Its in the latest source code now.

Aug 9, 2010 at 1:16 PM
adept wrote:

Passive rendering has been fixed - in fact it worked, I just had a wrong dependency injected into one of the classes. 

Its in the latest source code now.

Work perfectly. Congratulations! One question, what's the meaning of "PassiveRenderingMode"? How to use it?

Now I'm looking forward to the multiple Game instance support-:)

Coordinator
Aug 9, 2010 at 1:21 PM

:)  Excellent. Glad to hear. 

The purpose of the PassiveRenderingMode is to tell which rendering quality to use in the "in-between" frames if one is manipulating properties that causes rendering. 
For instance, you could set it to BoundingBox and whenever something was changing, it would render using BoundingBoxes and when the changes was done - settled, it will go to full detail rendering.

Working on quite a few things this week - simplifying things, eventually I'll get to the multiple Game instance thingy.

Coordinator
Aug 12, 2010 at 6:20 AM

Multiple Games are now supported. :) 

In the repository now.

 

Also worth mentioning, in Blend the designer kinda works - at least for basic stuff. Doesn't work in VS2010 - which is a bit of a puzzle to me.

Aug 12, 2010 at 9:01 AM

Sync with the latest tip.

Multiple game support and InteractionEnabled are pretty cool features mostly for business app.-:)

Try with multiple game support. It looks perfectly if passiveRendering isn't turned on.

If the passiveRendering is turned on, the second game will be disappeared, and the InteractionEnabled doesn't work either even for the first game.

Hopefully it can be fixed easily.

Coordinator
Aug 12, 2010 at 10:55 AM

Thanks for testing and pointing this out. 

I forgot something that is critical for the PassiveRendering support - the Properties that cause the rendering signals the renderer to do its job - but its actually signaling to nowhere now.

I'm looking into it, as it actually breaks PassiveRendering completely. 

Coordinator
Aug 12, 2010 at 1:11 PM

And there we have it. :) 

Phew - that was a mind-bender. 

Property<> used for runtime properties now recognizes the RuntimeContext in which they are belonging to and passes along a signal whenver a property changes, causing the Scene to be re-rendered.

 

Works with multiple games - CPU settles down to 0% whenever nothing is moving or interacted with.