August 13, 2009

The new face of a conspiracy

Posted in Computer Graphics tagged , , , , , , , , , , , , , , , , , , at 6:48 pm by sagito

Hi everyone! It was a long time since I posted something new here, because my network keeps going down… But this time, I’m bringing you news about the Conspiracy engine. Missed him? Me too… πŸ˜› Well, it has a brand new face since many new features have been added that make him stand much higher then before.

To start, a small problem with the vertices was corrected. Somehow the vertex data was getting scrambled all the way through the CMOL (Conspiracy Mesh Optimization Pipeline), and I ended up removing some of the optimization routines that could be handled in another way by DirectX himself. And by doing so, the GenerateAdjacency problem was also solved! This way, the meshes are more perfect and faster than ever! πŸ˜€

Also, I’ve implemented a XML parser system from scratch. With that, I created implicit support for something else: Scene graphs! And this is a very important part of the engine, as some objects might now be loaded directly through a simple configuration file. This is great for scenarios, lights, etc., but also for the future creation of a visual editor for the engine!

With so many new features, something logical occurred! A game is being developed on top of it and I can guarantee that it is already in a very advanced state! Stand by for more news! πŸ˜‰

Advertisements

August 10, 2009

The piano…

Posted in Computer Graphics tagged , , , , , , , , , , , , at 6:38 pm by sagito

Hello again! πŸ™‚ This time I’m bringing you an amazing short story, created in CG by Aidan Gibbons, from Aniboom. The film is about a grandfather who is telling his story to his grandchildren through the piano music. Although very simple, I found it really great. Hope you like it:

August 7, 2009

Hacking a Mac…

Posted in Security tagged , , , , , , , , , , , , , at 11:12 pm by sagito

Hi everyone… πŸ˜› This time I’m posting to bring you some useful information… If you have one of those 49$ external keyboards (not the laptop ones), then congratulations… Your computer is able to suffer the dullest hack ever!

Wait, what…? Apparently the external Mac keyboards micro-controller have some kind of firmware that leave room for the installation of rootkits and keyloggers by some hacker. Well, the operative systems are usually able to detect rootkits by several methods if they are examining the filesystem or a virtual machine. But how do you find a rootkit that is located somewhere else? Answer is: you don’t! These words are from “K. Chen”, the person who found this incredible failure in a computer security.

But does this only affect Mac’s? Well, as Mac loves to build software that is portable it works in every single operating system. The reason is simple… It is running over an external processor, that exists in the keyboard, with its own operating system that only sends characters to the other tip of the USB cable. So, all the computer can see is some bunch of data coming in and he puts it on the screen! I leave you with the video of “K. Chen” explaining and showing the actual hack. Also, you can find the original article here.

July 31, 2009

Constraints

Posted in Computer Graphics tagged , , , , , , , , , , , at 11:11 pm by sagito

Hi everyone! After some absence due to the lost of someone who was very close to me, I’m back to posting… This time to talk about a constraining system that I will attempt to implement within the Conspiracy Engine.

I have been having some problems with some DirectX functions, namely GenerateAdjacency and OptimizeInplace. These functions just crash unexplainably in some memory address that is not in my addressing space. Also, neither the DirectX debugger nor the PIX (tried it in despair), not even the Visual Studio 2008 debugger could do anything to show me the problem… So, I analyzed the assembly code, to find out that something inside the mesh is not properly set. However, I don’t have the means to find out what, so I just commented out the functions and moved on until I have the patience to deal with Microsoft’s brilliant lack of information.

So, I decided to implement a constraining system. Now, what the hell is that? Basically a system of something that constraints something to some other something. πŸ˜› Ideally, this will, for example, stick a camera to a travelling object! Imagine a car in a racing game. We want the camera to be able to follow the car along the track as it moves, otherwise the camera would just be left in the beginning of the track.

It is important to say that… I never, ever, whatsoever, tried anything even near such a thing… My basic idea so far is really making an object stick with other… You could say that this can be achieved using hierarchy. Yes it could! However, I think some more flexibility is desirable… For example, if I want to attach a gun to my vehicle, I would probably like to place it in the door or in the roof… I need something that allows me to control its position and the constraining system will hopefully give me that kind of offset.

I know that there is a huge number of possible constraints to be implemented. However, I will stick to this one at the moment, but I will create a solid enough structure that can be expanded to some other constraint types further on… For now on, I will be keeping you posted! πŸ˜‰

