Home Technical Talk

Unreal 3 lighting/shadow issues

bluekangaroo
polycounter lvl 13
Offline / Send Message
bluekangaroo polycounter lvl 13
EDIT: PROBLEM SOLVED...check bottom post for solution



I have a couple of questions to put out there to anyone who knows enough of unreal 3. I have a decent understanding of the editor, but just some things are baffling me at the moment.

1...

When building lighting in my scene I end up with some soft/blurry shadowing...In certain cases that is fine and is of desired effect. But in others it is not. How do you get sharper shadows, like for instance when you are viewing your static mesh in the static mesh editor or just before you build your lighting the proxy lighting that the editor will display. Now I know you can affect the lightmap resolution on BSP surfaces by hitting F5 to bring up the properties and lowering it to 2 or 1....that will get it looking decent. But is there a way to get your shadows even crisper than that, and how do you enable better shadowing on static meshes for that matter???

and 2...

After importing my textures into the package and setting up some materials everything is fine and dandy.... but after having saved my package, closing it down and reopening i've noticed the textures on SOME of my materials have degraded considerably. Ive checked the compression settings and everything seems to be fine. Now just what in the heck is going on here??

any and all help would be very much appreciated

EDIT:

just to further illustrate what I mean by sharp shadows before build, and blurry shadows after build. Im seeing lots of instances in peoples work of getting sharper shadows in unreal 3. For some reason this alludes me at the moment

subdivisionseams.jpg

