Tutorial 04 - Material World

Ok, the last tutorial was a bit dissapointing, because the teapots didn't have color. We'll change that. But we can't use teapots anymor or we wouldn't see any changes, so we're going to use just planes:

SDE.Graphic.Node billboard gMan.CreateBillboardNode();

The BillboardNode is a plane that always faces the camera. Let's move it somewhere we can see it clearly:

billboard.Position = new Vector3(0,0,-2);

We create a material for it and asign a texture (maybe you'll need to add the reference to Direct3D). Then we add it to the camera's scene:

billboard.Material gMan.Core.CreateMaterial("billboard");
billboard.Material.Textures[0gMan.Core.GetTexture("../../../Bin/Media/sde-logo.png");
cam.AddToScene(billboard);

This is what we've got by the moment:

You can change material's properties and see what happens. This is some of the things you can achieve:

billboard.Material.Wireframe = true;

billboard.Material.Type = SDE.Graphic.Material.Blending.Transparent;


billboard.Material.Type = SDE.Graphic.Material.Blending.TransparentAdd;

The last one isnt a good example though. The TransparentAdd type adds the colour of the texture and what is behind it. It looks great with particles, and you will see for yourself on another tutorial.

And even better, you can asign a shader to a material, to create special fx on the object is applied onto. I won't explain how to create a shader, but if you've got an .fx file, you can load it this way:

billboard.Material.Effect "../../../Bin/Media/TA/shaders/SimpleBlur.fx";
billboard.Material.ShaderTechnique "blur";
billboard.Material.SetShaderParameter("offset",6.50f);
billboard.Material.SetShaderParameter("texture0", billboard.Material.Textures[0]);

Nice blur shader

That's it by now! isn't it nice? and things keep going better.