Showing posts with label shaders. Show all posts
Showing posts with label shaders. Show all posts

Friday, 21 November 2008

Flanges With Everything

Can't say I like the turquoise colour, but it'll do for the moment. Refraction and depth blending seem to work acceptably well, and the water is not too bad looking in motion. Still pondering the best way to integrate the dynamic lights.

I reworked the way texture types are distributed over the cavern, so it biases the moss (purple!) around the water with the 'shrooms. Said shrooms are currently not placed exactly on the ground, instead they use the average height for a tile and therefore tend to float a bit, which when you have shadows and the right lighting angle becomes painfully obvious.

It can't be seen in this pic, but there's also support for emissive maps now. The mushrooms have tiny glowing spots which will be re-worked into larger glowing spots for a future screenshot. Unfortunately the addition of the emissive data to the pipeline has gobbled up most of my last free render target... all further information will have to be crammed into the three spare alpha channels. I'm guessing either a specular channel and material indices or a handful of miscellaneous BRDF parameters will eat those.

My hope is to do some content generation this weekend, but I strongly suspect it'll disappear into less fruitful activities. Still, you never know!

By the way, anyone know of a good (preferably open source) alternative to the GIMP? Its support for working with images using the alpha channel in any non-trivial way is frankly terrible.

Thursday, 20 November 2008

Splish... splish...

Hey, WoW hasn't consumed my soul entirely! Or maybe it's just not finished digesting it.

Or possibly a darker entity already laid claim on it, in exchange for a Mars bar and some ruled paper in an unholy pact outside a lecture theatre many, many years ago.

Anyway, li'l update. I added water tiles and subsequently a crappy water shader (it can and will be much better... no refraction, no depth-based fog, no falloff in the shallows, no influence from the deferred lights, no dynamic interactions... the list of things currently missing goes on).

I also added a rock, and changed the previous mushroom mesh to look a bit less rock-like, and spent some time tidying up a few bits of code that just couldn't be ignored any longer. Experimented a bit with different distributions for the instanced clutter - mushrooms are now more likely to occur near water, and rocks tend to be scattered around natural walls.

Tuesday, 7 October 2008

Whoops, massive lack of updates

So, many deadlines at work combine with a resurgence of my WoW habit to completely destroy my hobby-code productivity...

With the next expansion looming very near (and a pre-expansion patch apparently within a week), Wowcrack is undergoing some very bizarre changes. I may splurge about the design decisions later, because they're quite interesting even if mostly specific to the online genre.

In the past month I did get a few things done. Some general hackery, a new model to replace the tentacles for general clutter, and a starter particle system (here used to show where the test lights are):



Particles are entirely GPU-side, all the simulation is done in the vertex shader operating on some static random buffers. This means they're only good for simple things, but they're pretty damn quick, entirely deterministic, and quite fun.

'Shrooms need a diffuse texture, and probably a redesign. The problem with things like these familiar mushroom shapes is that from a top-down perspective, they look a great deal like rocks. Bright colours/spots/etc would help with that, but I think a better choice would be to choose a more interesting shape for the fungi and flora. After all, they're present in a vast array of bizarre shapes in real life, so I see no reason to stick with the common toadstool shape in a fantasy cave-world.

With luck, I'll have more time for code and blogging soon. 'Til then, enjoy the minimal sparklies!

Edit: SSAO is turned off in the final composited image at the moment, because it has returned to looking a bit arse. Tricky thing to get right it seems.

Monday, 8 September 2008

Even more deferred tentacles

Just a quicky today.

These are lighting-only shots showing the same scene with and without screen-space ambient occlusion, the latest hacktastic post process to take the rendering world by storm. Unfortunately I have to concede that even my less than stellar implementation does add a lot to the rendering, for a moderate cost, so I guess I'll be jumping on the bandwagon. It's an especially useful technique when combined with deferred lighting, as attempting any real shadowing with a bucketload of small point lights is very bonkers, so the illusion that the faked ambient occlusion provides is doubly useful.

As an aside, I do like my dungeon fairy lights. They add such a nice ambience...

Before (no SSAO):



After (mit SSAO):

Friday, 5 September 2008

Deferred Tentacles

Further work on the deferred rendering side. I finally found an example online using FBOs with a stencil buffer, and thereby discovered that despite using a combined depth-stencil renderbuffer it needs to be attached to the frame buffer object twice, once as a depth attachment and once as a stencil attachment. Sigh.

