Index: branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans/PackingPlan3DView.Designer.cs
===================================================================
--- branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans/PackingPlan3DView.Designer.cs	(revision 13532)
+++ branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans/PackingPlan3DView.Designer.cs	(revision 13558)
@@ -82,5 +82,5 @@
       this.elementHost.Size = new System.Drawing.Size(229, 290);
       this.elementHost.TabIndex = 6;
-      this.elementHost.Text = "elementHost1";
+      this.elementHost.Text = "elementHost";
       this.elementHost.Child = this.packingPlan3D;
       // 
Index: branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans/PackingPlan3DView.cs
===================================================================
--- branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans/PackingPlan3DView.cs	(revision 13532)
+++ branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans/PackingPlan3DView.cs	(revision 13558)
@@ -37,12 +37,4 @@
     }
 
-
-    protected override void DeregisterContentEvents() {
-      base.DeregisterContentEvents();
-    }
-    protected override void RegisterContentEvents() {
-      base.RegisterContentEvents();
-    }
-
     public new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> Content {
       get { return (PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>)base.Content; }
@@ -55,5 +47,5 @@
       binSelection.Items.Clear();
       if (Content == null) {
-         packingPlan3D.Clear();
+        packingPlan3D.Packing = null;
       } else {
         int i = 0;
@@ -62,38 +54,28 @@
 
         binSelection.SelectedIndex = 0;
-        UpdateModel();
-        packingPlan3D.Focus(); // for mouse wheel?
-        // packingPlan3D.StartRendering();
+        ShowSelectedPacking();
       }
     }
 
-    private void UpdateModel() {
+    private void ShowSelectedPacking() {
       int currentBin = (binSelection != null) ? (int)(binSelection.SelectedIndex) : 0;
-      packingPlan3D.ShowContainer(Content.BinPackings[currentBin]);
-      // var bin = Content.BinPackings[currentBin].BinMeasures;
-      // // packingPlan3D.InitializeContainer(bin.Width, bin.Height, bin.Depth);
-      // foreach (var entry in Content.BinPackings[currentBin].ItemMeasures) {
-      //   var position = Content.BinPackings[currentBin].ItemPositions[entry.Key];
-      //    packingPlan3D.AddItemToContainer(
-      //    position.Rotated ? entry.Value.Depth : entry.Value.Width,
-      //    entry.Value.Height,
-      //    position.Rotated ? entry.Value.Width : entry.Value.Depth,
-      //    position.X, position.Y, position.Z, entry.Key, entry.Value.Material);
-      // }
+      packingPlan3D.Packing = Content.BinPackings[currentBin];
     }
 
     private void binSelection_SelectedIndexChanged(object sender, EventArgs e) {
-      UpdateModel();
-
       itemSelection.SelectedIndex = -1;
       itemSelection.Items.Clear();
+
+      // add items of this container
       int currentBin = (binSelection != null) ? (int)(binSelection.SelectedIndex) : 0;
-      packingPlan3D.ShowContainer(Content.BinPackings[currentBin]);
+      var packing = Content.BinPackings[currentBin];
+      foreach (var item in packing.ItemMeasures) {
+        itemSelection.Items.Add(item.Key);
+      }
 
+      ShowSelectedPacking();
     }
 
     private void itemSelection_SelectedIndexChanged(object sender, EventArgs e) {
-      UpdateModel();
-
       int selectedItem = -1;
       if ((itemSelection != null && itemSelection.SelectedItem != null) && Int32.TryParse(itemSelection.SelectedItem.ToString(), out selectedItem)) {
@@ -102,22 +84,4 @@
         packingPlan3D.ClearSelection();
     }
-
-    // private void Content_QualityChanged(object sender, EventArgs e) {
-    //   if (InvokeRequired)
-    //     Invoke(new EventHandler(Content_QualityChanged), sender, e);
-    //   else {
-    //     binSelection.Items.Clear();
-    //     if (Content == null) {
-    //       packingPlan3D.InitializeContainer(0, 0, 0);
-    //     } else {
-    //       int i = 0;
-    //       foreach (var bp in Content.BinPackings)
-    //         binSelection.Items.Add(i++ + " (" + Math.Round(bp.PackingDensity * 100, 2) + "%)");
-    //       binSelection.SelectedIndex = 0;
-    //       UpdateModel();
-    //       // packingPlan3D.StartRendering();
-    //     }
-    //   }
-    // }
   }
 }
