Ecliptic Space [SOURCES] [Deferred shading]

Zip : http://dl.dropbox.com/u/13388237/Ecliptic.zip (/src/main.py - edit this file for options)
Video : http://www.youtube.com/watch?v=UZKlhkUWfZY

Commands :

  • arrow keys to move,
  • left mouse button to interact,
  • right mouse button to create light,
  • middle mouse button to check energy levels,
  • esc to quit.

Code license : BSD 3.0
Assets license : CC BY 3.0 creativecommons.org/licenses/by/3.0/

This is kinda a post-mortem article about the game Ecliptic Space we made with MJ-Meo for the 64digits three months long rpg competition. We couldn’t finish it in time ! Hence the ‘game’ is far from being finished and polished, there is only few mins of ‘gameplay’ and I think scales are off !

As for the tools used : Blender, Audacity, Krita, Inkscape, 3d-Coat, Gimp and of course Panda3d !

The purpose of the project was to create a game with rpg elements, from scratch. On my side, I did the graphics and shaders stuff, MJ-Meo was on the programming side and made the main code structure and the music. Ecliptic Space is (originally) an adventure-puzzle game with rpg elements.

First part of the project was to make some concept drawings to give us some ideas about scenario or look of the game; and as it was a comp’, I had to make my own font for the game.

I tried to make a seamlessly working pipeline between Blender and Panda3d; moreover I lost the first month on trying to get anisotropic speculars in our game, with Ward lighting model, it was working very well visually, but the fact that I had to splash random colors on textures without having direct visual feedback was annoying, plus the way I made the shader was wrong; I made a texture by code containing all materials information (material index actually), I won’t enter into details there, but the problem was only one material could be applied on a full model in practice.

So next to this, I tried to re-implement the Strauss lighting model like I did before, the problem was the same, I have no Strauss shader in Blender to get direct visual feedback on texture painting, and the way you have to use albedo textures with Strauss model wasn’t good to me.

So, finally I went back to the classic Blinn-Phong model, so I could have a almost 1:1 result between Blender preview and Panda3d final visual result. Our custom lighting shader was using the same light attenuation equation than Blender with spherical point lights (in conclusion, less is more !).

The pipeline was working this way : in Blender, we could define what objects were collider meshes, sensors, lights or simply ‘visual’ objects; we were using Blender game tags for this. In Panda3d we go through the exported .egg and check for tags; for each particular tag do some things.

For the rendering, I forgot to mention we are using a deferred shading rendering here, so transparent models were problematics, I simply rendered transparents objects in its own buffer and composited it with main render with a simple z-testing; I think the result is OK, but transparent models are not affected by defererred lights in any way.

We choosed to use deferred lighting system, because one gameplay element of the game was the player could create light with his hand, so we needed ‘fast’ performances here.

I couldn’t have deferred shadows working, again :smiley:.

The hand of the player is fully animated and the player can check his energy and oxygen levels with the help of a screen integrated into the arm. Here a simple uv scrolling is used to display all different energy/oxygen levels combinations.

I don’t like fullscreen glow effects, so we had custom shader for glowing objects; models in blender had a fourth texture slot containing the amount of glow (green channel). In Panda3d, the glow buffer was using the albedo texture as the glow color and the green color of the fourth texture was used as the glow power (more green = more glow, less green = less glow).

So actually, in Blender I had to setup 4 textures slots for each model (was really annoying actually :smiley:) : diffuse, normal, specular, misc. So we had colored speculars, and as we are in a space ship, there has to be some metallic objects here or there. The main problem was the time it takes to make 4 custom textures for each model, hum.

The AI voice of the ship was made with a text-to-speech software.
Physics and sensors are using Bullet, we use the integrated ray-cast as well to interact with objects.
A human model was made from scratch, for interior ship construction and for the dead bodies the player should find in the abandonned stations.

For the ingame texts, a small class was made to make text images from the font’ .png letters as I couldn’t make a viable .ttf out of the font. The texts are made before runtime.

The game is locked at 30 fps, or physics go wild, and I think constant framerate is good thing.

Final note : note there is a use of globals in the code (I wanted to try) and there is lot of things hard-coded, so I don’t think it’s good structure to follow but maybe you can grab a thing or two for your own projects !

