Posts

Screenshot Progress Update!

Image
I've made a lot of progress recently focusing on refining my procedural planets and atmospheres.  Added into the mix are multi-core particle systems, procedural nebula and AI.  I'm almost ready to post videos but am excited that I have now fully tied in the galaxy to the rest of the engine, meaning totally seamless travel between every star in the galaxy all the way from warp-drive-speeds down to landing on and running around planets in first-person. Enough talk, here are some screenshots of my recent explorations : Some kind of desert planet, looks a little bit like Australia! Here's a shot of my prototype cloud system.  The clouds are image based, the idea being to use a particle system or maybe cellular automata on the GPU to create procedural cloud maps for each planet.  The clouds are incorporated into the atmosphere scattering shader, meaning that they get nice sunset lighting and they also cast shadows into the atmostphere.  Plus you can p...

Procedural Planets

Image
I've started work on the procedural planets, here are some initial screenshots.  Like everything in Pegwars, it all has to be seamless, from flying in outerspace to orbiting planet and moon surfaces to landing and running around. Each planet's geometry is formed by tessellating an icosahedron.  This shape was chosen to help make each vertex as equidistant as possible in the final mesh; tessellated icosahedra perform better in this regard than tessellated cubes or parametric spheres, and have the added bonus of having triangular faces, making it easy to tessellate and render. Each triangle face of the icosahedron is recursively split at the edge midpoints to generate the next level of detail of geometry, as needed.  For performance reasons, as you don't want to be allocating GPU resources at runtime, Pegwars has a fixed set of vertex and index buffers for planets and moons - meaning a maximum of 10 planets at once, each with up to 3 orbiting moons.  Once I...

Atmosphere

Image
A seamless universe is important to the Pegwars experience, and that means procedural atmospheres you can see from outer-space all the way down to the ground. The Pegwars atmosphere shader is drawn in screen-space, and composited over the screen using the depth information from both near and far depth textures.  The shader itself simulates Rayleigh and Mie Scattering by ray tracing through and integrating against the atmosphere volume, taking into account the air density at any point based on altitude and what's in the depth buffers, the relevant ratios of gases and particulates, as well as other procedural variables. As well as drawing to the screen, the atmosphere is also drawn into the near cube-map for reflections, ambient lighting and the all-important SSDO.  This way objects fit in the scene nicely, no matter what planet you are flying around.

Pulse Lasers

Image
Finally I have implemented the Pulse Laser onboard system.  This was an exciting build, as it leverages a number of features I've been wanting to play with. Ship System Each Pulse Laser attached to the ship is a ship system, and has a power capacitor which draws energy from the main power unit.  When you fire, it fires continuously until the capacitor runs out of juice.  After that, the rate of fire for the lasers is limited to the capacitor's recharge rate.  What this means is if you let the lasers fully charge, you get an initial ultra-burst of pulse laser fire, followed by a slower volley that can be sustained indefinitely. Rendering It's important to batch objects.  A GPU can draw 1000s of lasers in the blink of an eye, as long as you submit it with 1 or 2 draw calls.  If you draw each laser individually, you'd easily use up your 33 msec or more. In Pegwars, a python pulse laser fire event writes a pulse laser into a single dyanmic ve...

Oculus Rift Integration

Image
There's still a lot of work to do to get the rift running smoothly, specifically I can't seem to get the thing to focus properly in fullscreen mode (but works great in windowed!). I found the SDK alright, but a little basic.  The examples and API itself use a RH (right handed) coordinate system, which is not what DirectX uses, and I wish they supported both out-of-the-box instead of me having to map between them. "Oh here's a quaternion providing the headset rotation, but it needs its coordinate system remapped"..uh-huh.  Oh yeah, some documentation on using the rift with DirectX would be nice!!  OR am I the only one using DirectX these days?   In order to render for the rift, you need to draw your scene twice, with the camera offset by the distance between your eyes.  It's nice and easy, as the geometry of the rift lenses is such that you don't need to skew or rotate your projection matrices, it's just a translation.  However, drawing the ...

Amusing Graphical Stuffups

Image
One of the best things about working on a game is graphics bugs.  No, not the kind that make you spend a week delving beneath the covers of hideously complicated interactions between CPU API GPU RAM ETC. No, the serendipitous kind! Engage warp drive!  Funnily enough I was thinking about making some kind of FTL effect one day Playing around with SSAO, I got some kind of cubist painting look Ooops, wrong viewport! Hmmm.. this is not the material you are looking for Wrong light map! Not quite the right amount of specular highlight