Index: branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Shapes/Container3DView.xaml
===================================================================
--- branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Shapes/Container3DView.xaml	(revision 13532)
+++ branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Shapes/Container3DView.xaml	(revision 13558)
@@ -6,10 +6,13 @@
              mc:Ignorable="d" 
              d:DesignHeight="300" d:DesignWidth="300"
-             MouseWheel="viewport3D1_MouseWheel" MouseMove="viewport3D1_MouseMove" MouseDown="viewport3D1_MouseDown" MouseUp="viewport3D1_MouseUp"
+             MouseMove="Container3DView_MouseMove" MouseDown="Container3DView_MouseDown" MouseUp="Container3DView_MouseUp"
+             MouseWheel="Container3DView_OnMouseWheel" 
+             MouseEnter="Container3DView_OnMouseEnter"
+             Focusable="true"
              >
     <Grid>
         <Viewport3D Name="viewport3D1" >
             <Viewport3D.Camera>
-                <PerspectiveCamera x:Name="camMain" Position="0.5 3 3" LookDirection="0 -1 -1">
+                <PerspectiveCamera x:Name="camMain" Position="0.5 5 5" LookDirection="0 -1 -1"> <!-- camera position for design time-->
                 </PerspectiveCamera>
             </Viewport3D.Camera>
@@ -20,28 +23,76 @@
             </ModelVisual3D>
             <ModelVisual3D>
-                <ModelVisual3D.Content>
-                    <AmbientLight Color="DarkGray"/>
-                </ModelVisual3D.Content>
             </ModelVisual3D>
             <ModelVisual3D x:Name="MyModel">
                 <ModelVisual3D.Content>