July 26, 2009

Octree in DirectX

Posted in Computer Graphics tagged , , , , , , , , , , , , , at 11:27 am by sagito

Hello everyone! Back to some news from the Conspiracy… πŸ˜‰ This time I’m implementing a feature that is quite new for me. An octree! Ok… Wait… What’s an octree? Well, an octree is basically a technique for dividing the drawing space. You start with a huge cube which surrounds the entire scene. If there is something inside it, then you subdivide that cube in eight smaller and identical cubes. Then, for each of these cubes, we must check if there is something inside them, if there is we subdivide them again, and so on…

Ok, now… Why is this so useful? Lets consider rendering… It is not necessary to render everything that we don’t see (because its behind us for example). This seems quite logic to me. But, the DirectX backface culling and occlusion system should be capable of doing this, right? Yes and no! In a matter of fact it really does not render the objects that we can’t see… However, it sends them to the graphics pipeline, executes a draw and only checks if they are visible afterwards. Only at this moment it decides if it really sent to the screen or not. With an octree, we are actually able to avoid such a thing, because we just don’t sent the objects which belong to an octant that we cannot see to the pipeline, avoiding some unwanted overhead.

Another example is the picking! Why try to perform picking on something that we cannot select? It is a heavy operation and we want to be able to ignore such operations if they are unnecessary!

However, there is a small problem, at least, with my implementation. I can reach 6 iterations of depth in an admissible time… Seems that these are few iterations, and maybe they really are… But if we think it through, each subdivision creates 8 space divisions. So, for 6 iterations, that stands for 8^6 = 262144 divisions (maximum). After doing the maths, this seems quite acceptable now… πŸ˜›

So, standby for new updates, as they are coming fast! πŸ˜€

July 12, 2009

C++ Reflection

Posted in Computer Graphics tagged , , , , , , , , , , , at 10:48 pm by sagito

Today I faced a different problem while trying to build an external interface for the Conspiracy Engine… As it was built on C++, which is a compiled (not interpreted) language, the compiler does not have the concept of reflection. In the first place, what is reflection? Reflection is a technique that makes a language able to know, observe and modify its own structure and behaviour. For example, if I have a class A that wants to know which methods and variables are in class B, I just ask the compiler to tell me. This happens, for example in C#, where we can ask the compiler for class methods, variables, and even execute the methods if we want.

Problem is: There is no direct support for this in C++… However, I need that, because my intention is to build an external editor that can interact directly with the engine like the CryEditor, for example. So, I’m trying to find a solution! There are several ways of attempting such a thing. The first one is to read through the debug information… This is not viable because different compilers use different approaches for debug and the program would have to be always built with debug information (which is huge).

Second solution would be to create a compiler that supported reflection for C++… I have already create one (not for the C++ language!) and I guarantee that it is not something neither pretty to see nor easy to implement. Third solution: Create a specialized pre-processor that could build over the class descriptions… This solution could be viable… However, parsing the C++ language is not trivial and would require a two-pass-process which would introduce a huge overhead.

So, there is no solution for this problem? What if the engine had a specialized class that would store the data for reflection? Every class that derived from this base would register their variables and methods in a global storage that could be accessed from any other class. This is not the real reflection that we are to, but it seems like a nice approach. And it contemplates the cases in which a variable (or class) is sealed, i.e., not accessible through reflection. In that case, the class simply does not register its variables or methods! This approach seems to be the best one so far and I have already implemented it on Conspiracy.

So far it is working fine! πŸ˜€ I should give you some news very soon about the new editor for Conspiracy! πŸ˜‰

July 8, 2009

Sky is not the limit!

Posted in Computer Graphics tagged , , , , , , , , , , , at 9:40 pm by sagito

After a short break due to WordPress maintenaince, I’m back to post about the new stuff that I implemented in the Conspiracy Engine! It now features skybox support, collision detection and a very complete particle engine!

Implementing a skybox was pretty easy. For those of you that do not know what a skybox is… Well, it is pretty much that, a box that represents the sky. So, what about that, why can’t it be just a cube with some texture mapped like every other object? Because unlike other objects, the skybox must move with the viewer… I.e., the user cannot get out of the box as the skybox itself must move with the camera. Just like a person can’t reach the horizon! So, how can one implement a skybox? Pretty easy, you get the view matrix (through IDirect3DDevice9::GetTransform(D3DTS_VIEW, &view);), reset the last row to 0.0 except for the last value and set the new view matrix. After that, the world matrix must be set as an identity too in order to remove any unwanted transformation. Then we can render the skybox! After rendering, we put back the old view and world matrix.

