Daily Archive for July 3rd, 2009

GMOD FSIM part 3

I fixed the problems with clipping! Now you can actually see (most of) the terrain under you! Right now the entire map area is 80 x 80 km, and you can fly all over it. There are no physics yet, but the visualization is more-or-less done.
fsimdemo3

You can also switch to external view of your aircraft, and see it from outside. You can rotate your camera around, stuff like that. It’s still pending some integration with CPU (later), to dynamically load terrain as you move around the map. In theory, GPU RAM limits you to 420 x 420 km (because each cell is 2 x 2 km in size).

The external view rendering is based on physics data you enter into simulator (it reflects actual simulated positions of wings, their sweep angle, stuff like that). It looks like this:
fsimdemo4

I don’t know yet how it will work on Garry’s Mod (I’m away, so I’m testing it on EmuFOX), but it seems to be fairly fast. As I said before, I added hardware terrain rendering support, and that’s what is used here right now.

This renderer might even serve as a fine rendering engine for some sort of a Starfox remake for BlackFOX, it’s a thing to consider. Right now I’m not sure if simulation will be entirely on CPU, or using expression gates for equations, because it seems that both of them will be as fast, but I’m still thinking.

P.S. I wrote these posts, and didn’t re-read them, so they may contain some Silly

GMOD FSIM part 2

Here’s virtual cockpit for my flight simulator – it uses three ZGPU’s to cover the cockpit, and draw 3D image of horizon, and maybe some terrain.
gm_wireconstruct_rc0008

It stands on some hydraulics – those are used to simulate G-forces acting on the pilot (you can feel the movement in-game – your camera moves as the machine tilts forward or backward).

This cockpit is based on cockpit from my other plane – and it will be later refitted with new instruments, LED’s, indication stuff like that.
gm_wireconstruct_rc0009_1

This will be very laggy in-game though – each of those 3 ZGPU’s will render complex 3D image, it will drop FPS a lot (possibly they will have limited framerate, or some hacks to make it faster, and maybe I’ll be able to add some optimizations into ZGPU to make it faster).

Oh yeah, those three monitors draw one image, and it was hard to make it properly project image on those screens – even though I would actually have to create new projection which could project image even in case when cameras visual plane does not match with actual screens plane, I went other way and just setup three cameras pointing in different direction.

It’s not pixel perfect, but it’s visually fine. These cameras are located like this:
monitordemo

You can see that one area is left out – I fixed this by moving cameras around until image more or less was matching image on other monitor. But there is still error in perspective transform near edges of the screen.

GMOD FSIM part 1

I have an idea to make a small flight simulator inside Garry’s Mod. It will be based on GMOD supercomputer architecture (CPU, Expression gate for hardware physics equations processing, and GPU for visualization).

Right now there are no problems with implementing physics, but there are some issues with rendering & visualization (it’s very hard to get it draw terrain or anything like terrain, there are some clipping problems occurring).

This flight simulator computes plane physics based on visual model (sort of like X-Plane), except a lot simplier (fuselage is assumed to be cube, but it has decreased drag as if it was smoother), and of course less powerful.

Each plane is defined as fuselage (a cube with specific height, width, length), up to 4 wings (each wing is symmetric, always horizontal, can have variable sweep, can have specific airfoil constants, and can be placed anywhere on the aircraft), up to 4 vertical stabilizers (each one is always vertical, can have variable sweep angle, some airfoil constant stuff, and is it’s airfoil computations are slightly different from wing ones).

I’ve wrote rendering engine to render any aircraft based on that data, but it’s slightly glitchy due to ZGPU’s vertex sorting instead of proper ZBuffer:
fsimdemo

That’s one of aircrafts I’ve made before in Garry’s Mod – although it will handle differently because this simulator simulates different physics (or maybe not, I might be able to make it closer to Garry’s Mod physics, which is in fact what I will do).

You can see terrain in background – it’s test of new feature for GPU that allows hardware terrain to be rendered on screen. It’s fast, but there are big problems with clipping, and I didn’t fix them yet:
fsimdemo2

Also there are problems with lighting and vertex buffer (reported by someone before), I’ll fix these. In the end, as long as you don’t go under terrain (with your camera), it will render fine.

GMOD Supercomputer

I have created first Garry’s Mod “supercomputer” – it’s main difference from regular computer contraptions created is that it uses CPU for data transfer operations, control, etc, and it uses several “streams” of data, each going through Expression gate to do some mathematical processing. This results in very high speed of computations – and this one specifically can handle physics simulation of 64 balls.

There are problems to render those 64 balls right now – that is too much for GPU.

gm_ps_hugeflatconstruct_svn0003

This approach is good because CPU is a lot faster on moving data around, conditionals, stuff like that, while Expression gate is a lot faster when computing single equation – you can combine these two by sending data from CPu to a bunch of Expression gates, and then reading the result back.

I’ve uploaded source code into GWCD SVN, you can see how it’s done (computer save in GWCD computers SVN, and source code into GWCD CPU svn).