-                    <GeometryModel3D>
-                        <GeometryModel3D.Geometry>
-                            <MeshGeometry3D x:Name="meshMain" 
-                                Positions="0 0 0  1 0 0  0 1 0  1 1 0  0 0 1  1 0 1  0 1 1  1 1 1" 
-                                TriangleIndices="2 3 1  2 1 0  7 1 3  7 5 1  6 5 7  6 4 5  6 2 0  2 0 4  2 7 3  2 6 7  0 1 5  0 5 4">
-                            </MeshGeometry3D>
-                        </GeometryModel3D.Geometry>
-                        <GeometryModel3D.Material>
-                            <DiffuseMaterial x:Name="matDiffuseMain">
-                                <DiffuseMaterial.Brush>
-                                    <SolidColorBrush Color="LightGray"/>
-                                </DiffuseMaterial.Brush>
-                            </DiffuseMaterial>
-                        </GeometryModel3D.Material>
-                    </GeometryModel3D>
+                    <Model3DGroup>
+                        <GeometryModel3D>
+                            <GeometryModel3D.Geometry>
+                                <!-- two opaque cubes, one in front one in back-->
+                                <MeshGeometry3D x:Name="meshMain" 
+                                Positions="0 0 -2.5 1 0 -2.5  0 1 -2.5  1 1 -2.5  0 0 -1.5  1 0 -1.5  0 1 -1.5  1 1 -1.5
+                                           0 0 0 1 0 0  0 1 0  1 1 0  0 0 1  1 0 1  0 1 1  1 1 1" 
+                                TriangleIndices="10 11 9  10 9 8  15 9 11  15 13 9  14 13 15  14 12 13  14 10 12  10 8 12  10 15 11  10 14 15  0 9 13  8 13 12
+                                                 2 3 1  2 1 0  7 1 3  7 5 1  6 5 7  6 4 5  6 2 4  2 0 4  2 7 3  2 6 7  0 1 5  0 5 4 ">
+                                </MeshGeometry3D>
+                            </GeometryModel3D.Geometry>
+                            <GeometryModel3D.Material>
+                                <DiffuseMaterial>
+                                    <DiffuseMaterial.Brush>
+                                        <SolidColorBrush Color="LightGreen"/>
+                                    </DiffuseMaterial.Brush>
+                                </DiffuseMaterial>
+                            </GeometryModel3D.Material>
+                        </GeometryModel3D>
+                        <GeometryModel3D>
+                            <GeometryModel3D.Geometry>
+                                <!-- two transparent cubes, one in front one in back-->
+                                <!-- draw transparent cubes from back to front and always draw outer and inner triangles and draw from front to back-->
+                                <MeshGeometry3D x:Name="meshInsides" 
+                                Positions="-1 -1 -1  2 -1 -1  -1 2 -1  2 2 -1  -1 -1 2  2 -1 2  -1 2 2  2 2 2
+                                           -1 -1 -3  2 -1 -3  -1 2 -3  2 2 -3  -1 -1 -1  2 -1 -1  -1 2 -1  2 2 -1" 
+                                TriangleIndices="9 11 10  8 9 10  11 9 15  9 13 15  15 13 14  13 12 14  12 10 14  12 8 10  11 15 10  15 14 10  13 9 8  12 13 8
+                                                 1 3 2  0 1 2  3 1 7  1 5 7  7 5 6  5 4 6  4 2 6  4 0 2  3 7 2  7 6 2  5 1 0  4 5 0 
+                                                 ">
+                                </MeshGeometry3D>
+                            </GeometryModel3D.Geometry>
+                            <GeometryModel3D.Material>
+                                <MaterialGroup>
+                                    <DiffuseMaterial>
+                                        <DiffuseMaterial.Brush>
+                                            <SolidColorBrush Opacity="0.1"  Color="DarkGray"/>
+                                        </DiffuseMaterial.Brush>
+                                    </DiffuseMaterial>
+                                </MaterialGroup>
+                            </GeometryModel3D.Material>
+                        </GeometryModel3D>
+                        <GeometryModel3D>
+                            <GeometryModel3D.Geometry>
+                                <!-- two transparent cubes, one in front one in back-->
+                                <!-- draw transparent cubes from back to front and always draw outer and inner triangles and draw from front to back-->
+                                <MeshGeometry3D x:Name="meshTransparent" 
+                                Positions="-1 -1 -1  2 -1 -1  -1 2 -1  2 2 -1  -1 -1 2  2 -1 2  -1 2 2  2 2 2
+                                           -1 -1 -3  2 -1 -3  -1 2 -3  2 2 -3  -1 -1 -1  2 -1 -1  -1 2 -1  2 2 -1" 
+                                TriangleIndices="2 3 1  2 1 0  7 1 3  7 5 1  6 5 7  6 4 5  6 2 4  2 0 4  2 7 3  2 6 7  0 1 5  0 5 4                                                 
+                                                 10 11 9  10 9 8  15 9 11  15 13 9  14 13 15  14 12 13  14 10 12  10 8 12  10 15 11  10 14 15  0 9 13  8 13 12
+                                                 ">
+                                </MeshGeometry3D>
+                            </GeometryModel3D.Geometry>
+                            <GeometryModel3D.Material>
+                                <MaterialGroup>
+                                    <DiffuseMaterial>
+                                        <DiffuseMaterial.Brush>
+                                            <SolidColorBrush Opacity="0.1"  Color="DarkGray"/>
+                                        </DiffuseMaterial.Brush>
+                                    </DiffuseMaterial>
+                                </MaterialGroup>
+                            </GeometryModel3D.Material>
+                        </GeometryModel3D>
+
+                    </Model3DGroup>
                 </ModelVisual3D.Content>
                 <ModelVisual3D.Transform>
                     <Transform3DGroup>
+                        <ScaleTransform3D x:Name="scale" ScaleX="1" ScaleY="1" ScaleZ="1"/>
                         <TranslateTransform3D OffsetX="-0.5" OffsetY="-0.5" OffsetZ="-0.5" />
                         <RotateTransform3D>
@@ -56,6 +107,5 @@
                         </RotateTransform3D>
                         <TranslateTransform3D OffsetX="0.5" OffsetY="0.5" OffsetZ="0.5" />
-                        <ScaleTransform3D x:Name ="scale" CenterX="0.5" CenterY="0.5" CenterZ="0.5" ScaleX="1" ScaleY="1" ScaleZ="1">
-                        </ScaleTransform3D>
+                        <ScaleTransform3D x:Name="scaleZoom" CenterX="0.5" CenterY="0.5" CenterZ="0.5" ScaleX="1" ScaleY="1" ScaleZ="1"/>
                     </Transform3DGroup>
                 </ModelVisual3D.Transform>