That done, efficient rendering of small lights via z-and-stencil-tested spheres works nicely!

Behold the scene, containing no less than fifty ickle lights, plus the large shadow-casting light from the player's avatar.


The majority of the screen is taken up by the final composite image. On the right, small sections show a sample of the buffers involved (yes, I don't even turn off my debugging chuffle before posting, I'm that lazy). Top is the SSAO term (very low intensity in the final image, as it looks pants). Below that are the lighting accumulation buffer, world-space normal, and finally unlit diffuse buffers.

Lastly, the image displays some filthy aliasing as the source render targets are only 512x512, violently scaled up to match the screen resolution. I should fix that.

Edit: here's a version using 1024x768 buffers throughout. Ouch, bye-bye framerate. Need to fix my absurd pixel shader usage methinks.

Wednesday, 27 August 2008

Visual fluffs


As my other post is waffly and dull, I thought I'd post some equally dull screenshots.

First, we have soft shadows and a general framerate improvement. I found I wasn't using buffer objects for my mesh streams (bad!), switched to position-only streams for shadow rendering when possible and changed the shadow buffer format to rgba16f. All this has reduced the frame time hugely, even after I started adding more crazy stuff. For comparison, a similar scene with blurred shadows was previously in the single-figure frame rate. Ouch. Still vastly too slow at the moment of course, but moving in the correct direction.

The soft shadows are done with a simple 3x3 guassian blur over the cube. It has errors on the cube edges for some reason, as can be seen in the nice black line across the lower right quarter of the image, but even with fairly low res maps and a small kernel the reduction in aliasing makes things look nicer. Hooray!


The second screenshot shows a half-finished unsmoothed SSAO post process. It's using a deferred rendering setup, with a few render targets for diffuse, normal, depth and lighting information at the moment, although for this screenshot only the depth info is used of course. Lots to do here, and I'd like to get a scene with more interesting visual fluff to show off the AO effect better...

Anyway, hopefully that helped balance up the wordiness of the previous post.

Wednesday, 30 July 2008

Hexy texture madness



Testing out the sub-texture stuff with normal maps and shadows. Right hand images apply textures on a per-hex basis, whereas the others just have random perlin smeariness.

Interpolation between hexes is still enborkinated, so the hex edges display some very rough geometry and there're no smooth variations. Also, the ugliness of the shadows is getting to me...

Wednesday, 13 February 2008

Basic asset support

Huzzah! Primitive Texture, Shader and Material objects are implemented. In the end I gave up trying to work out where the GL -> Java -> Scala chain was breaking down with glGetInfoLogARB, and just started checking the shaders by hand with the GLSL Syntax Validator (which, by the way, is rudimentary to say the least).

That done, it was but a short head/wall reciprocatory interlude before DevIL was playing nice too, and I could start cobbling together some test shaders. Of course, lacking anything except Paint.NET (a very nice but somewhat lightweight image editor) I didn't spend long on the textures. Behold the mighty effect of a Julia set rendering combined with Clouds for a normal map!


There's also a bit of hackery going on with the worldspace position and frac (or fract in GLSL parlance, because that extra 't' sure makes a difference to legibility! Bastards.) to draw a rudimentary grid too. My thinking is that a shiny'd up version of this will be on a button - maybe tab - to help with tactical stuff on natural terrain where it's hard to gauge distance by eye. The nasty big black grid is just an error in the normal map. Yes, I'm so lazy I can't even be bothered to make any of it tile nicely at this point. Or give them mipmaps. Aliasing is lovely, don't pretend you don't want it.

Also great news, the Java wrapper for SQLite plays nicely with Scala. I've been wanting to do this for a while and not done it because it'll take some planning, but having a real database at the heart of this game should add a huge amount to extensibility. The ultimate aim is to have in-game creation of new enemies, items and spells, at least to a limited degree, by allowing editing the databases through console commands. Coupled with LuaJava for scripting, this should be fairly powerful, but will need a vast amount of work to make really nice methinks.

Even just creating variants and advanced forms of existing game objects could be a massive bonus though. After all, roguelikes and CRPGs in general traditionally reuse enemies painted a slightly different hue, often to denote some elemental or behavioural trait. The idea of wandering down a dungeon, finding a level that looks a bit sparse and creating a new flavour of orc with red skin and tons more hitpoints than his brethren is just... good. I look forward to seeing if I can pull it off.