Saturday, February 26, 2011

Lightmap Issues


OK so I am having this really bad issue of "blinking" static meshes.  I have been trying to wrap my head around this for hours and getting freakin nowhere.  When I'm up close it looks great, but move back 5 ft and suddenly the lightmap resolution goes way down.  The textures don't change resolution one bit, but my lightmaps get really bad.  In a fully lit environment with multiple lights, this causes massive "blinking" on entire objects.  Now you will notice that one of the meshes doesn't change.  This is actually a different static mesh, but you can't really tell from the picture.  its not having this problem, but a large portion of the models in the level are.


Here is an example of the blinking:
http://www.youtube.com/watch?v=BC4ikjzKTFQ

Edit:  Resolved.  In static mesh editor, LOD distance Ratio was at 1.  Just changed it to 2.  Apparently it was switching to LOD textures when you were very close to the object in game.  So it was extremely noticeable. 

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