Ab3d.PowerToys Beta 2 available

by abenedik 4. November 2009 00:23

The new version of Ab3d.PowerToys brings you even more useful classes and utilities for WPF 3D.

The sample application that comes with the library is again a very good demonstration of capabilities of the WPF 3D engine.

 

The main new part of the library is added support for creation of basic 3D objects and 3D lines.

Now the library contains all the essential parts that are needed with 3D WPF development:

  • advanced cameras
  • camera controllers
  • simplified mouse events handling on 3D objects (improved in beta 2)
  • basic 3D models (new in beta 2)
  • 3D lines (new in beta 2).

 

The following basic 3D objects can be created: Plane, Circle, Box, Pyramid, Sphere, Cone and Cylinder.

Advantages of the 3D models in Ab3d.PowerToys are:

  • The biggest list of supported 3D objects with lots of propertes for customization of objects.
  • Many different ways to create 3D objects: in XAML with Visual3D classes, in code with Model3DFactory class (to create GeometryModel3D objects) or in code with classes under Ab3d.Meshes namespace to create MeshGeometry3D objects.
  • Highly optimized code to make the creation as fast as possible.

Ab3d.PowerToys Samples - All 3D models

Ab3d.PowerToys Samples - All 3D models

 

3D lines can be created from code with Ab3d.Models.Line3DFactory. The methods in the Line3DFactory return 3D lines as GeometryModel3D objects. This means that you can add 3D lines to the existing Model3DGroup.

The lines can be also created as Visual3D objects with the following classes: LineVisual3D, MultiLineVisual3D, PolyLineVisual3D, AxisVisual3D, ColoredAxisVisual3D or WireGridVisual3D. The visuals can be used in XAML which means that you can see the results in Visual Studio designer.

There is also a Ab3d.Models.WireframeFactory to create wireframe objects from existing 3D models. WireframeFactory also contains methods to create lines for 3D model normals.

Because WPF does not natively support 3D Line, the line must be created with 3D model that consists of two triangles. The positions of the triangles depend on the position of the camera and size of Viewport3D. This means the code that draws the line must constantly check if the camera was changed, the parent Viewport3D or Visual3D is changed or the parent is not visible any more. This process can normally affect performance. The implementation in Ab3d.PowerToys library is designed in such a way that the performance impact is minimal. The code caches many properties and updates only those lines that need update. When the update is needed the new MeshGeometry3D is not rebuild from stretch but instead only positions are changed. It also checks if the lines were removed from the visual and acts accordingly. There are a few 3D lines implementation for WPF, but the highly optimized lines updater makes this implementation the most advanced.

Ab3d.PowerToys Samples - All 3D models

 

Important:

The Ab3d.PowerToys will be available as a standalone product.

It will also be available for free with Ab3d.Reader3ds Pro version (existing customers of Ab3d.Reader3ds Pro will also get the license).

 

Beta notice:

The current version of Ab3d.PowerToys is in Beta 2. That means that it is almost feature complete but is not yet fully tested and documented. This version will expire on 31th January 2010.

Roadmap:

  • Beta 2 - start of November 2009
  • Release Candidate - middle of November 2009
  • Release - start of December 2009

 

 

To read more about Ab3d.PowerToys see Ab3d.PowerToys web page.

The Ab3d.PowerToys Beta 2 and the samples can be downloaded from my Downloads page.

Tags: , , , , , , , ,

Ab3d.PowerToys

Ab3d.PowerToys beta 1 introduced

by abenedik 13. October 2009 23:13

The Ab3d.PowerToys library is a collection of classes and utilities that simplify programming with 3D in WPF. With Ab3d.PowerToys programming with 3D was never easier!

The following are the main parts of the library:

  • Cameras
  • Camera Controllers
  • Mouse Event Manager 3D

Ab3d.PowerToys Samples - Wind Generator sample

The library defines a few new Cameras that can be used instead of the current WPF's cameras. The main difference between Ab3d Cameras and WPF cameras is that Ab3d Cameras does not use Vectors to define the LookDirection, but instead use angles in degrees to define it. This is much more natural. For example if you want to look at the scene a little bit from the right and from above, you just define the Heading to be 30 and Attitude to be -45. You can also define the Distance from the scene. The most important Ab3d Cameras are: SceneCamera, FirstPersonCamera and ThirdPersonCamera. All the Ab3d Cameras with their properties can be seen on the class diagram.

Camera Controllers are used to control the camera. The MouseCameraController can be used to change the angle and distance of the camera with the mouse. This way it is very simple to rotate the camera around. The CameraControlPanel shows nice buttons to rotate the camera and move the camera closer or farther away. There is also a CameraPreviewPanel that graphically shows at which angle the camera is looking at the object or scene.