Index: branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Shapes/Container3DView.xaml.cs
===================================================================
--- branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Shapes/Container3DView.xaml.cs	(revision 13532)
+++ branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Shapes/Container3DView.xaml.cs	(revision 13558)
@@ -6,12 +6,6 @@
 using System.Windows;
 using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
 using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
 using System.Windows.Media.Media3D;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
 using HeuristicLab.Encodings.PackingEncoding.PackingPlan;
 using HeuristicLab.Problems.BinPacking.Dimensions;
@@ -25,60 +19,98 @@
     private double startAngleX;
     private double startAngleY;
-    private int selectedItemIndex;
+    private int selectedItemKey;
+
+    private BinPacking<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> packing;
+    public BinPacking<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> Packing {
+      get { return packing; }
+      set {
+        if (packing != value) {
+          this.packing = value;
+          ClearSelection(); // also updates visualization
+        }
+      }
+    }
 
     public Container3DView() {
       InitializeComponent();
+      camMain.Position = new Point3D(0.5, 2, 2); // for design time we use a different camera position 
       Clear();
     }
 
-    public void Clear() {
+
+    protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) {
+      base.OnRenderSizeChanged(sizeInfo);
+      var s = Math.Min(sizeInfo.NewSize.Height, sizeInfo.NewSize.Width);
+      var mySize = new Size(s, s);
+      viewport3D1.RenderSize = mySize;
+    }
+
+    public void SelectItem(int itemKey) {
+      // selection of an item should make all other items semi-transparent
+      selectedItemKey = itemKey;
+      UpdateVisualization();
+    }
+    public void ClearSelection() {
+      // remove all transparency
+      selectedItemKey = -1;
+      UpdateVisualization();
+    }
+
+    private void UpdateVisualization() {
+      Clear();
+      if (packing == null) return; // nothing to display
+
+      // draw all items
+      // order by Z position to reduce artifacts (because of transparent objects) 
+      // TODO: improve code to reduce artifacts 
+      //  - from triangle definitions and lighting
+      //  - from rotation and Z-ordering
+
+      foreach (var item in packing.ItemMeasures.OrderBy(i => packing.ItemPositions[i.Key].Z)) {
+        var position = packing.ItemPositions[item.Key];
+
+        var w = position.Rotated ? item.Value.Depth : item.Value.Width;
+        var h = item.Value.Height;
+        var d = position.Rotated ? item.Value.Width : item.Value.Depth;
+
+        // ignore the item.Material
+
+        // if nothing is selected then draw all cubes opaque 
+        // otherwise draw only the selected cube opaque and all others transparent
+        if (selectedItemKey < 0 || selectedItemKey == item.Key) {
+          AddCube(meshMain, position.X, position.Y, position.Z, w, h, d);
+        } else {
+          AddCube(meshTransparent, position.X, position.Y, position.Z, w, h, d, addInsideTriangles: true);
+        }
+      }
+
+      var container = packing.BinMeasures;
+      // draw a transparent container
+      AddCube(meshTransparent, container.Origin.X, container.Origin.Y, container.Origin.Z, container.Width, container.Height, container.Depth, addInsideTriangles: true);
+
+      // TODO: support cuboids with different side lengths
+      // apply scaling so that the container fits into the unit cube (necessary for the transformations)
+      scale.ScaleX = 1.0 / (container.Width);
+      scale.ScaleY = 1.0 / (container.Height);
+      scale.ScaleZ = 1.0 / (container.Depth);
+    }
+
+
+    private void Clear() {
+      meshInsides.Positions.Clear();
+      meshInsides.TriangleIndices.Clear();
+
       meshMain.Positions.Clear();
       meshMain.TriangleIndices.Clear();
+
+      meshTransparent.Positions.Clear();
+      meshTransparent.TriangleIndices.Clear();
 
       mouseDown = false;
       startAngleX = 0;
       startAngleY = 0;
-      selectedItemIndex = -1;
-
-      AddCube(0, 0, 0, 1, 1, 1); // add an empty cube (TODO: remove)
-    }
-
-
-    public void ShowContainer(BinPacking<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> packing) {
-      var container = packing.BinMeasures;
-      // TODO: draw transparent container
-      // packingPlan3D.InitializeContainer(bin.Width, bin.Height, bin.Depth);
-
-      foreach (var item in packing.ItemMeasures) {
-        var position = packing.ItemPositions[item.Key];
-
-        // ignore the item.Key
-        // ignore the item.Material
-
-        AddCube(position.X, position.Y, position.Z,
-          position.Rotated ? item.Value.Depth : item.Value.Width,
-          item.Value.Height,
-          position.Rotated ? item.Value.Width : item.Value.Depth);
-      }
-    }
-
-    public void SelectItem(int itemIndex) {
-      // selection of an item should make all other items semi-transparent
-      selectedItemIndex = itemIndex;
-    }
-    public void ClearSelection() {
-      // remove all transparency
-      selectedItemIndex = -1;
-    }
-
-    private void viewport3D1_MouseWheel(object sender, MouseWheelEventArgs e) {
-      if (e.Delta > 0) {
-        camMain.Position -= 0.5 * camMain.LookDirection;
-      } else if (e.Delta < 0) {
-        camMain.Position += 0.5 * camMain.LookDirection;
-      }
-    }
-
-    private void viewport3D1_MouseMove(object sender, MouseEventArgs e) {
+    }
+
+    private void Container3DView_MouseMove(object sender, MouseEventArgs e) {
       if (!mouseDown) return;
       var pos = e.GetPosition((IInputElement)this);
@@ -87,5 +119,5 @@
     }
 
