miércoles, 13 de marzo de 2013

SSBumpmaps

Long ago I remember writing in Twitter something about me experimenting with Self Shadowed Bumpmaps, a feature in the Source engine that was released back with the Orange Box, since then all following Valve games have included them, and just a couple of days ago I found my old files and started doing more tests with them, so here will write a little of my knowleage about them, hope you will find some of it useful.

Ok so as some of you may already know to create a regular "Normal" Map or "Bump" Map there is the need of a height map, for Self Shadowing Bump Maps (SSBM from now on) those are also needed.
Unless! you have already a Normal Map that you want to convert over, now, Valve gots a set of command line tools to make both actions, "height2ssbump.exe" and "normal2ssbump.exe" respectively, you can see plenty of documentation about those in the Valve Dev Wiki,here I will talk about neither of those since I don't use them because of their lact of GUI, but I bet they can be useful to handle large amount of textures in batch ways.

The tool I use, and recomend you to use it, is the free tool called SSBump Generator, you can grab it from here: http://ssbump-generator.yolasite.com/ here is a mirror in case it's down.

Ok, so let's start, here it's the texture we will be creating the SSBM:



It's a HL2 texture, "props/metalcrate001d"

So, let's create a Height Map that works for that texture, I will suppose you know how heightmaps work(dark is low, white is hight), there are multiple ways to create them, you can use the base texture in grey tones and then go from there, when it's something sharp like metal I tend to recreate the texture in vectorial for a better more clean thing. There are also ways to create them with 3D tools like 3DMax or Mudbox, but I will leave that to you to learn how to do that.

Here it's the heightmap I created:


So now that we have that we go to the SSbumpmap generator's regular Bump map generator(wich is also pretty cool)



Load the heightmap, create a new layer and check how it looks:


Looks a bit boring, the real trick for a good SSBumpmap is to have a good Bump map to start from!

So let's make it sharper, let's add a Fine Detail layer on top:



Ok, it's better now, let's say it's perfect.
Now we can convert that bumpmap to a SSBumpmap:



So.. we now have this SSBM that works as regular bumpmap..
But there is something missing here.. come on, it's in the name.. you should know it.. ok, it's the shadows!

Here is the trick, you need to open the bumpmap you created before in an image editor soft and add an alpha channel to it, that alpha channel is the heightmap(can be the same or another), the one that will be used to cast shadows in our SSBM, so we do that, and now we repeat the step before but change this first:


So now it will take a bit longer, and so we got this:



The ray caster now generated this Ambient Occlussion that goes right on the texture, this is how those shadows alone look:


This effect can be made stronger, just play a bit with the sliders.

And that's it, now you have your SSBumpmap, then you can do other stuff like add an alpha channel to it to use it like a specular mask and then create the VTF with vtex.exe or VtfEdit.

Here it's how it looks without the SSBM and later with it:


Here some wisdom:

* Don't Use SSBumpmaps on floors unless it's complex terrain or the game uses a lot of low light sources with very closed angles like flashlights, else they will be not noted.

* The heightmaps for the shadows cast should be always clean, only big stuff, you can leave the small details to the heightmap you used for the bumpmap, for example:



There I overlayed another texture to the main texture and then overlayed a new normal map on top of the one we previously did, but didn't touch the heightmap that had that normal map so the shadows created by SSBM generator will not change.
* You can have only shadows(Ambient Occlussion) SSBM.

* If you material gots specular, don't abuse of Shadows, they will also deform the reflexes with potentially unwanted results, to address that you should keep it in mind when you are creating the specular mask to avoid the areas with shadows, or eliminate the shadows completelly, thou, if doing so, there is no longer a point in using a SSBM so you should stick to use a regular Bump Map instead.

* Here it's an interesting article made by Valve explaining how they work: SIGGRAPH2007_EfficientSelfShadowedRadiosityNormalMapping.pdf
Wan't the short version? ok, Regular Bump maps have 4 light sources in 2 channels, red and green, the blue one is for AO, rarelly used, SSBM have 3 lightsources with "baked" shadows in the 3 channels RGB, period.
Ok, that's all for now, just felt I needed to document a bit about this than just telling about it to my friends, also the blog needed some new ink, it's been more than a year since the last post, hopefully will write something much better soonish about Blendtextures, wich are less documented than SSBM.

I leave you with other examples of textures without SSBM and later with them:

No hay comentarios:

Publicar un comentario