Welcome to Pixel Tangent featuring quality yet simplistic implementations of common graphic concepts. Primarily this site acts as an online portfolio of my graphics journey, as well as a place where others may learn. And the best part: all source code is provided.
Recently a friend and I were discussing various encryption algorithms; we needed one that could be squeezed onto a tiny ROM and had little performance overhead. A quick search lead us to the appropriately named "Tiny Encryption Algorithm", and boy was it tiny. It was also both simple to implement and easy to use. For a little extra memory overhead, we decided to implement the eXtended Tiny Encryption Algorithm.
For further explanation, complete source code and our test harness, please refer to the xTEA page.
The source is available by following this Clicky.
Thanks to viewer feedback, you know who you are, the cube mapping sample has been updated to help show the cube being mapped. It's important to remember that this is a cube mapping sample, and not an environmental mapping sample.
The updates show an exploded cube representing the reflections shown on the lamp shade. Now, tapping the '-' and '+' keys will adjust the transparency of the exploded cube.
Keep the questions and suggestions coming.
Enjoy the updates here.
Woot, the first entry on the "Coding 4 fun" section of my corner of cyberspace - QR Barcode Detection.
These pesky little symbols are popping up everywhere. They've been a huge success in Japan for years and now telephony operators world wide are jumping on the bandwagon.
![]()
To help understand some of the theory behind QR codes and what makes them so "quick" and easy to detect and decode, check out this short slidepack and accompany video.
A quick seach on youtube illustrates some very interesting examples and applications of QR codes in the real world.
This is a quick and dirty implementation of some interesting graphics algorithms such as perspective transformation correction, which corrects for both rotation and perspective distortions without expensive trigonometry function calls, and everyone's favourite cross product method to determine the barcode's orientation. Although this is a simple implantation, it seems to be very quick and robust.
Have a happy new year everyone!
The source is available by following this Clicky. Both a Visual Studio Project and Linux style make file are enclosed.
I've been meaning to post this video for a while, so without further delay, please enjoy. Hit me back with comments - good, sucks, boring? Let me know.
A reoccurring question clogging my inbox over the last few months is "how do I render to a texture", frame buffer or something in between. Not to disappoint fans, even I was in awe at just how simple this sample turned out. This sample both illustrates the technique and provides a simple reference implementation.
Without further ado, here is the Clicky.
I've been living, or should I say working, amongst of vibrant lights of Tokyo - the museum of the future. Anyway an end is in sight, so stay tuned for more simple samples.
With a little imagination shaders can do almost anything. This sample demonstrates two simple shaders that shatter, or explode, a pre-processed model.
The first shader uses the flat surface normal of each triangle in a model to independently transverse each triangle in an outward direction. Furthermore, each triangle in the model is independently and randomly rotated around it's centroid. This simple pair of effects creates the appearance of the model shattering outwards into fragmented pieces. Very cool, and very easy. However, normally when an object "explodes", all fragments explode in an outward direction from the center.
To remedy this technically incorrect artifact, a second shader has been provided. And guess what? The second shader shatters every triangle in the model outwards from the center of the model. This cheap effect is processed entirely within the shaders and would make a great addition to any shoot 'em up game.
Enjoy the simplicity of this Clicky.
This been a while since my previous sample, working in Japan has been keeping me busy. Alas, no excuses. Down to the business of the latest graphical delight - Cube mapping. After performing a few "back of the envelope" calculations, it was great to discover how easy it was to setup and allow OpenGL to auto generate the required texture co-ordinates. This combined with a pinch of GLSL and voila - Cube mapping made easy.
In other news, the site will soon celebrate its first birthday, new hosting was secured and the hit counter has gone crazy over the last few as the 50k hit approaches. Celebrations all round. Happy New Year everyone!
Enjoy the simplicity of this Clicky.
The concept of High Dynamic Range rendering, or HDR for short, represents one of the many reasons why real-time renderings are more impressive than ever before. Thanks to video hardware evolution, implementing HDR, and post-processing effects in general, has never been easier.
This little gem implements HDR by rendering the scene to a master Frame Buffer Object (FBO). This master FBO is then processed through a high pass shader filter that only captures the highlights of the scene. The output of the high pass filter is saved to its own FBO. Next, three downsampled FBOs are created. These four (the original high pass FBO plus the three downsampled FBOs) are then blurred together before presenting the HDR scene to the final frame buffer.
Obviously for this sample to work with your setup, your video hardware must support FBOs and support Non-power of Two (NPOT) texturing.
As always, have fun with the ease and simplicity this simple sample. Clicky.
Recently I've been intrigued with NVIDIA's FX Composer, and while it's a great tool it lacks native GLSL support. Anyway, I was really impressed with the new shader library, however many of them have visual artifacts that are easy to remedy. For example, the Film effect is both a quick and easy shader to implement, but the original shader suffers from texture wrapping artifacts because the texture coordinates are not clamped.
After converting the original shader into pure GLSL and simply clamping the texture input into the fragment shader the artifacts disappeared. How easy was that?
Yet again, this example also shows the usefulness and effectiveness of one - dimensional textures (or texture lookups). This is truly an easy shader to implement into any scene with no additional requirements, so what are you waiting for? Give it a try.
Hope you enjoy the ease and simplicity of the Visual Studio Project (.NET 2005) windows and GLUT build Clicky.