For collision detection, DirectX already provides some very useful functions that automatically calculate the bounding box and sphere for a given object! After that, I just took some optimization measures and converted the bounding box to an axis-aligned oriented bounding box (see http://www.toymaker.info/Games/html/collisions.html for more info). Then, the objects are tested for collision… If a collision happened, it is propagated through a chain of responsability to some entity that handles the event or discard if no one does…

Finally, the particle system was based on a tutorial from CodeSampler (http://www.codesampler.com/dx9src/dx9src_7.htm). The system described in this tutorial is awsome and very complete! Also, the code is very well structured and commented, so it was pretty easy to implement this too.

To end this (already long) post, here is an image of the engine with the skybox and the textured cube:

skybox

July 7, 2009

Textures!

Posted in Uncategorized tagged , , , , , , , , , , , , at 12:06 am by sagito

After a long, long day of work, I’m proud to announce that the Conspiracy Engine now feature textures (finally)! Well, textures do not use to be such a pain, why did it took so long this time? The answer is quite simple… When exporting the object data, 3D Studio Max exports the (X,Y,Z) vertex data and the (U, V, W) texture coordinate data. However, I was surprised to see that I had 8 vertices in my object and 12 sets of texture coordinates… Well, this made sense, because a vertex shared between edges may hava different texture coordinates along each face!

The problem is that 3DS does not keep any kind of relation between one vertex and its texture coordinates. So, we must first ask the face which vertices and which texture coordinates it uses and only then attempt to relate both these kinds of vertices. I could have done this the easy way by just ignoring repetitions of vertices and letting DirectX handle the optimizations. Of course that I chose not to…

So, I had to create two auxiliar data structures to aid me: An Hash Table (with customizable rehashing) and a Pair. With the Hash Table I was now able to set keys for each vertex individually, thereby removing repeated indices and vertices with ease! The Pair was just a helper utility that I used to handle some data more easily. However, I think that these structures will prove worthy in the future, as they did now! πŸ˜€

Well, here is the actual result from all this work:

textured

Tomorrow I will be working with collisions, although that should be a pretty simple matter to handle… πŸ˜‰ As promised, I will be keeping you posted!

July 4, 2009

Kiwi!

Posted in Uncategorized tagged , , , , , , , , at 10:30 pm by sagito

This time, I’m bringing you something quite different! Kiwi is a short CGI film, created in Maya, that tells the story of a Kiwi Bird who wanted to fly. The graphics aren’t wonderful, but fit pretty well in the overall look of the movie. However, that can be easily forgotten due to the wonderful (although sad) story behind it and to the great animations.

Just loved this video, hope you also will:

July 3, 2009

3D Model Loading

Posted in Computer Graphics tagged , , , , , , , , , , at 12:07 am by sagito

Hi all! πŸ˜€

After a small time without posting anything, due to an exam which happenned today, I’m now proud to say that the Conspiracy Engine is already capable of loading Β three-dimensional objects from the CMF format defined below. It still does not try to load neither textures nor materials, but the geometry is already being properly loaded!

In the past, I have tried to create a mesh from a format other than .X and I failed because I just couldn’t get access do an ID3DXMesh* vertex buffer correctly. Either the data was scrumbled and corrupted or the mesh would just not grant me access to the buffer. This time, I tried to adopt a different system and I created the mesh with different pool and memory flags. Apparently, this did solve the problem! πŸ˜› However, I’m still looking forward to see if that really stands when I try to put some animations within!

I will be posting some screenshots very soon! The Conspiracy engine is now getting really solid and robust. I could even say, that even in such an early development stage it already is more robust than all of my Enoch engines all together!

So, what is it needing now? From my perspective, mainly two things… A scene file loader, which takes a file and builds a scene from it, and a graphical editor. This graphical editor should be a tool that would let me import new things into the game world, position stuff, create AI routines, etc… Something like all real engines have! And I’m looking forward for the challenge of developping such a thing.

Will be posting news pretty soon, stand by… πŸ˜‰

Next page