The following code demonstarates that with only a few lines of xaml a WPF application can use a camera that is showing the whole scene (SceneCamera) and can be rotated by the mouse (MouseCameraController) or by nice buttons (CameraControlPanel). There is also a preview of the camera that is showing from which angle the camera is looking at the scene. Also if the WindGeneratorModel model does not contain a light, a camera light is automatically added to the scene and it is iluminating the scene from the camera's position (ShowCameraLight="Auto").

<Window x:Class="Ab3d.PowerToys.Samples.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cameras="clr-namespace:Ab3d.Cameras;assembly=Ab3d.PowerToys"
xmlns:ab3d="clr-namespace:Ab3d.Controls;assembly=Ab3d.PowerToys">
  <Grid>
     <Viewport3D Name="MainViewport3D">
         <ModelVisual3D Content="{StaticResource WindGeneratorModel}"/>
     </Viewport3D>
     
     <cameras:SceneCamera Name="SceneCamera1"
                             Heading="30" 
                             Attitude="-30" 
                             Distance="3" IsDistancePercent="True"
                             IsDynamicTarget="True"
                             ShowCameraLight="Auto"/>
                          
     <ab3d:MouseCameraController TargetCameraName="SceneCamera1" 
                                    IsMouseWheelZoomEnabled="True"/>
                               
     <ab3d:CameraControlPanel TargetCameraName="SceneCamera1"
                                 VerticalAlignment="Bottom" 
                                 HorizontalAlignment="Left"/>
                              
     <ab3d:CameraPreviewPanel TargetCameraName="SceneCamera1" 
                                 Width="100" Height="100" 
                                 VerticalAlignment="Bottom" 
                                 HorizontalAlignment="Right"/>
  </Grid>
</Window>

 

The EventManager3D class is a helper class that enables user to simply subscribe to mouse events on 3D objects. The following mouse events are supported: MouseEnter, MouseLeave, MouseDown, MouseUp, MouseClick, BeginMouseDrag, MouseDrag, EndMouseDrag (MouseDoubleClick is not in available in beta). This way you do not need to do the complicated 3D hit testing any more. You can simply subscribe to mouse events. This way you the code is much simpler and better organized.

The following code shows a sample used of EventManager3D:

                    
EventSource3D eventSource;
EventManager3D eventManager;

eventManager = new EventManager3D(MainViewport);                                 


eventSource = new EventSource3D();
eventSource.TargetObject = myButton3D;
eventSource.MouseClick += new MouseButton3DEventHandler(myButton3D_MouseClick);

eventManager.RegisterEventSource3D(eventSource);                                 


eventSource = new EventSource3D();
eventSource.TargetObject = myMovableObject3D;
eventSource.BeginMouseDrag += new Mouse3DEventHandler(myMovableObject3D_BeginMouseDrag);
eventSource.MouseDrag += new MouseDrag3DEventHandler(myMovableObject3D_MouseDrag);
eventSource.EndMouseDrag += new Mouse3DEventHandler(myMovableObject3D_EndMouseDrag);

eventManager.RegisterEventSource3D(eventSource);                    

 

Beta notice:

The current version of Ab3d.PowerToys is in beta. That means that it is not yet features complete and not fully tested.

Roadmap:

  • Beta 1 - 13th October 2009
  • Beta 2 - end of October 2009
  • Release Candidate - middle of November 2009
  • Release - start of December 2009


The Ab3d.PowerToys beta 1 and the samples can be downloaded from my Downloads page.

Tags: , , , ,

Ab3d.PowerToys

Animated 3D Buttons Panel sample

by abenedik 21. January 2009 16:13

As promised I have published a source code for Animated 3D buttons that were used in previous version of Viewer3ds.

The sample shows how to create 3D buttons that are animated when mouse moves over them. Under the buttons there is a nice reflection of the buttons. The models for the buttons are defined in 3ds files and read with Ab3d.Reader3ds.

Animated 3D Buttons Panel sample

The sample is now part of the samples that come with Reader3ds installation.

It is also possible to download the sample alone from here (note that Ab3d.Reader3ds have to be installed on the system).

Tags: , , ,

Reader3ds

Ab3d.Reader3ds v5.2 has improved WPF Browser applications support

by abenedik 20. January 2009 19:34