-    private void viewport3D1_MouseDown(object sender, MouseButtonEventArgs e) {
+    private void Container3DView_MouseDown(object sender, MouseButtonEventArgs e) {
       startAngleX = rotateX.Angle;
       startAngleY = rotateY.Angle;
@@ -94,88 +126,163 @@
     }
 
-    private void viewport3D1_MouseUp(object sender, MouseButtonEventArgs e) {
+    private void Container3DView_MouseUp(object sender, MouseButtonEventArgs e) {
       mouseDown = false;
     }
 
+    private void Container3DView_OnMouseWheel(object sender, MouseWheelEventArgs e) {
+      if (e.Delta > 0) {
+        scaleZoom.ScaleX *= 1.1;
+        scaleZoom.ScaleY *= 1.1;
+        scaleZoom.ScaleZ *= 1.1;
+      } else if (e.Delta < 0) {
+        scaleZoom.ScaleX /= 1.1;
+        scaleZoom.ScaleY /= 1.1;
+        scaleZoom.ScaleZ /= 1.1;
+      }
+    }
+
 
     #region helper for cubes
 
-    private void AddCube(int x, int y, int z, int width, int height, int depth) {
-      AddTriangles(AddPoints(x, y, z, width, height, depth));
-    }
-
-    private void AddTriangles(int[] pointIdx) {
+    private void AddCube(MeshGeometry3D mesh, int x, int y, int z, int width, int height, int depth, bool addInsideTriangles = false) {
+      AddOutsideTriangles(mesh, AddPoints(mesh, x, y, z, width, height, depth));
+      if (addInsideTriangles) AddInsideTriangles(meshInsides, AddPoints(meshInsides, x, y, z, width, height, depth));
+    }
+
+    private void AddOutsideTriangles(MeshGeometry3D mesh, int[] pointIdx) {
+      // point indices counter-clockwise
       // back side
-      meshMain.TriangleIndices.Add(pointIdx[0]);
-      meshMain.TriangleIndices.Add(pointIdx[2]);
-      meshMain.TriangleIndices.Add(pointIdx[1]);
-
-      meshMain.TriangleIndices.Add(pointIdx[0]);
-      meshMain.TriangleIndices.Add(pointIdx[3]);
-      meshMain.TriangleIndices.Add(pointIdx[2]);
+      mesh.TriangleIndices.Add(pointIdx[0]);
+      mesh.TriangleIndices.Add(pointIdx[2]);
+      mesh.TriangleIndices.Add(pointIdx[1]);
+
+      mesh.TriangleIndices.Add(pointIdx[0]);
+      mesh.TriangleIndices.Add(pointIdx[3]);
+      mesh.TriangleIndices.Add(pointIdx[2]);
+
+      // bottom side
+      mesh.TriangleIndices.Add(pointIdx[5]);
+      mesh.TriangleIndices.Add(pointIdx[4]);
+      mesh.TriangleIndices.Add(pointIdx[0]);
+
+      mesh.TriangleIndices.Add(pointIdx[5]);
+      mesh.TriangleIndices.Add(pointIdx[0]);
+      mesh.TriangleIndices.Add(pointIdx[1]);
 
       // right side
-      meshMain.TriangleIndices.Add(pointIdx[2]);
-      meshMain.TriangleIndices.Add(pointIdx[6]);
-      meshMain.TriangleIndices.Add(pointIdx[5]);
-
-      meshMain.TriangleIndices.Add(pointIdx[1]);
-      meshMain.TriangleIndices.Add(pointIdx[2]);
-      meshMain.TriangleIndices.Add(pointIdx[5]);
+      mesh.TriangleIndices.Add(pointIdx[2]);
+      mesh.TriangleIndices.Add(pointIdx[6]);
+      mesh.TriangleIndices.Add(pointIdx[5]);
+
+      mesh.TriangleIndices.Add(pointIdx[1]);
+      mesh.TriangleIndices.Add(pointIdx[2]);
+      mesh.TriangleIndices.Add(pointIdx[5]);
 
       // left side
-      meshMain.TriangleIndices.Add(pointIdx[7]);
-      meshMain.TriangleIndices.Add(pointIdx[3]);
-      meshMain.TriangleIndices.Add(pointIdx[4]);
-
-      meshMain.TriangleIndices.Add(pointIdx[4]);
-      meshMain.TriangleIndices.Add(pointIdx[3]);
-      meshMain.TriangleIndices.Add(pointIdx[0]);
+      mesh.TriangleIndices.Add(pointIdx[7]);
+      mesh.TriangleIndices.Add(pointIdx[3]);
+      mesh.TriangleIndices.Add(pointIdx[4]);
+
+      mesh.TriangleIndices.Add(pointIdx[4]);
+      mesh.TriangleIndices.Add(pointIdx[3]);
+      mesh.TriangleIndices.Add(pointIdx[0]);
+
+      // top side
+      mesh.TriangleIndices.Add(pointIdx[3]);
+      mesh.TriangleIndices.Add(pointIdx[7]);
+      mesh.TriangleIndices.Add(pointIdx[6]);
+
+      mesh.TriangleIndices.Add(pointIdx[3]);
+      mesh.TriangleIndices.Add(pointIdx[6]);
+      mesh.TriangleIndices.Add(pointIdx[2]);
 
       // front side
-      meshMain.TriangleIndices.Add(pointIdx[6]);
-      meshMain.TriangleIndices.Add(pointIdx[7]);
-      meshMain.TriangleIndices.Add(pointIdx[4]);
-
-      meshMain.TriangleIndices.Add(pointIdx[6]);
-      meshMain.TriangleIndices.Add(pointIdx[4]);
-      meshMain.TriangleIndices.Add(pointIdx[5]);
+      mesh.TriangleIndices.Add(pointIdx[6]);
+      mesh.TriangleIndices.Add(pointIdx[7]);
+      mesh.TriangleIndices.Add(pointIdx[4]);
+
+      mesh.TriangleIndices.Add(pointIdx[6]);
+      mesh.TriangleIndices.Add(pointIdx[4]);
+      mesh.TriangleIndices.Add(pointIdx[5]);
+    }
+
+    private void AddInsideTriangles(MeshGeometry3D mesh, int[] pointIdx) {
+      // for each cube we also draw the triangles facing inside because they are visible when a cube is transparent
+      // point indices clockwise
+
+      // back side
+      mesh.TriangleIndices.Add(pointIdx[1]);
+      mesh.TriangleIndices.Add(pointIdx[2]);
+      mesh.TriangleIndices.Add(pointIdx[0]);
+
+      mesh.TriangleIndices.Add(pointIdx[2]);
+      mesh.TriangleIndices.Add(pointIdx[3]);
+      mesh.TriangleIndices.Add(pointIdx[0]);
+
+      // bottom side
+      mesh.TriangleIndices.Add(pointIdx[0]);
+      mesh.TriangleIndices.Add(pointIdx[4]);
+      mesh.TriangleIndices.Add(pointIdx[5]);
+
+      mesh.TriangleIndices.Add(pointIdx[1]);
+      mesh.TriangleIndices.Add(pointIdx[0]);
+      mesh.TriangleIndices.Add(pointIdx[5]);
+
+      // right side
+      mesh.TriangleIndices.Add(pointIdx[5]);
+      mesh.TriangleIndices.Add(pointIdx[6]);
+      mesh.TriangleIndices.Add(pointIdx[2]);
+
+      mesh.TriangleIndices.Add(pointIdx[5]);
+      mesh.TriangleIndices.Add(pointIdx[2]);
+      mesh.TriangleIndices.Add(pointIdx[1]);
+
+      // left side
+      mesh.TriangleIndices.Add(pointIdx[4]);
+      mesh.TriangleIndices.Add(pointIdx[3]);
+      mesh.TriangleIndices.Add(pointIdx[7]);
+
+      mesh.TriangleIndices.Add(pointIdx[0]);
+      mesh.TriangleIndices.Add(pointIdx[3]);
+      mesh.TriangleIndices.Add(pointIdx[4]);
 
       // top side
-      meshMain.TriangleIndices.Add(pointIdx[3]);
-      meshMain.TriangleIndices.Add(pointIdx[7]);
-      meshMain.TriangleIndices.Add(pointIdx[6]);
-
-      meshMain.TriangleIndices.Add(pointIdx[3]);
-      meshMain.TriangleIndices.Add(pointIdx[6]);
-      meshMain.TriangleIndices.Add(pointIdx[2]);
-
-      // bottom side
-      meshMain.TriangleIndices.Add(pointIdx[5]);
-      meshMain.TriangleIndices.Add(pointIdx[4]);
-      meshMain.TriangleIndices.Add(pointIdx[0]);
-
-      meshMain.TriangleIndices.Add(pointIdx[5]);
-      meshMain.TriangleIndices.Add(pointIdx[0]);
-      meshMain.TriangleIndices.Add(pointIdx[1]);
-
-
-    }
-
-    private int[] AddPoints(int x, int y, int z, int w, int h, int d) {
+      mesh.TriangleIndices.Add(pointIdx[6]);
+      mesh.TriangleIndices.Add(pointIdx[7]);
+      mesh.TriangleIndices.Add(pointIdx[3]);
+
+      mesh.TriangleIndices.Add(pointIdx[2]);
+      mesh.TriangleIndices.Add(pointIdx[6]);
+      mesh.TriangleIndices.Add(pointIdx[3]);
+
+      // front side
+      mesh.TriangleIndices.Add(pointIdx[4]);
+      mesh.TriangleIndices.Add(pointIdx[7]);
+      mesh.TriangleIndices.Add(pointIdx[6]);
+
+      mesh.TriangleIndices.Add(pointIdx[5]);
+      mesh.TriangleIndices.Add(pointIdx[4]);
+      mesh.TriangleIndices.Add(pointIdx[6]);
+    }
+
+    private int[] AddPoints(MeshGeometry3D mesh, int x, int y, int z, int w, int h, int d) {
       // ground
-      meshMain.Positions.Add(new Point3D(x, y, z));
-      meshMain.Positions.Add(new Point3D(x + w, y, z));
-      meshMain.Positions.Add(new Point3D(x + w, y + h, z));
-      meshMain.Positions.Add(new Point3D(x, y + h, z));
+      mesh.Positions.Add(new Point3D(x, y, z));
+      mesh.Positions.Add(new Point3D(x + w, y, z));
+      mesh.Positions.Add(new Point3D(x + w, y + h, z));
+      mesh.Positions.Add(new Point3D(x, y + h, z));
       // top
-      meshMain.Positions.Add(new Point3D(x, y, z + d));
-      meshMain.Positions.Add(new Point3D(x + w, y, z + d));
-      meshMain.Positions.Add(new Point3D(x + w, y + h, z + d));
-      meshMain.Positions.Add(new Point3D(x, y + h, z + d));
-
-      return Enumerable.Range(meshMain.Positions.Count - 8, 8).ToArray();
+      mesh.Positions.Add(new Point3D(x, y, z + d));
+      mesh.Positions.Add(new Point3D(x + w, y, z + d));
+      mesh.Positions.Add(new Point3D(x + w, y + h, z + d));
+      mesh.Positions.Add(new Point3D(x, y + h, z + d));
+
+      return Enumerable.Range(mesh.Positions.Count - 8, 8).ToArray();
     }
     #endregion
+
+    private void Container3DView_OnMouseEnter(object sender, MouseEventArgs e) {
+      Focus(); // for mouse wheel events
+    }
   }
 }
