Saturday, March 24, 2007

First real screenshot

Oh yeah, finally got it all working. I hacked up a quick scene just for the sake of it. I now got a fully working environment...except for the materials...and textures...and...bah ;) What's more impressive than a nice Hyundai Scoupe for the screenshot? Can't get any better than this.

XNA project update

Still working on the Maya exporter. I may release the code or just the DLL for anyone to play around with it once it is complete enough. As for now it just exports a whole big pile of meshes in world space, taking into consideration lighting and texture coordinates cuts in them.

I still have some problems with non-coplanar polygons as I cheated a little when triangulating the mesh....I assumed most weren't so I could triangulate them myself using a simple triangle fan. This saved me quite some time but now I got to fix this. It's an iterative process...just wanted to get stuff on the screen as fast as possible. I just added the texture coordinates as well as before I only had the positions and the normals.

It's a long process building the rendering engine as well as the different exporters, you need to do a lot of back and forth between both. My exporter is fully written in C++ whereas my engine is written in C# using Microsoft XNA.

As for Maya, I can't say I like it that much compared to 3dsmax, even though it is surely better built. But then when it comes to the GUI, 3dsmax is much more simpler and straightforward to use most of the time. Maya seems like it was made by programmers...for programmers. It is somewhat logical, but cumbersome to use, it doesn't hide the complexity very well, if not at all.

I'll post new screenshots once I get my environment to display with materials and stuff...as for now I don't even deal with different materials and textures, I'm not even exporting them right now, that'll be the next step toward success!

Monday, March 19, 2007

Linked List concept patented!

The world is doomed I tell ya! Someone succeeded in patenting the "Linked-list"

Linked List Patent

This is sad. This proves that software patents are again useless and stupid. So I guess we'll have to stop using Linked Lists in our code, else we might get sued o_O

You gotta love the patent system...

Sunday, March 18, 2007

Back from GDC and Maya Exporter

Oh yeah, finally back from the 2007 GDC held in San Francisco. It's been great except for the travel part...but the story is far too long for me to tell. Got sick because of it too...

So with all of this I hadn't much time to update this blog. Now here's a quick update, my Maya model exporter is working.

Yeah I decided to switch to Maya since I didn't have the 3dsmax SDK and was using MaxScripts which kinda sucked for this. On a side note, I like the Maya API, but it is not so much simpler to export a hardware friendly mesh than it is using Max.

Most 3d authoring softwares uses different arrays for the vertices' positions, normals, colors, texture coordinates... so you got to somehow re-create your own vertex array and dupplicate the vertices based on cuts in the lighting, coloring or texturing. The best example is a cube where you want to have some kind of flat shading on all the faces. So the way those are represented in 3d editing softs most of the time is by 8 vertices and 24 normals. If the cube was "smoothly" shaded, there would have been only 8 normals also. So what you got to do is to match each normal with each vertex and dupplicate them when needed. And you got to do this as well for colors and texture coordinates...that is if you want your artists to see exactly the same result in your engine.

On top of that, Maya lets you have non-coplanar polygons and each polygon can have more than 3 vertices so you somehow need to triangulate the mesh as well. After a bit of grunt work, I finally came up with a lightning fast exporter.

I still need to extract all the skinning information like the weights and bone indices per vertex and the hierarchy itself, this will be further down the road as for now I'm just focusing on loading my data and having some kind of world rendered on screen in my XNA C# engine.

Monday, March 5, 2007

Quick update

I finally removed all the effects (FX) from my project and moved on to a custom shader system. It is much more elegant and talking about the vertex and pixel shader constants they can more easily be managed like they should.

I implemented basic per pixel lighting without normal maps though but anyway I wasn't into writing shaders as I still need to work on my resource loading/accessing system before I delve more into the graphics.

I must say I like the way you can incorporate your data right into your C# project using XNA and you can provide importers / converters for each resource that will get called when you build your project. As for the shaders I'm using NVIDIA's FX Composer to basically validate what I'm doing and it works like a charm. After that I just break the code into a pixel and a vertex shader and I bind the constants to registers and voila, I got myself a new shader.

I haven't decided yet which route I will take for my lighting system but I've been thinking about it lately. I want something that will integrate easily without having to do complex mesh setups in an external editor. Yet I want to be able to support an unlimited number of lights per mesh. Maybe I just won't, unless I do some multipass techniques... I'll see.

More to come

Sunday, March 4, 2007

Some data finally

Since I didn't have my car this weekend I decided to code some more and while the result is not that impressive it's still going forward as planned in the right direction.

I wrote a very small exporter for 3d studio max that generates XML files for my meshes. I was somehow forced in using MaxScript for that and I don't quite like it but I didn't have the SDK so... Anyhow, it very well did the job. So I am now able to export some meshes from MAX and have them displayed in my engine. I just wrote a simple shader using effects and .fx files... but I'm not too fond of this either. I will probably be switching to writing separate pixel and vertex shaders since there seems to be a somewhat non negligible overhead to Direct3D Effects. For example it messes up all the constants all the time.

I did also some work on my editor which you can see in the screenshot below. What I like about it is that it is very much seperated from the rest of the engine, yet it works right in the engine. I just spawn another camera entity that is made for my editor and it just works. I'm planning to have an in-game editor from the ground-up as it'll save a lot of time later on.

So here's how it's looking right now...never mind the weird colored mesh ;)

Sunday, February 25, 2007

XNA

I played around with XNA and I must say I'm quite pleased as how it is designed. It is very easy to start a new project and try stuff without having to go the hard route of setting up everything correctly in order just to render a single polygon flat shaded on a Direct3D surface.

Basically, you derive a class from the Game class and you register different GameComponents that will be updated every frame. The game loop is built-in as are all the message dispatching stuff so you don't need to worry about that.

As for me, I started from scratch a new game along with an editor and I found a way to incorporate the editor easily in-game. I just created a GameComponent for it so it will get updated along with my other engine related modules. The best part of my editor though is probably my Entities editor and the beautifully designed standard Windows.Form.PropertyGrid control. All you have to do is define some public Properties in your entity classes and you'll be able to edit them easily in a property grid control. I like how you can have a lot of control and flexibility in C# .

Here's the first screenshot



There is nothing to see yet in the main window as I was working on the entity system along with the editor. Next step will be some rendering :)