The previous version or Ab3d.Reader3ds did not work with WPF Browser applications (XBAP). Because WPF Browser applications are running inside a partially trusted environment, the licensing code could not read the license or evaluation information. The new version overcomes this by embedding the information into the applications resources. To do this a license.licx file needs to be added to WPF Browser application's project and its build action should be set to Embedded resource (also for evaluation version).

This is the list of changes for v5.2:

  • Added support for using Ab3d.Reader3ds in WPF Browser applications (partially trusted).
  • Fixed problems with evaluation version with SmoothingGroups - sometimes "Index was out of range. Must be non-negative and less than the size of the collection." was thrown.
  • Fixed reading some 3ds files with animation - sometimes "System.OutOfMemoryException" was thrown.

For convenience I have also included samples for VS 2008 into the installer (besides VS 2008 solution).

WPF Browser application

The new version is available on https://www.ab4d.com/Downloads.aspx.

Tags: , , ,

Reader3ds

There is never enough testing!

by abenedik 1. January 2009 14:26

Everyone who has already tried the new version of Viewer3ds knows what I mean. The application just did not start!

During the final testing a wrong version of Viewer3ds "smuggled" into my installer project. Because I have already done extensive Viewer3ds testing, I did not test it again. What a mistake! The installer contained a version of Viewer3ds that required a wrong version of Reader3ds.

Luckily the new Viewer3ds has an error reporting system, so I could act quickly.

The fixed version is already available on https://www.ab4d.com/Viewer3ds.aspx. It was actually already available on 31th December 2008, but because of a New Year celebration I did not have time to write a message about it.

I must admit that the past few releases were not very good. Every release had some problems. I am already using a unit testing, but still there is place for error. I was also quite under pressure, because I have to release new versions for all the products before the previous version expired. With the releases still to come I will have more time for additional testing. So they should be less buggy.

The only thing left to say is:

Happy New Year 2009!

Tags: , , ,

Reader3ds

New version of Viewer3ds and Ab3d.Reader3ds available

by abenedik 27. December 2008 22:40

Finally my firstly published application, Viewer3ds, got a major update. The Ab3d.Reader3ds library was also updated.

The previous version of Viewer3ds was really old. More than 2 years old! The main problem with Viewer3ds was that it was using an embedded Ab3d.Reader3ds library for importing 3ds file. This meant that the updates of Ab3d.Reader3ds and many new features that were introduced did not have any effect on the Viewer3ds.

Viewer3ds

The new version of Viewer3ds does not have an embedded Reader3ds, so the currently available version is used.

The application now also supports many new features. For example:

  • The objects hierarchy is displayed in a tree view. It displays names of the objects that were defined in a 3D modeling applications. So when the exported xaml is used in your application, you can know which names to use to access the objects.
  • All the 3D objects can be renamed (or given a name if a name was not specified).
  • If the 3ds file contains an animation, it can be played with Viewer3ds. A selected frame can be exported to xaml.
  • It is possible to export only selected objects (besides exporting all objects).
  • Camera can be freely rotated around the read objects (select Free Camera in Cameras Panel).
  • Lights can be turned on and off. A camera light that shines in the direction of the camera can be added to the scene (in case the scene does not contain any light).
  • There are many options on how to load the 3ds file. For example it is possible to disable transparencies, control the shading of objects, etc.

As you have probably noticed from the screenshot above, the user interface is completely changed. It is now similar to ViewerSvg and Paste2Xaml. The process of user interface unification will eventually lead to a single application that could be used for all the supported file types. I also plan to include some great new features (but will not let you reveal my plans :)

Some of you will probably miss the 3D buttons that were used in the old Viewer3ds. No need to worry. I am going to prepare a sample with the same 3D buttons. It will be available with full source code so you could add the same functionality to your applications.

The Ab3d.Reader3ds library also had some improvements and bug fixes:

  • Fixed bug when reading spot lights.
  • Fixed Null reference exception when setting Default Material.
  • When applying smoothing groups or smooth shading, the texture coordinates are also remapped (before textures were not applied correctly).
  • Using new licensing model with improved evaluation. The new version has no fixed expiration date - instead library can be installed for a 60 days evaluation.

The new version is available from https://www.ab4d.com/Viewer3ds.aspx.

Tags: , , ,

Reader3ds

Commercial version of Ab3d.Reader3ds available

by abenedik 4. June 2008 17:00

As promised the commercial version of Ab3d.Reader3ds is available.

The purchase can be done on https://www.ab4d.com/Purchase.aspx.

As rss subscriber I give you 10% launch discount. Just enter "Reader3dsRss" as a discount code on the Purchase page.
The discount is valid only until the end of July 2008.

Tags: , , ,

Reader3ds