Basic Triangle

Rendering Methods | Tuesday 2 June 2009 7:30 pm

The triangle is the basic geometry that is used when rendering. All other shapes of geometry you want to draw must be divided into triangles.

Basic Triangle

The triangle parts:

  1. Face, the triangle itself, the area is what is gonna be rasterized (with normal fill mode at least).
  2. Face normal, the normal to the plane which the triangle is parallell too. It is mostly used for calculating the vertex normal.
  3. Vertex, a triangle has three vertices with x,y,z coordinates, they are located in the triangle corners. All transformations apply to these ones.
  4. Edge, the line between vertices are called edges, a triangle has three edges. Are used for example shadow volumes.
  5. Vertex normal, each vertex has a normal which decides the smoothness of the geometry.

Other data often used per vertex:

  • Tangent and Binormal for per pixel lighting
  • Texture coordinates (uvw-coords), sometimes more than one per vertex

Tutorial to render a triangle in DirectX10
http://msdn.microsoft.com/en-gb/library/bb172486(VS.85).aspx

Tutorial to render a triangle in OpenGL
 http://60hz.csse.uwa.edu.au/workshop/workshop0/workshop1.html

Tutorial to render a triangle in XNA
http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series1/The_first_triangle.php

Tutorial to render a triangle in OpenGL ES 2.0
http://www.webreference.com/programming/opengl_es/

Please share:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Current
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • StumbleUpon
  • Twitter
  • Reddit
  • Technorati
  • Yahoo! Bookmarks

Cull Levels

Culling | Monday 17 November 2008 10:07 pm

These are the different levels culling algorithms can work on.

Triangle Level

Description: Determine for each triangle if it should be culled or not.
Primary goal: Minimize triangle count.
Culling technique example: BSP 
Usage: Not used anymore, cost to much CPU.

Object Level

Description: Check each object (a group of triangles in one buffer) if they should be culled or not.
Primary goal: Minimize triangle count and keep state changes low.
Culling technique example: View Frustum Culling of Bounding Box Hierarchies
Usage: Often used.

Batch Level

Description: Will check whole batches (a group of objects in one buffer)  if they should be culled or not.
Primary goal: Minimize draw calls and triangle count.
Culling technique example:  Uniform Grid Culling
Usage: Often used.

Please share:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Current
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • StumbleUpon
  • Twitter
  • Reddit
  • Technorati
  • Yahoo! Bookmarks

Multisampling (Supersampling)

Filtering | Friday 26 September 2008 7:35 pm

Because every pixel is normally only sampled once they cannot get the correct output if the whole pixel isn’t covered by one triangle. This is beacuse the sample can only get it’s colour (and other properties) from one triangle. In the contour of a model this is very apparent and if no multisampling is enabled then the edges will be jagged and appear very annoing. This effect is called aliasing and to deal with it we would need unlimited with samples in the pixel and blend them together, but it’s not possible with the current hardware. Instead we have to accept only taking two, four or more samples and hope it’s enough. There are a lot of different methods to do multisampling and the table below show some of the most used ones and the result from using them on a filled triangle and a outlined triangle.

Supersampling Schemes

Image from the book Real-Time Rendering, used with permission.

Please share:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Current
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • StumbleUpon
  • Twitter
  • Reddit
  • Technorati
  • Yahoo! Bookmarks

Triangle Modes

Optimizations | Thursday 25 September 2008 12:54 am

There are different ways to draw a triangle in opengl. The straightforward way is to draw the triangle by passig in its’s three vertices. But because triangles almost always share their vertices with other triangles a more suitble way would be to take use of this knowledge. In OpenGL you can do it by either drawing triangles as strips (image below) or fans. The mostly used method is strips. If allowing triangles to have zero area then any coherent model can be interpreted as a long triangle strip. New graphics cards are built to be able to handle such triangles with zero area very fast. The profit from using triangle strips will be a lower memory usage and less accesses to memory.

Triangle Strip
Please share:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Current
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • StumbleUpon
  • Twitter
  • Reddit
  • Technorati
  • Yahoo! Bookmarks