Saturday, May 21, 2011

Using Merge Maps to Create Realistic Blood Splatter in UDK - Intermediate Level

Skills Required :  
       -Basic Knowledge of Photoshop 
       -Basic knowledge of Unreal Material Editor
Here is the package and TGA image that I created:  Blood.zip

Blood splatter is from CG textures.

So it is likely that you will get a file with a white background.  Thats quite useless for making a translucent material in UDK.  Cardinal sin #1 for decals is a white background.  The reason is when you try to ad an alpha channel to it, you still get remnants of white showing through the semi-transparent parts of the blood.

Like this:



So we need to get it on a black background before we create our merge map so we don't get those white artifacts.  We will only need grayscale information in the end, so its quite simple.

First of all, select the layer with your blood splatter on it.  Then go to Image>Adjustments>Invert or ctrl+I.  

That will give you this: 


Now that you have a black background, you can go to Select>Color Range.  


This window will come up:


If you hover your mouse over the image while this window is open, your mouse turns into the color picker icon.  This is because you need to choose a base color for the color range to select.  So click on a black area of your image.  For these situations I usually like to take the "Fuzziness" up to 200 so that it selects all black.  

After choosing ok, you will have your selection:


Now press delete to get this:


Now hold ctrl and click on the thumbnail of your layer in the layers panel.

This will create a selection of everything on that layer:


Now copy with ctrl+c.  

Create a new photoshop document with these settings (resolution can be changed, but make sure it is square):


In your new photoshop document, use the paint bucket to make the background layer black.  Then switch over to the channels panel and select the red channel.

Now Paste with ctrl+v:


Now repeat the same process for 2 more blood splatters, but pasting each into its own color channel (Green and Blue for the second ones).

You will end up with something that looks like this:



Now save this out as a targa file, make sure you select 24bit after saving.  24 bit targas have no alpha channel, if you select 32 bit, you will get a blank alpha that just wastes space.

Import this into UDK and then right click in the content browser and select "New DecalMaterial":


Open up the material and change the blend mode to "Blend_Translucent":


Now recreate this material setup:


Now apply changes and close the material editor.  

Drag your decal material into your level and this is your result: 

 
Repeat this process for the other two splatters in your file, but using different color channels and you will now have 3 blood splatters from one 2DTexture file.

This can be used for many other situations.  One color Graffiti for instance:


You can also use merge-maps for multi-colored materials or for materials that need a glow, but you will usually need a second texture file for that.  The magic with that though is that you still get to use the one texture file on 3 different materials.  

For a material that needs a seperate glow map, here is the material setup:


And thats merge maps and a few applications of them.  Another great use of merge maps is holding grayscale specular maps and alpha channels.  Its great for keeping down package sizes.

Another great resource for optimizing your textures is this optimization tutorial by Hourences: 

Thanks for reading, hope this helps.

No comments:

Post a Comment