Monday, January 23, 2012

Volume Rendering demos.

Well the engine has finally been finished. I have written all of the Volume types into a book for my own reference. Started with the basics :
Axes.
Plane.
Sphere.
Orbiting sphere.

Then I tried to make some simple but impressive animations.


This is a planet orbiting the sun. Notice the lighting, just an extra line of code was needed for that.




This animation takes a rectangle PNG, then using three filters was able to map the PNG onto a sphere. Then manipulating one of the numbers in the filter rotates the planet.

Sub-Voxel sampling in three-dimensions.

This is the way I rendered the first 128 slices on the WinP7 engine.


With the SAME AMOUNT of samples.


So it's back to the Windows Phone 7. The landscapes on the phone will now look more like this, with NO LOSS of performance. Actually for some strange reason it actually runs nearly twice as fast!
 The original engine with 300 slices.
The 128 sub-voxel slices added to 300 slice screenshot for impression of new capabilities.

Now that the Silverlight system is covered and tested, it's back to the Windows Phone 7.


Thursday, January 5, 2012

Mouse and Arc-Tangent.


Add an Ellipse with center at (142,142) and 3 TextBoxes.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverlightMouse
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void textBox1_MouseMove(object sender, MouseEventArgs e)
        {
            textBox1.Text = "x:y = " + e.GetPosition(null).ToString();
        }

        private void UserControl_MouseMove(object sender, MouseEventArgs e)
        {
            textBox2.Text = "x:y = " + e.GetPosition(null).ToString();
            double x = e.GetPosition(null).X - 142.0;
            double y = e.GetPosition(null).Y - 142.0;
            double angle = Math.Atan2(y, x) * (180 / Math.PI);
            int degrees = (int)angle;
            textBox3.Text = degrees.ToString();
        }
    }
}

The angle from the center of object to orbiting second object is shown on following table. Notice that the opposite pole of 0 degrees is 180 degrees not -180 degrees.