Saturday, August 13, 2011

XNA Notes–Day 4

Effects

The effects are what makes the 3D world of xna roll.

  • Basic effect is the default one and keeps track of stuff like lighting (ambient, directional, specular, emissive), texturing, colors and fog. It also has interfaces to be derived from by the user (one for matrix positioning, one for light and one for fog).
  • Alpha test effect is used for performance by rejecting pixels based off their alpha level.
  • Enviroment map effect is used for maping the enviroment into an object (think mirror).
  • Skinned Effect is ussed for animation of models, it relies heavily on a proper content processor.


States of the graphics device

A state can be passed to the Begin method of the spritebatch when selecting to draw something.

Blend state controls how colors blend together, can be used in various ways, among others to get the negative of the image, to control the alpha operations and play with the depth stencil.

Render targets

There is a RenderTarget2D class that allows you to render to it instead of the device, which you can use it by calling GraphicsDevice.SetRenderTarget(rt), and in HiDef mode you can have up to 4 different render targets going.

2 comments:

  1. You forgot DualTextureEffect: it allows you to map a model with two different textures at the same time, and control the blending mode between them. This way you can implement effects like light maps and decals.

    ReplyDelete
  2. Ah! You're right, thank you for that r2d2rigo.

    ReplyDelete