Replies

  • JDinges
    Offline / Send Message
    JDinges polycounter lvl 18
    1. BSP shadows are lightmap resolution(F5), as you mentioned. Mesh shadows are also lightmaps, you need to create a second lightmap UV layout and enable it in the mesh itself. TRy googling static mech lightmaps for a detailed explanation.

    In your example images #2 is being lit by dynamic lighting, which is pretty expensive in games but gives awesome shadows like that. To enable dynamic shadows you need to do that in the light itself, check what the light effects(composite dynamic, dynamic). #3 is being vertex lit, it averages the amount of light each vert recieves, which is why half is dark and half light. #4 has one less edge/vert loop to calculate vertex lighting so it averaged out the dark area and made the whole thing bright.

    2. Haven't run into that, no idea!


    Hope that helps.
  • RyRyB
    Offline / Send Message
    RyRyB polycounter lvl 18
    #2...

    Don't quote me on this but I believe this is related to textures mipping down.

    Try these, usually it helps me at work.

    - Fully load package
    - Use Play In Editor, this forces the textures to stream in fully
    - Is this a skeletal mesh? I don't know which version of the editor you are using but there used to be a bug where skeletal mesh textures didn't stream in fully, leaving them at their lowest res. Try creating a static mesh version and see if the degradation is still present.

    Hope this helps!
  • gamedev
    Offline / Send Message
    gamedev polycounter lvl 12
    I posted a pretty in depth response to a similar question on using lightmaps in UE3 here:
    http://boards.polycount.net/showthread.php?t=53425

    As for your materials / textures looking low-res - yes, they are being mip mapped / LOD'd. Along w/ some of the suggestions above you an also double click the texture that is blurry in the asset browser and check the 'NeverStream' flag. Again this is a temporary fix though and you'll most likely not want this flag checked as it will keep the texture in memory at all times.

    Good luck.
  • Lee3dee
    Offline / Send Message
    Lee3dee polycounter lvl 18
    #2 if you go into the properties of the texture in the generic browser, all textures when imported are set to Stream by default, unless you specifically checked NeverStream.

    neverstreamuk1.jpg

    generally its best to leave the setting alone but this is how you disable it :)
  • RyRyB
    Offline / Send Message
    RyRyB polycounter lvl 18
    Aye, I've hit the "Never Stream" option quite a few times!

    Some other food for thought:

    - Are your your textures mipped down in the Generic Browser? If you are working in one area of a level, I believe textures from another area of the level will be mipped down to their lowest level if not seen onscreen for X amount of time. 90 seconds rings a bell, but don't quote me on it. Some sort of editor streaming to improve Generic Browser speed perhaps?

    - Are your textures blurry in-game/play-in-editor? If you have a large texture, say 1024x1024, on a small asset, like a small box, the asset may not take up enough screen space to warrant loading the full texture. I've noticed that on some of our smaller assets where the texture size hasn't been reduced yet. Essentially, you have to get up close and personal with the asset so it takes up enough screen space to load in the highest res mip level.

    I'm not 100% sure on these, so maybe someone with more knowledge of UE3 can chime in.
  • sprunghunt
    Offline / Send Message
    sprunghunt polycounter
    Gonzo is correct. Unreal will load textures based on their screen size. So if you have a small object it won't load the entire texture even if it's a huge texture.

    Texture size is also constrained by what LODgroup it is in. This is determined by settings in the defaultEngine.ini file.

    I've also noticed that If your object is far away in the level it may not display the texture at full size when you see it in the generic browser either. This is probably just to make the editor more responsive.

    To debug this try turning on the texture density mode in the viewports. This will colour code your textures depending on how high resolution they are. The button for this is to the right of the other viewport controls.
  • bluekangaroo
    Offline / Send Message
    bluekangaroo polycounter lvl 13
    Thank you guys for the fast replies and insight.

    I was able to correct the second problem, it seems like it was a mipping problem like Gonzo said. I just played with the LOD bias and the textures corrected themselves. I dont believe NeverStream corrected the error though.

    As for the first problem, I thought I was able to find a happy workaround by enabling physics on my objects so I could get some dynamic shadows. Since vehicles and characters in Unreal 3 and Gears of War have dynamic shadows I thought all that needed to be done was to add physics to my objects but still was not the case.

    Even after checking that my light source was checked on Dynamic under LightingChannels and that CastdynamicShadows and bCastCompositeShadows are also ticked, when I build my lighting and play in editor there are no shadows. However I do get some nice self shadowing on the objects themselves, but still no shadows on the ground/terrain.

    PS Tyler the work on your motel is kickass. The lighting/quality in that piece is something I'm trying to achieve
  • bluekangaroo
    Offline / Send Message
    bluekangaroo polycounter lvl 13
    sprunghunt wrote: »
    Gonzo is correct. Unreal will load textures based on their screen size. So if you have a small object it won't load the entire texture even if it's a huge texture.

    Texture size is also constrained by what LODgroup it is in. This is determined by settings in the defaultEngine.ini file.

    I've also noticed that If your object is far away in the level it may not display the texture at full size when you see it in the generic browser either. This is probably just to make the editor more responsive.

    To debug this try turning on the texture density mode in the viewports. This will colour code your textures depending on how high resolution they are. The button for this is to the right of the other viewport controls.

    and Daniel I'm honored by your help/reply, I just finished bioshock not too long ago. That musta been very intense/challenging making that game
  • RyRyB
    Offline / Send Message
    RyRyB polycounter lvl 18
    Hey Eric,

    Make sure the surface that the shadow is being cast on is set to the correct lighting channel.

    Also try messing with Composite Dynamic lighting channel.

    Edit: Meshes must also have their lighting channels set to Dynamic/Composite Dynamic for them to receive dynamic lights. I wasn't sure by your post if you were setting them in mesh properties.
  • bluekangaroo
    Offline / Send Message
    bluekangaroo polycounter lvl 13
    Gonzo wrote: »
    Hey Eric,

    Make sure the surface that the shadow is being cast on is set to the correct lighting channel.

    Also try messing with Composite Dynamic lighting channel.

    Edit: Meshes must also have their lighting channels set to Dynamic/Composite Dynamic for them to receive dynamic lights. I wasn't sure by your post if you were setting them in mesh properties.


    Got it now, thanks Gonzo. After alot of searching and playing around with it I got some nice real time dynamic lighting in conjunction with regular static/built lighting.

    For whatever reasonthe static meshes themselves must have bForceDirectLightMap and bUsePreComputedShadows turned off and bCastDynamicShadow turned on, while in the Lighting Channels having Dyanmic checked as well.

    As for the light you have to use a point light toggleable (havent tried with all the other lights aside from normal point lights, and spotlights) and under light component have CastDynamicShadows, CastShadows and CastStaticShadows all enabled. Very tricky but SOLVED at last.

    Here is the link to which explaned this perfectly if someone ever has the same problem:http://forums.epicgames.com/showthread.php?t=601743&highlight=dynamic+lighting

    dshadowgx7.jpg
Sign In or Register to comment.