Wednesday, March 31, 2010

Fixing Character Lighting

Video Version


Subject: Fixing Character Lighting
Skill Level: Beginner
Run-Time: 5 Minutes
Author: Michael Allar
Notes: If your character is pitch black no matter what you do, this is the fix.

Streaming:     720×480 1920×1080

Download:     Low-Res (18MB) Hi-Res (23MB)

Written Version


Subject: Fixing Character Lighting
Skill Level: Beginner
Author: Michael Allar
Notes: If your character is pitch black no matter what you do, this is the fix.


HTPawn


The problem here is with our Pawn class. Essentially, our skeletal mesh needs to know that we are in a light environment.

Make sure this variable is declared at the top of your Pawn class:

[csharp]/** The pawn's light environment */
var DynamicLightEnvironmentComponent LightEnvironment;[/csharp]

In defaultproperties (replace if you see you have something similar but not exact):

[csharp]DefaultProperties
{
//Some stuff

Begin Object Name=MyLightEnvironment
bSynthesizeSHLight=TRUE
bIsCharacterLightEnvironment=TRUE
End Object
Components.Add(MyLightEnvironment)
LightEnvironment=MyLightEnvironment

//More stuff

}[/csharp]

Within the same defaultproperties block, you must assign your mesh to this environment.

[csharp]Begin Object Name=WPawnSkeletalMeshComponent
//Stuff
LightEnvironment=MyLightEnvironment
//More Stuff
End Object
Mesh=WPawnSkeletalMeshComponent
Components.Add(WPawnSkeletalMeshComponent)[/csharp]

You're done!

5 comments:

  1. What life is than an unresolved external symbol which you will never find the .LIBs needed for it, nor a linker there is for even generating the error. Perfect fix, Thank You.

    ReplyDelete
  2. My Gun doesn't take any material why??

    ReplyDelete
  3. sorry i mean materials doesn't apear in game

    the gun is black why?

    ReplyDelete
  4. Make sure you assign your weapons are assigned the same dynamic light environment as your character. The weapon code in these tutorials already do that for you.

    ReplyDelete
  5. Aren't you missing an "Class=DynamicLightEnvironmentComponent" in the written part? (line 5)

    Anyway, awesome work, Allar! Your tutorials are much more in depth than most and have helped me understand UDK a lot better.

    Hope you keep it up!

    Peace

    ReplyDelete