About the main inspiration, there is the movie Pandorum and the game Crysis 2 mainly.

Credits for sounds fx :
Mike Koenig
BlastwaveFx.com
dobroride
Brandon
Stephan Moebius
Loge the 60th
Smoothie
Marianne Gagnon

Shaders were created with the help of : Nvidia CG tutorial and D3D10 book from gamedev http://content.gpwiki.org/index.php/D3DBook:Table_of_Contents.

PS : gonna reformat this properly if it’s hard to read, plus I notice screenshots are very dark when not fullscren :confused:
I can post blender files if someone wants to continue this game, just ask for it !

Congratulations Manou and MJ-Meo, that’s very cool! What kind of problems did you have with unlocked FPS rate and physics? What is that “D3D10 book from gamedev”?

Hi flavio !
here the book : http://content.gpwiki.org/index.php/D3DBook:Table_of_Contents

For the locked framerate, that’s because we couldn’t make mouse look framerate independant ! And to protect my gpu from overheating too :wink: For the physics, collisions with walls give more bounce with a more important framerate, and hand animation were made @ 30 fps in blender.

Manou, it’s so good to see you here again. I thought you abandoned us, taking your incredible lighting tech with you :wink:.

The game looks great. It’s a bit dark, but I assume this is a design decision, simply. Would be nice to see a video with more lights in it.

I wonder why you wanted to stick to a Blender → Panda pipeline for materials, instead of writing some kind of material editor? If you avoided building complex interfaces (like graph based stuff) it would’ve taken relatively little time and would be a lot more flexible. The downside, of course, would be that it would force the artists to use two apps instead of one, but that’s the case with most engines anyway (most notably UE3 and its node-based material editor).

By all means, get into as much detail as you can.

Hey,
for the blender => panda pipeline, that’s because I wanted direct feedback when I paint textures in blender, so the result is the same in panda. Problem is I had no more time then to actually paint these textures :arrow_right:


For the ward model, it gives very good results for metals display but Idk if it’s possible to have it in a deferred lighting system.
If I remember well, because I have not the full ward version anymore :

  • I had a class that outputs a .png material index, the values for different materials found in ward paper are converted to RGBA, so each pixel of this png is a different material http://paste.ubuntu.com/1150781/

  • the models had a fourth texture slot, the red channel value was used as the x coordinate of the png material index :

  • in the lighting shader, I get the red channel of this 4th texture slot, I have then the corresponding pixel of the material index. The shader then reads the RGBA values of this pixel (material index) and I have 4 new values corresponding to ward paper : http://paste.ubuntu.com/1150802/

Now problem is, this red value in the texture is interpolated with texture filtering; let’s say pixel 1 is metal and pixel 2 is wood, the new filtered pixels will have a new red value corresponding to something else than wood or metal in the material index.

If I use no filtering on textures, then the problem comes from the deferred shading system : if object 1 is metal and object 2 is wood, as the result of the scene is a 2D texture in the lighting shader, the borders of objects look wrong (metal+wood).

This could work if the full model is only made of one material, but I wanted different materials on same models so …

Plus the ward model is very expensive compared to phong, they have good documentation on gpu usage of different lighting models in the D3D10 book.

Hope it helps, I don’t know if my explanations/english are clear :smiley:

Brilliant. What a great contribution…

Holy Panda!
This looks pretty fantastic!
I’ll definately grab the source and have a look at it :slight_smile:

Big thanks!

Thanks for comments,
I’ve updated title so it’s more explicit.

edit: coppertop, btw I reused your omni shadows in the game ! it’s not activated by default but you can reactivate it in buffers.py if I remember, it works only for the created light and one shadows caster at a time.

Manou, it’s impossible to express how awesome that is to read :smiley:.

Good stuff, great visuals.

I’m using ubuntu and panda 1.8. When I run main.py, I can see the game window loads and the words Ecliptic Space in the center.

But after a few seconds the game crashes with this output:

Known pipe types:
glxGraphicsPipe
(all display modules loaded.)
rotationLVecBase3f(0, 0, 0)
Segmentation fault

My graphics card is:

nVidia Corporation G72M [Quadro NVS 110M/GeForce Go 7300] (rev a1).

I’m using the nvidia accelerated graphics driver too.