Archive for October, 2010

Swizzling

Posted: October 29, 2010 in General

Since using high level shader languages like DirectX HLSL, I’ve become quite the fan of vector swizzling, and wanted to use it with my maths libray. My solution was to write a quick console app to write the code for me, and then just include those files in my vector classes. Probably not the most ingenious solution there is, but it worked well for me. Using this technique does produce a fair number of new member functions though :

Vec2 = 2^2 + 2^3 + 2^4 = 28
Vec3 = 3^2 + 3^3 + 3^4 = 117
Vec4 = 4^2 + 4^3 + 4^4 = 336

But now I can write code like :

fsVec2 a = fsVec2( 1.0f, 2.0f );
fsVec4 b = a.xxxx();
fsVec3 c = b.xyz() + a.xyx() + b.www();

I chose not to add MACROS to enable the “.xxxx” syntax, as opposed to the “.xxxx()” as I don’t think the fewer keystrokes justify polluting the global namepspace, specially as I like to use names like “xy” and “xx” for local variables.

Below is the source for doing this.

Advertisements

3ds Max Exporter

Posted: October 29, 2010 in General

So I finally got around to writing my 3ds Max Exporter. Currently it exports :

  • Static Meshes
  • Skinned Meshes
  • Animation Clips
  • Skeletons
  • Collision Meshes

Floating Point Format

Posted: October 29, 2010 in General

One of the chapters in my ASM book I found really interesting was the one on how floating point numbers are stored and how they’re processing in calculations. Here are some C# apps to create and decompose a 32-bit floating point number.

Model Viewer

Posted: October 29, 2010 in General, Real-Time Rendering

This is a model Viewer I made to visualize Meshes and their materials that are exported using my 3dsMax plugin.

Radiosity

Posted: October 29, 2010 in Real-Time Rendering

This is an approximate Radiosity effect I was trying out. Approximate in that it instead renders from the vertices point of view as opposed to the patches point of view. It also doesnt render the half sized bits either, which seems to cause artifacts in the corners,  not a bad result though. The app runs in real time (125fps in debug mode), and works by first rendering the view from each vertex to a render target, and then using that target in a seond stage to light the vertex itself, and this process continues. The viewport rendered from each vertices point of view is actually very small (only 32×32 pixels in the images below, which you’ll need to zoom in quite far), where I use a 1024×1024 render target to store them all in a grid. I also included some debug functionality that allows you to view the scene from each vertex (shown in the last few images) which was handy. The scene used here is very low poly, you can see the wireframe in the last few images.

This first image shows the end effect.

This second image shows the views from the vertices from one iteration.

These final images show the view from several vertices, which made debugging easier.

Game Engine Gems

Posted: October 29, 2010 in News

So apparently theres yet another Gems series being published, this time on Game Engine Design, Game Engine Gems. The first edition is being authored by Eric Lengyel, who wrote the very popular book Mathematics for 3D Game Programming and Computer Graphics. I assume it will follow the structure of all the other Gems series, that being lots of tips and tricks chucked in by knowledgable people, generally from the Games Industry. Im not sure how this series will differ from Game Programming Gems, as that can be considered “Game Engine” related too. But I’m all for new books, so I’m not going to to complain. 🙂

“Game Engine Gems brings together in a single volume dozens of new articles from leading professionals in the game development industry. Each “gem” presents a previously unpublished technique related to game engines and real-time virtual simulations. Specific topics include rendering techniques, shaders, scene organization, visibility determination, collision detection, audio, user interface, input devices, memory management, artificial intelligence, resource organization, and cross-platform considerations. A CD-ROM containing all the source codes and demos accompanies the book.”

Game Programming Gems 8

Posted: October 29, 2010 in News

The new edition of Game Programming Gems has been released !