Showing posts with label particles. Show all posts
Showing posts with label particles. Show all posts

Wednesday, 20 October 2010

Further Transparency

Particle systems using the new translucency-faking also work now.

So what do they do well?

  • Completely order independent
  • Lit (with fully deferred light sources)
  • Shadowed
  • One rendering method for all translucent objects

And what do they do badly?

  • Look like arse when the camera is inside the smoke volume
  • Perform like arse when the camera is near the smoke volume (fill rate bound? Yick!)
  • Hideous sharp edges to blurred regions
  • Blur is more obvious than transparent areas with low alpha
  • Alpha quantisation very visible at low alpha
Ugh. I'm not sure I like the balance of pro/con there.





A block of smoke using the technique. No approximated scattering yet, so light sources look a bit strange at present.

Monday, 19 April 2010

Wibble!

Mmm, lunchtime blogging.

First off, have a screenshot:


I've been playing with exponential shadow maps, and they're kinda fun. Not sure whether I'll use them over variance shadow maps, but it's tempting. I've also been messing with lit particles, although this has not been superbly successful. The image shows some alpha-tested jobbies that interact nicely with the deferred lighting, cast shadows and generally behave themselves, but the ultimate aim is to have nicely lit smoke effects and they do little to advance that goal.

I've been playing with rendering a lot of small fake-sphere particles to a render target and blurring it as a post process, but it's a bit too crude to work and smacks of megaparticles. I may go for a simple volume rendering approach.

I have moral objections to CPU-driven particles, which precludes the standard sort-and-render which makes such things easy. I'm also avoiding texture fetch in general (I got burned by ATI's render-to-vertex-buffer non-implementation in the past), so simulating particles in a position texture and doing the sorting GPU-side is not tempting either, although I may yet go back to that. In the meantime, the hunt for order-independent transparency continues!


do => for

I can't write much about this because I'm still feeling my way, but using a for expression to perform computation inside a monad is... weird, but quite nice. I'm not sure I prefer it to Haskell's do notation.

It's odd enough that I want to dump my exploratory fiddlings anyway, so here's a stub for the conflict-resolution step for two entities colliding after a movement phase. Note the awesome game logic for deciding the winner:
   private def collidePair( a: Ent, b: Ent ) : (Ent,Ent) = {
      val ab2 = for{
        aPos <- a.get[Int3]("position") if( a("solid",true) )
        bPos <- b.get[Int3]("position") if(aPos == bPos && b("solid",true) )
        aPosHis <- listToOption(a.history[Int3]("position").drop(1))
        bPosHis <- listToOption(b.history[Int3]("position").drop(1))
      } yield {
          val aWins = Math.random < 0.5
          if( aWins )
            (a,b.extend("position",bPosHis))
          else
            (a.extend("position",aPosHis),b)
        }
      ab2.getOrElse(a,b)
    }


Slightly odd exploratory code. Anyway, it crudely rips the current position from both entities, as well as their previous position, and yields an Option containing a tuple of new entities. If any of the extraction steps or predicates in the for chunk fails, it simply returns the original pair of entities.

Errors abound, of course. An entity doesn't always have a 'last' position, and if it does this in no way implies it's a reasonable place to go if it fails the conflict step. The listToOption thing is ugly as well. Bleh. But my original point stands: for is a weird and flexible beast in Scala, which I didn't appreciate before.

Monday, 18 January 2010

May Have Been Driven Mad By Sparkles.



OK, I deliberately pushed the particles way into HDR territory to get the bloom filter to explode. And there are too many particles to start with, this was supposed to be a collection of gently background fluff (fireflies, dust, magical plankton... that kinda thing).

I was playing with the property browser thing for the particle material and accidentally changed the wrong digit in a colour (0.9 -> 9.9, easy enough to do). At this point I think a bit of my mind snapped, so here we have CRAZY sparkles, whirling in madness.

Those not blinded by sparkles may note that the player now has a trail of arrows, showing the last ten moves. Although the final intention is to display only the actions of the current turn (thanks Jotaf! This idea is really growing on me), a possible extension to display a limited action history may also be useful. It might help in making the AI behaviour more transparent to the player, or maybe just as a hint as to where an entity might be if it dives out of line-of-sight.

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.