Sign in to follow this  
  • entries
    162
  • comments
    262
  • views
    167074

Variable Scatter

Sign in to follow this  
OrangyTang

99 views

I've not had much time to work on this, but I did manage to crowbar variable scatter in. The preprocessing to create the scatter map checks a fixed area around each pixel, and a single hardcoded value isn't ideal for every sprite. So I've now changed it so that the preprocessing loads an attributes file and passes it on to the image filter (where the magic happens).

The attributes file looks something like this:
1.0' encoding='utf-8'?>



"Cloud02_scatterMap" backlightRange="64" />

"Tree2_scatterMap" backlightRange="6" />
"Tree3_scatterMap" backlightRange="6" />



Each file node gets parsed and passed down to the image filter, so it doesn't have to deal with xml or parsing at all, which is nice.

And the end result:

As you can see the bigger range used on the clouds gives them a much softer, glowing appearence. Tails remains as before with the default range of 10 pixels, and the trees have had their edge highlights sharpened up by dropping the range to 6.

I'm not really too happy with the preprocessing code in general. It started out as someone else's code and it's quite crude in places. I've been slowly refactoring it over the last couple of months when it's needed extending, but it's very difficult to get certain bits of it under unit tests. It's largely one big monolithic class in some places which doesn't help much.

Still, it works well enough and I've got enough tests under it now that any breakages get spotted right away. I'm also adding more output and error messages to make it more user friendly when something goes wrong instead of just random exceptions and stack traces.
Sign in to follow this  


2 Comments


Recommended Comments

It's looking a lot better, even though I was already impressed with the first shot. However, you can clearly see that you approximate the moon (being a sickle) with only one central light source. It's apparent in the still shot, but I don't think it would mind much when playing. Could you perhaps capture a video (Fraps) and youtube it?

Also, the highlights look really, really nice I think (especially on the gems and the player), but aren't a direct result of SSS, than they are of specular lighting. SSS often results in soft lighting, such as here. Perhaps the highlight itself could also be a parameter, like the effect-radius? Just to even out the dynamic range.

I'm definitely butting in here, but these are only suggestions to (slightly) improve an already amazing thing ;-).

In conclusion: plain cool

Share this comment


Link to comment
Quote:
Original post by Todo
It's looking a lot better, even though I was already impressed with the first shot. However, you can clearly see that you approximate the moon (being a sickle) with only one central light source. It's apparent in the still shot, but I don't think it would mind much when playing. Could you perhaps capture a video (Fraps) and youtube it?

It's not really obvious that it's a point light when everything moving. I've tried capturing videos before via fraps, but unfortunately it captures so slowly it's practically unusable. Probably because I'm still on an old-school AGP card rather than this new fangled PCI Express. [sad]

Quote:
Also, the highlights look really, really nice I think (especially on the gems and the player), but aren't a direct result of SSS, than they are of specular lighting. SSS often results in soft lighting, such as here. Perhaps the highlight itself could also be a parameter, like the effect-radius? Just to even out the dynamic range.

Yeah, it's not really SSS as you'd find it in a 3d engine, nor regular specular, since theres a few approximations and hacks to get it looking good. Ideally instead of the parameters and preprocessing I'd get an artist to draw the normal and scatter maps for each sprite, and have a simple preprocess to combine them into one RGBA texture. However since I don't have an artist and it's hard enough getting good art I wanted something that required minimal extra work.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now