Helix/SharpDX/WPF few questions

Jul 26, 2014 at 10:47 PM
Hi everyone!

I'm looking for a 3D visualization library for WPF that provides a high-level API (at least higher-level than Vertex Buffers and shaders). I'm considering HelixToolkit.Wpf.SharpDX at the moment and absolutely impressed with what it does and how flawlessly it integrates with WPF/MVVM. I have 2 questions to clarify:
  1. As of today, is it possible to somehow disable antialiasing completely? I've checked the code and it looks like there's no way to configure it: there's logic that dynamically decides whether or not to enable it.
  2. I also see that there's a render loop - even if there are no changes to the scene, everything gets redrawn. Is it possible to somehow disable this behavior and instead trigger updates manually?
Aug 5, 2014 at 3:28 PM

Regarding 1:
In the current sharpdx version you can disable anti-aliasing by removing the conditional compilation symbol MSAA prior to compiling the code. This applies to the forward renderer, if you want to disable anti-aliasing for the deferred renderer remove the symbol DEFERRED_MSAA. You will find the symbols by right-click on the HelixToolkit.Wpf.SharpDX project->properies->build->general.

Regarding 2: this is a direct3d renderer, there is a render loop, which cannot be removed.
Aug 5, 2014 at 6:06 PM
p.1 - Yes, I've checked the code. Unfortunately, maintaining a custom set of binaries is not an option for me.
p.2 - Direct3D doesn't require a render loop. Even though it's a common approach in games (where things happen quite often), there's a bunch of scenarios when you only need to update the picture on demand.
Aug 7, 2014 at 1:28 PM
Well, I guess, I didn't made my point clear enough: this is a real-time rendering framework which is meant to work like a game as you said. There is no option to call the update manually, and such an option is not planned. However, basically you are right, one might trigger the update in D3D on demand. The framework uses D3DImage class to display the content, where the update frequency is bound to the CompositionTarget.Rendering event. You are free to modify it in order to fit your needs.
Aug 8, 2014 at 10:39 AM
I think the original idea was to create a solution that mimcs the WPF 3D scene graph as much as possible (supporting data binding and animations), but also making it possible to use shaders by SharpDX. Isn't the rendering loop just a shortcut we made to avoid keeping track of all changes and invalidating the model? I think it would be great if we could handle the invalidation and update only when the model has changed. Maybe a first step could be to add a flag to enable/disable the render loop and provide an Invalidate method? In that case the client application should be responsible for the invalidation.

Regarding the conditional compilation - can we get rid of this? Could it be possible to change the anti-aliasing at runtime?
Aug 8, 2014 at 6:09 PM
Edited Aug 8, 2014 at 6:10 PM
Render loop is indeed just a shortcut. The 2 options I can think of are:
  1. As objo said, just make it possible to disable automatic updates and provide a method to trigger updates manually.
  2. Keep render loop, but add extra logic to only have it running as long as there are view model updates. The easiest would be just to enable the loop when view model is updated and then keep it running for next N (=1) seconds. If there are more updates while loop is enabled, keep it running for N more seconds. Then, after first N seconds without view model updates, stop the loop.
I can barely imagine someone trying to build a game with Helix 3D. It's just not what Helix 3D is good at. Instead, it's AMAZING for things like lightweight WPF-based CAD. In my case, I have an app with about 30 pages where on each page I show a single static geometry. The 2 cases when I need to render the scene are when user wants to switch to another page (happens about once per minute) and when user moves the camera (like few 5-second manipulations per minute when I actually need a decent frame rate).