Hey again 3d users of the GMC,
This example is to display the visual quality achievable if you know how to work with the right tools, and if you have insight in programming with vertexes on the fly.
It includes 2 techniques: Distortion Wave and Ambient Occlusion (Baked).
First up is the distortion wave. The distortion wave is basically 2 connected rings of vertexes. The vertexes where the rings meet have offsetted UV coordinates, so will create a very nice distortion when the rings are moving. Since it is built from vertexes it needs a texture. To get this texture I'm using the surface fix by amd24 to render the screen to a surface, then upscale that surface to meet the texture x^2 size requirements.
This technique can also be used in explosion effects, creating a shock wave. That will make the explosion look a lot more impressive. Well, at least I am going to use this for it.
It can also be modified to make heat-haze effects for fire!
Ambient Occlusion (Baked)
This is probably my most favourite effect in the world of computer graphics. Why? Because it creates a great sense of depth in 3d environments that can not be achieved by normal lighting. It's used in commercial games too, for example in Gears of War 2 and Halo Reach. Use it, and your game will look a whole of a lot better!
I find it hard to explain what it is. Wikipedia does a much better job at it:
Now it is important to note that the Ambient Occlusion I'm using here is baked (pre-rendered) using an external tool. Due to GM's lack of pixel shaders it's not possible to do it realtime in a fast way, but I would prefer baking it in anyway. That's because it still look amazing, and it will require GM a tiny bit of extra performance for a huge graphic improvement!
Ambient occlusion is a shading method used in 3D computer graphics which helps add realism to local reflection models by taking into account attenuation of light due to occlusion. Ambient occlusion attempts to approximate the way light radiates in real life, especially off what are normally considered non-reflective surfaces.
Unlike local methods like Phong shading, ambient occlusion is a global method, meaning the illumination at each point is a function of other geometry in the scene. However, it is a very crude approximation to full global illumination. The soft appearance achieved by ambient occlusion alone is similar to the way an object appears on an overcast day.
First I created a scene. The scene consists of 2 models, the Temple and the Holy Relic. I made them both in Google Sketchup. The Temple was designed by myself, but I copied the Holy Relic from a design made by Nintendo. Gamecube players will probably recognize it. (It's featured in my all-time favourite game.)
After creating the models, I exported them to OBJ. Then I loaded them in Lith Unwrap to create an UV-map for them. The thing with baking Ambient Occlusion is that every triangle needs to have it's own unique place on the texture, because all triangles are shaded differently. I used the "face" mapping function to let Lith Unwrap automatically seperated all triangles nicely on the texture. I scaled the entire mapping down a bit to stay away from the edges, and I was all set to go. I exported the UV-mapped model to OBJ.
This is where the Ambient-Occlusion tool comes into play. It's called xNormal and can be found here. In this tool you just drag in the OBJ model to both the High-Poly Mesh and Low-Poly Mesh sections, select export location, define rendering options and click the "Generate Maps" button. It's that simple.
The time needed for rendering can and probably will take awhile depending your rendering options.
I now had the OBJ model and Ambient Occlusion texture for the model. Now to get the model in GM, I used GMModelFix by icuurd12b42 to convert to d3d. When I loaded both the d3d model and texture in GM I noticed the Ambient Occlusion map was not placed on the model as it should be. When this happens just flip the Ambient Occlusion texture image vertically!
Here's a screenshot of the result. It doesn't use any GM lighting at all, it's all in the texture!
The Holy Relic pulsates some kind of magical forcefield...
Someone is using dark magic on the Relic, making the forcefield go crazy!
Here's the download. It also includes an EXE for the people who want to try it out directly.
Controls in the example:
- Move around using WASD
- Change height with QE
- Look around with the mouse
- Hold space to reign fear upon your minions