Yet another blog about WPF, Surface, SL, MVVM, NUI....

2011

2010

2009

2008

Tag - Mogre

Entries feed - Comments feed

 

Ambient, diffuse, emissive and specular colors : some examples

24 July 2009

Introduction

When you defines a material in Ogre or in 3D engines in general, you can play with at least four differents parameters : Ambient color, diffuse color, emissive color and specular color.

In this post I will give you the definitions and show you some example for those who - like me - requires some visual example to understand better...

Definitions

Here are the definitions (found on the web...) :

Ambient color : Ambient color is the color of an object where it is in shadow. This color is what the object reflects when illuminated by ambient light rather than direct light.

Diffuse color :Diffuse color is the most instinctive meaning of the color of an object. It is that essential color that the object reveals under pure white light. It is perceived as the color of the object itself rather than a reflection of the light.

Emissive color : This is the self-illumination color an object has.

Specular color :Specular color is the color of the light of a specular reflection (specular reflection is the type of reflection that is characteristic of light reflected from a shiny surface).



All object material can so define these 4 parameters. The color will then depend on them but also of the light they receive.

Examples

All the example are done with a point light, placed at the position (350, 400, 800);
With this type of light you define two colors, the ambient one and the diffuse one.

First example

The light parameters are :

  • Ambient color : White
  • Difusse color : White



First example

Second example

The light parameters are :

  • Ambient color : Red
  • Difusse color : White



Second example

Third example

The light parameters are :

  • Ambient color : Red
  • Difusse color : Red



Third example

Conclusion


As a conclusion : nothing is better than experimentation !

kick it on DotNetKicks.com
 

GUI to NUI : representations and manipulation of OLAP data in 3D

21 July 2009

Hello,

Here is a little post to show you a little video presenting the project I have worked on during my 6 months of training. I am very proud of it :) :



The subject was to find the new way of representations and manipulations of OLAP Data without using a keyboard or a mouse.
This is done in 3D on the Microsoft Surface plateform.

The technologies involved are :

  1. Microsoft Surface for the NUI (Natural User Interface),
  2. (M)Ogre to create the 3D World,
  3. OLAP for the acquisition of datas.




Here are some links for those interested :

  1. What is OLAP ? (wikipedia)
  2. What are the NUI ? (wikipedia)
  3. What is Ogre the 3D engine ?
  4. What is Microsoft Surface ?
  5. What is the company in which I have done my training ?



People who worked on it :

  1. Development: Jonathan ANTOINE
  2. Supervision of the project : Elise DUPONT
  3. 3D Expert : Laurent TRUDU



Enjoy !


kick it on DotNetKicks.com


Shout it
 

Use dataBinding and DependencyProperty with a non-WPF or extern object

10 April 2009

Today we are going to learn how we can uses the powerful data binding of WPF even on non-WPF objects.

The problem: when to use this solution ?

Sometimes you need to use the databinding with an object that you have not created and you can't use inheritance.

For example I wanted to use a Mogre Camera and build some WPF animation with it and I couldn't because :

  • WPF animation needed a DependencyProperty to manipulate,
  • I couldn't derive the Mogre.Camera class and add it the correct things because I got the camera from a factory object (the sceneManager).



Then I couldn't use the WPF animation to move my camera... next is how I solve it.

A solution: mine and surely not the best ;-)

Here is the solution i use:

  1. Create a proxy DependencyProperty inside a DependencyObject, for example your main windows.
  2. Override the OnPropertyChanged handler.
  3. Update the aimed attribute inside the handler.


To control my camera, I created this DependencyProperty inside my windows:

public static readonly DependencyProperty CameraPositionProperty = DependencyProperty.Register("CameraPosition", typeof(Point3D), typeof(SurfaceWindow1), new PropertyMetadata(new Point3D(0, 0, 0)));
 
      public Point3D CameraPosition
      {
         get
         {
            return (Point3D)GetValue(CameraPositionProperty);
         }
         set
         {
            SetValue(CameraPositionProperty, value);
         }
      }


Then I added this override :

protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
      {
         base.OnPropertyChanged(e);
         if (e.Property.Name.Equals("CameraPosition"))
         {
            _ogre.Camera.SetPosition((float)((Point3D)e.NewValue).X, (float)((Point3D)e.NewValue).Y, (float)((Point3D)e.NewValue).Z);
            _ogre.Camera.LookAt(Vector3.ZERO);
         }
      }



And my usual question :

Does someone have a better idea to perform the same ?