Ab3d.PowerToys V1.0 released

by abenedik 21. December 2009 09:17

I am happy to announce that the final version of Ab3d.PowerToys has been released.

Ab3d.PowerToys is the ultimate helper library for work with WPF 3D.

The main parts of the library are:

  • Cameras (SceneCamera, FirstPersonCamera, ThirdPersonCamera, etc.),
  • Camera Controllers (MouseCameraController, CameraControlPanel),
  • 3D Models and Visuals (Sphere, Box, Cylinder, etc.),
  • 3D Lines,
  • Event Manager 3D (simplified event handling on 3D objects).

The created 3D objects and used 3D cameras are fully visible in Visual Studio Designer.
This means that the 3D scene can be very easily designed in Visual Studio.

With Ab3d.PowerToys programming with 3D cannot be easier!

Ab3d.PowerToys - All 3D models in Visual Studio Designer

 

The following is the list of improvements from the Release Candidate version:

  • Added public Model property as Model3D to all 3D UIElements,
  • CenterObject on ThirdPersonCamera now accepts object type instead of Model3D - so it is now possible to assign Visual3D and UIElement3D as center object,
  • Transformed the CurrentSurfaceHitPoint on MouseDrag3DEventArgs when used on Visual3D objects - now the real hit Point3D is get,
  • Fixed EventManager3D when there were no drag surface registered but there were some event sources subscribed to drag event,
  • Added HitObjectName and HitObject to BaseMouse3DEventArgs,
  • Added additional comments and code samples to help file.

 

There are also a few new samples.

Two new samples show the power of EventManager3D. One show how easy is to create a 3D object that is moved around with the mouse. The other sample shows how to use EventManager3D with Ab3d.Reader3ds library. The sample is similar to Robot Arm sample in Reader3ds samples. But instead of using sliders to move the robot, this sample utilizes the powerful EventManger3D so the robot can be moved around simply by dragging the mouse. Also the light can be switched on and off by clicking on it.

The most interesting new sample is the 3D Cannon simulation. It shows a 3D simulation of a cannon where user can set many parameters like Gravity, Drag factor, ball mass, etc. It is also possible to switch between many possible cameras. The following image shows the sample in action:

Ab3d.PowerToys - Cannon simulation

 

The 60-days evaluation of Ab3d.PowerToys can be downloaded from Downloads page.

The price for Ab3d.PowerToys license starts from $179.00 (very low price for the amount of work-hours saved). It is also possible to buy full source code for the library.

And that is not all. When a Ab3d.Reader3ds Pro license is bought, the Ab3d.PowerToys license is get for free!

And that is still not all - see the next blog post that is coming very soon Smile

Tags: , ,

Ab3d.PowerToys

Preview the 3D objects from 3ds files in Visual Studio Designer

by abenedik 3. December 2009 23:03

Did you guess it?

A new version of Ab3d.Reader3ds is available!

And it adds great support for showing 3D objects from 3ds file with using only XAML.

By the way, for those who do not know what 3ds is: 3ds is the most commonly used file format for storing 3D content. And Ab3d.Reader3ds is the library that enables you to bring all the 3D models stored in 3ds into the WPF's 3D world.

There are also some other improvements, but let me firstly show you the new XAML support. The following image shows one example of what is possible now:

Viewport3ds in Visual Studio Designer

The image shows that with only one control it is now possible to show 3D models from 3ds file. And it is also possible to see the preview in Visual Studio Designer.

The above code shows the 80th frame of the animation stored in "ab3d drop down.3ds" file. If you would like to play the animation the following can be used:

<controls3ds:Viewport3ds Source="ab3d drop down.3DS"
                         IsAnimated="True"
                         AutoRepeat="True"
                         AnimationDuration="0:0:10"/>

So you only need to set the IsAnimated property to true and the animation stored in 3ds file will be played automatically. It is also possible to set some other animation properties - in our example AutoRepeat and AnimaitonDuration.

This way it has become really easy to include animated 3D content inside WPF applications.

 

The Viewport3ds is just the most basic way to show the objects from 3ds files. For more advanced users it is now possible to use Model3ds and even Reader3ds in XAML.

The Model3ds is derived from ModelVisual3D. This means it can be used inside Viewport3D. The main advantage of Model3ds over Viewport3ds is that it support precise positioning and sizing of the shown model. Also with Model3ds it is possible to shown just one part of all the models inside the 3ds file. For example the following XAML shows only "Torus01" model from the 3ds file on a custom set position and with custom size:

<model3ds:Model3ds Source="multiple objects.3ds" 
                   ObjectName="Torus01"
                   SizeX="50" SizeY="30" SizeZ="40"
                   PreserveScaleAspectRatio="False"
                   Position="100 20 0" PositionType="BottomCenter"/>	

As with Viewport3ds, the results with Model3ds are also immediately visible in Visual Studio Designer. This way you can simply position and size the 3D element. You can also very easily mix the objects from 3ds file with the basic 3D objects available with Ab3d.PowerToys (for example box, plane, etc.)

This was just a simple sample of Model3ds. For more check out the samples that come with the Ab3d.Reader3ds library.

I have mentioned that now also Reader3ds class can be used in XAML. How is this possible? Until now the class was used in code to read 3ds files. But now it derived from DependencyObject. And this means it can be defined as Resource. For example:

<Page x:Class="Reader3dsSamples.Reader3ds.Reader3dsAsResource"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ab3d="clr-namespace:Ab3d;assembly=Ab3d.Reader3ds"
    <Page.Resources>
        <ab3d:Reader3ds x:Key="MyReader3ds" Source="robotarm.3ds"/>
    </Page.Resources>
    <Grid>
        <Viewport3D Camera="{Binding Source={StaticResource MyReader3ds},
                    Path=Cameras[0]}">
            <ModelVisual3D Content="{Binding Source={StaticResource MyReader3ds}, 
                           Path=RootModel3DGroup}"/>
        </Viewport3D>
    </Grid>
