Home Unreal Engine

UDK lightmap problem

Zocky
greentooth
Offline / Send Message
Zocky greentooth
Hey all!

I'm making small map, and i'm having problems with baking lightmap.

I made 3 assets, each having two uv sets. The second, shadow map, has no overlapping faces, and it is snapped to grid aswell.
Lightmap size was set to 256, but the probelm is, when i bake shadows, this is the result:

vtqUE6E.jpg

I just don't see what is wrong; if it helps, i'm using the default settings that (i started with the default udk scene...the one with cube in the middle and daylight setting).

What i find weird, is, in the option, when i click "bake lighting", if i disable "use lightmass", this is how it results:
wTQwUHH.jpg

And this seems to work ok, just that it doesn't use GI and stuff iirc. But i get no shadow issues here.

So, what could be wrong? Any ideas?

Also, if it helps, this is the settings for mesh i'm using:
4EERP2u.jpg

So, any ideas how the fix the shadows?
Do i need to change settings on light or something?
Tnx!

Replies

  • JamesWild
    Options
    Offline / Send Message
    JamesWild polycounter lvl 8
    It looks about right to me - in the first image the sun is on the other side of the platform, and the only light on that side is reflected from the floor. In the second image the sun is behind the camera and is directly illuminating the mesh.

    Look up a guide on optimizing your lightmap UVs, when you're working at such a low resolution the exact pixels they fall on matters.
  • Zocky
    Options
    Offline / Send Message
    Zocky greentooth
    Tnx for your reply!

    The problem is where the two assets meet; there are weird shadowing on their border.

    But, maybe that's more a problem of AO and not light map...

    I did look at some lightmap uv tricks....i did set theg grid in maya and snapped uvs to it.

    Wel, I guess i need to go study more on lighting in udk, there's still a lot i don't quite understand yet.

    Oh well, tnx again for your help!
  • Santewi
    Options
    Offline / Send Message
    It's a problem with Lightmass. You could try to hide the seams with other meshes.

    Unfortunately there is no way to fix this. :/
  • Zocky
    Options
    Offline / Send Message
    Zocky greentooth
    Oh, tnx Santewi (and sorry for the late reply).

    I have another questions. With rasing lightmap res up to 1024, in viewport, i bake lighting, and everything looked cool and all, but the problem was, when i pressed the "play in viewport" button and the game runs (in viewport; you can walk around and stuff), i get some visible seams on the edges that i otherwise don't see otherwise in viewport, outside of the game mode.

    I'm guessing that it's a setting or something, because everything looks fine in regular viewport, no matter how much i rotate the camera, the problem only occurs when i actually play in viewport. Any ideas? I'd expect the two modes to be identical, since both "play in viewport", and regular viewport are realtime....
  • JamesWild
    Options
    Offline / Send Message
    JamesWild polycounter lvl 8
    With a lightmap res of 1024, even with that few assets, you're throwing video memory clean out the window there. With 12 assets, even if it was just 1xDXT1 per asset (it's not, it's several times more) that's 12mb of VRAM for a small part of the scene. 256 might be overkill. I would not be surprised if the game limits lightmap size.
  • Zocky
    Options
    Offline / Send Message
    Zocky greentooth
    Well, yeah i do agree that 1024 is quite a lot, but i'm just not sure what can one do to about it.
    If i reduce res, the shadows looks just way to wrong...even with 512 it's a huge difference (which still doesn't make any sense to me, 512 seems a whole lot for a simple asset that i shown earlier and certainly more then enough to not produce errors like the ones i get).

    I'm trying to see if there's maybe some setting that i have to tweak to improve quality on lower res, but dunno...

    Also, is there a way to export lightmap to see it in photoshop for example?

    Oh, and tnx for your comment!
  • JamesWild
    Options
    Offline / Send Message
    JamesWild polycounter lvl 8
    In Lightmass-era UDK, there's not one lightmap, there's many different kinds representing light direction and so on. You can see these by selecting your map as a package in the browser.
  • Zocky
    Options
    Offline / Send Message
    Zocky greentooth
    Hm, if 256px is overkill....that's sound a bit harsh. That would be using 128px, but i'm not sure how much info you can put on texture of that size....and i just can't seem to get good result with 512, let alone 128.....I'll play a bit more and study lighting more, and then i'll post few pics, maybe someone has some idea what i'm doing wrong....

    Also, tnx, i'll take a look at those maps!
  • Zocky
    Options
    Offline / Send Message
    Zocky greentooth
    Ok, so i played farther more with settings. I disabled here AO (iirc), and tried to tweak some other settings. I set light map res to 128, but similar results are with higher res as well.
    It seems a tad better, but not by much. If you take a look at these images:

    UDK render:
    sZVEiYV.jpg

    How the asset looks in maya + lightmap uv set:
    BrZHcUj.jpg

    So, as you see, it's somewhat ok, but i get some weird results at some places, and i get really get why.

    For example, why are areas with red color, so dark, much darker then, say, the one with green color? It doesn't make any sense.

    And the area colored with blue...it's where to two assets stick to each other....why do i get, again, darker shading at the border there, even though it's a flat surface?

    I also put light uvs on the second pic, maybe i did something wrong there?
  • r4ptur3
    Options
    Offline / Send Message
    r4ptur3 polycounter lvl 10
    There have been a lot of threads like this recently!

    One of the strangest methods people have been using is to put the lightmap data in UV index 0. I wonder if this will work in your case -- try changing it from the default index of 1 and swapping it into index 0. It is kind of a pain (you will have to move your UVs), but it seems to do the trick in most cases.

    One other thing to look at -- are your UV seams lining up on pixel edges? This could be causing the seams (although unlikely if your mapres is well over 256).

    Good luck!
  • Zocky
    Options
    Offline / Send Message
    Zocky greentooth
    Well, on these last screenies, the light map size is 128px, and raising the res up to 256 fixed the problem to a degree, but i still get those errors and some others.

    Yeah, i did snap uvs to grid, but that didn't remove the problem entirely.

    Even if i understand the seams between the two assets, i don't understand why are those faces in red, so darker. It's not like it's bleeding, entire face is too dark as you see. I managed to tune down a bit the bleeding thing on the border, but those faces are still darker for some reason.

    Hm, yeah, i did hear about this swapping thing. If i do that, i also have to set somewhere that second uv set should be used for texture..where do i do that? I know where to set which uv set should light map use, but i'm not sure about the texture?

    Tnx for your help, i'll see what i can do!
  • r4ptur3
    Options
    Offline / Send Message
    r4ptur3 polycounter lvl 10
    Hey again :)

    You will have to manually do that in the material editor. Create a TexCoord node (U + click) and plug that into the UV input of your TextureSample node. Click the TexCoord node and look at the properties -- you should see a "Coordinate Index" slot. Change this from 0 to 1 (or whatever UV channel you like).
  • Laguna88
    Options
    Offline / Send Message
    this post was sent twice and should be deleted!
  • Laguna88
    Options
    Offline / Send Message
    Hi there.

    I got a similar problem with some of my static meshes.
    For realy no obvious reason, when baking lightmaps I'm getting errors saying
    actors have overlapping UVs.
    The "Go to"-button doesn't seem to work in this case, so i first had to find out which actors cause the error.

    Sometimes it helped redoing the UVs in 3dsMax (always making extra lightmap UVs on map channel 2 (Index 1 in udk)). Or if that didn't work, I generated unique UVs for the mesh within UDK (pack UVs only).

    But now I wanted to increase the lightmap res of some of these meshes...
    Doing so (increasing from 64 to 128) and baking afterwards again gives me the damn overlapping UVs error :(
    Decreasing lightmap res works fine tho.

    Are there any new insights on this yet??
  • Zocky
    Options
    Offline / Send Message
    Zocky greentooth
    Increasing lightmap uvs probably shouldn't solve the problem with that error.

    IIRC, that just simply means, as the name suggest, some uvs are overlapping, and for shadows, you can't have that, otherwise, shadows aren't showing correctly.

    You should check out your asset and see where does that happen.

    In maya for example, in uv editor, you have button that displays uvs as semi transparent colors, and if one is overlayed onto another, the transparency will stack (meaning, it will be less transparent)...that way, you can quickly see where and if there is any overlapping. I'm sure 3dsmax has something similar too.

    Hope that helps.

    OH, and tnx all for the help!
  • Laguna88
    Options
    Offline / Send Message
    thx for your suggestions.
    I already double checked for overlapping and inverted faces.
    The problem was I still got the error when baking with increased lightmap res on respective meshes.
    Anyway, after some time I found a solution! :)

    I snapped all my edges (when possible and without too much stretching) to the grid,
    changing the grid size to 0.015625 so it would match with texels in UDK.

    In 3dsMax you can do this by going to Options > Preferences > Grid Size within the
    UV Editor.
    After typing in the number, it will appear rounded up to .016 but still seems set
    to .015625 when snapping vertices to the grid

    This way I got rid of most small shadow edges between tiling meshes and of the overlapping UVs errors.
  • Laguna88
    Options
    Offline / Send Message
    Hey again.
    I'm not sure if this should be a new thread... but well...
    Has anybody experience with lightmaps and level streaming?
    Because when I transfer my landscape or a bunch of static meshes to another level
    for streaming, my otherwise fine lightmaps become all ragged and ugly. Especially on shadow-edges diagonal to the lightmaps x- and y-axis...
    Maybe it's caused by the DDL in my persistent level? Do I need a copy of that light in the streamed level?
Sign In or Register to comment.