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.


Thursday, December 8, 2011

Demo04 ( Re-visited )

Finally finished the volume rotation strategy. This means all volumes, like the T-Rex from Demo04 can now walk around and rotate. Firstly I am going to make the T-Rex out of 16 volume slices, the original only had 4 slices ( lazy ). This will make the T-Rex a lot more detailed and realistic when viewed from an angle. 
I am going to enter the viewport slices into the alpha channel for fog, and use grass maps and tree maps. The completion of this demo will make Graph3D finally finished!

Windows 7 Tools

Snipping tool




screen snapshots.

Windows Calculator Programmer Mode ( Alt + f3 )


This is the Silverlight pixel value for green. Let's put it into Visual Studio 2010.

screen.Pixels[offset] = -16711936;

Very cool!

Saturday, November 26, 2011

Texture time!

Need some high quality seamless textures, been looking on the net and MB3D, CG TEXTURES, and SPIRALGRAPHICS have the best range of free textures.
I was able to create road tiles for rally game using PAINT.NET.



With a little trial and error the straight piece of road can create three different turn radii. So one straight tile and three corner tiles can make kilometers of road. Quick and simple.
Not bad for 5 minutes work.
This is how it works. For a bitmap 512 x 256, the canvas size is 4096 x 4096. The polar scale is equal to 2.00, this will give a 45 degree turn. Change the canvas to 2048 x 2048 and the turn becomes 90 degrees etc...The bitmap road and turn perfectly align, look at the pixel perfect alignment.
Remember can be used for chains etc...

Use a grid to make roads for tile pieces.

Friday, November 18, 2011

Volume Rendered Motocross Track ( Low res)

Finally stopped testing and exploring ways of making volumes. The Motocross track is always a good choice, all the bumps and ruts. To make the bumps and ruts I went into Paint.NET, I selected the road using magic wand. Then with just the road used the Stencil tool to highlight only bumps, then using an alpha blending Layer added the slight indentations.






Hi res is going to be special. It's the Phone7 engine running on a browser, not bad at all.
Here's some screens of the track surface detail.



Start a new Phone7 project and copy and paste this code, voila mobile phone App!
Big fan of Silverlight.

Saturday, November 12, 2011

Demo 01

Well I am revisiting the Windows Phone 7 demo 01. Notice the blending used by the internet, looks unbelievably realistic and adds a professional edge.
  All I have to do is add some walls and grandstands. Then it's adding the bike sprites and it's basically a finished product. Used a Google / texture map, alpha channel combination for maximum detail.
This is looking from the motorbike.
Turning a corner.