</Page>    

The sample shown that because Reader3ds is defined as Page's Resource, it can be used in databinding. In the sample above the Content of the ModelVisual3D and the Viewport3D's Camera are databound to the Reader3d. And this is not all - it is also possible to bind to the Reader3ds NamedObjects dictionary, to Materials dictionary, Cameras list, etc. (see samples with library for more).

 

As I have already mentioned, the new XAML support is not the only improvement of the Reader3ds.

The 3ds reading engine has been also improved.

Now all the known problems from my very big list of 3ds files (collected with your help also) have been solved.

I have finally managed to find a way to correctly read some 3d objects that were defined with using left-handed coordinate system instead of right-handed one (usually mirrored objects).

Texture mapping is also improved (before some Textures were not placed correctly - in this version I have added DisableTextureOffset property - by default it is true to fix the problems).

Fixed "Object reference not set ..." exception when reading some 3ds files.

Also added support for textures in tif file format.

 

So now if it looks like Reader3ds or Viewer3ds did not correctly read the 3ds file, please try to open the 3ds file in a 3D modeling application. In almost all the cases the problem is in the 3ds file and not in the Reader3ds. Usually the 3ds file was not correctly exported - probably because you used some advanced features like bones animations, but 3ds file is quite old and cannot store those data. I know, many of you are waiting for some other 3D file format readers - I will make some in the next year for sure.

All of the features of the Ab3d.Reader3ds library still work on .Net Framework 3.0. For performance reasons it is highly recommended that you use .Net 3.5 SP1, but if you develop for .Net 3.0 you still can. But probably the next version will alredy require the 3.5 SP1.

 

After reading about all the new features, I am sure you agree that the Reader3ds deserved the increase of the version from 5.3 to 6.0.

I also hope that you agree that programming with 3D was never easier!

 

R2D2 3D model read with Reader3ds

 

As always the new version can be downloaded from my Downloads page.

Tags: , , ,

Reader3ds

Ab3d.PowerToys library advanced to Release Candidate

by abenedik 20. November 2009 22:16

Ab3d.PowerToys

The Ab3d.PowerToys library has advanced to Release Candidate version.

Here is the list of changes from beta 2:

LIBRARY:
- Added Ab3d.UIElements namespace with 3D objetcs that derive from UIElement3D
- Added ToolTip property to all classes under Ab3d.UIElements namespace
- Added PreviewCameraChanged event to BaseCamera - with the event it is possible to limit the camera movement with setting the Handled property in the event args to true
- Added ShowRotateCursorOnMouseOver property to MouseCameraController - if true it shows the RotationCursor when UsedMouseButton is set to Left and mouse is over the EventsSourceElement
- Added MaterialTypeConverter so it is possible to set Material and BackMaterial on all Ab3d Visuals and UIElements with simply specifying the color name
- Added constructor for Box3DModel that takes Rect3D as parameter
- Improved possibility to set custom images to CameraControlPanel - also added sample to show this
- Redesigned the TargetPositionCamera and TargetRect3DCamera classes - added BaseTargetPositionCamera and BaseTargetRect3DCamera
  This way it was possible to add additional methods to TargetPositionCamera - MoveLeft, MoveUp, etc that move and strafe the camera
  Also now the SceneCamera and other cameras that are derived from TargetRect3DCamera do not have TargetPosition and TragetRect3D properties
- Improved Design Time support:
  Removed all unused properties in VS Properties Editor for cameras
  Added icons for ToolBox (not final yet)
- Changed IsEnabled property in LinesUdater into UpdateMode enum - open for future improvements
- Added IsEmissiveMaterialUsed to LinesUdater to control if EmissiveMaterial is used to create the lines
- Added tons of comments into the code - also improves the help file

SAMPLES:

- Added samples for Ab3d.UIElements
- Added UIElementsToolTipSample - how simple is to use ToolTip property on Ab3d.UIElements
- Added CustomControlPanelSample - demonstrates how to use custom images for CameraControlPanel
- Added simple camera animation sample
- Added sample to demonstrate how to limit the camera movement with using PreviewCameraChanged event
- Improved LinesStressTest sample to show how to manually update the lines to improve the performance of the application

OTHER:

- Added ClassDiagram images to Resources directory so the class diagrams can be printed by the users

 

The Release Candidate version can be downloaded from my https://www.ab4d.com/Downloads.aspx

If you already have a previous version installed, just install the new version over the previous one (no need to uninstall the previous version first).

 

Note: This version will expire on on 31th January 2010.

Release is planned for the first half of December 2009.

Tags: , , , ,

Ab3d.PowerToys

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

Improved ZoomPanel - added FitToWidth and FitToHeight methods

by abenedik 22. September 2009 04:17

To make the ZoomPanel control even better a few methods were added to the new version:
FitToWidth, FitToLimitsWidth, FitToHeight, FitToLimitsHeight.

 

The methods can be very usefull when the ZoomPanel is used to show the documents. The new methods are demonstrated in the improved version of Documents Brower sample (see image below).

ZoomPanel Documents Browser

The new version v2.1.3551 can be downloaded from my Downloads page.

Tags: ,

ZoomPanel

Improved ZoomPanel to work with Wpf Browser Applications

by abenedik 14. September 2009 22:55

The ZoomPanel control has been improved to work correctly with Wpf Browser applications running in Internet Zone.

The cause of the problem was a real surprise - the Assembly.GetName() method requires FileIoPermissions - in Internet Zone this is not allowed :(

The new version v2.0.3544 can be downloaded from my Downloads page.

Tags: ,

ZoomPanel