Showing posts with label Materials. Show all posts
Showing posts with label Materials. Show all posts

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.  

Tuesday, February 22, 2011

Creating a Material and Particle System in UDK that will Fade In/Out and Eliminate Hard Edge Clipping

This is the screenshot of the sprite material that I used to make the particles fade in/out when they appear/dissapear and how to create soft edges for your sprite so that its not clipping everything in the environment with a really ugly hard edge.  Otherwise it just pops in.  The key is mulitplying your opacity texture sample by the alpha of vertex color (Red Circle).  It could simply be your opacity texture sample multiplied by the alpha of vertex color and it would work to get rid of that pop-in/out.  Also if you don't want your sprite to have hard edges when clipping other meshes or BSPs in your environment, then you must put a depth biased alpha (DBA) node into the opacity.  So from your multiply you can go straight into the alpha of DBA and create a constant to put in the bias (usually use .25 but in this case .3).

You may also multiply the diffuse map by the combined RGB values (black output) of the "Vertex Color" node.

For reference, anytime you see a node with just a number on the top, its a constant.  I remember that pissed me off trying to figure out what those nodes were on tutorials when I was learning Unreal.

Now right click in your content browser and create a new particle system.  Your new particle will open up in the cascade editor.  Click on the required tab>emitter category, then select your material you just made in the content browser, then click the green arrow in the material category.  Now select the "Color Over Life" tab.  Expand Color, then keep expanding the "Alpha Over Life" categories until you get to "Points".  There will be two points already there.  Create a third by clicking the green + that is to the right of "Points".

Now what each point represents is a point in time.

The "In val" is essentially the particles lifetime.  0=beginning, 1=end, .75=3/4 of lifetime.

"Out val" is the value put out by the vertex color node in the material (in this case the alpha channel).  Again 0=fully transparent, 1=fully opaque, .5=half transparency.  
In any "by life" node in your particle, the same rules apply.  Some will have 3 values or more for the "Out Val", like color over life for R,G, and B.

If you multiplied the RGB vertext color by the diffuse texture in your material, then you can also change the color of your particle.  It is the same process except that you use the "Color Over Life" dropdown instead of "Alpha Over Life".  The other difference is that the "OutVal" will be 3 values representing R, G, and B.


Update via John Heeter:  The clamp in the material is a precaution so that your curves don't happen to skip over the value of 1.  Although when going over 1 with the color category, you simply get brighter colors.

-Matt