Home Unreal Engine

Shading errors on rotated objects

polycounter lvl 15
Offline / Send Message
ivars polycounter lvl 15
I know this subject has been up before, and I am yet to see any real solution to it. Usually this pops up as a problem with mirrored UV's and normal maps, but the issue seem to run much deeper. There's a huge error in how tangents(?) are being calculated that messes up mainly the light bakes but also the dynamic specular on objects.

In short you cant' rotate assets, objects, or UV's without getting shading/baking errors(!!)

I've done some simple tests just to see what happens. None of these uses any normalmaps and it's all flat surfaces (boxes and planes). The material is a standard UDK phong with a grey color and white specular. The specular power is set at 50.

UDK_rotated_assets.jpg

This is what happens when the same box is rotated inside UDK. You can see that there's errors to the dynamic specular as well as the baked lights and the lightmap specular.

UDK_rotated_at_export.jpg

In this case the box was rotated 180 degrees before export. So the scene contains 2 separate assets, none of them have been rotated inside UDK. The dynamic specular looks accurate but the baked light and spec still looks terrible.

UDK_rotated_in_UVs.jpg

Here all squares are part of the same mesh, but the faces have separate UV-shells where haf of them have been rotated 180 degrees. The lightmap UV's are still just a planar projection with no seams. The dynamic specular holds up but the baked light and specular breaks.

It has been suggested to solve this problem by swapping the UV-sets for lightmap and diffuse, since the tangent i calculated based on UV0. But if you introduce a normal map to the material you can see that it's not a viable option since it will then mess up your tangents compared to the normalmap.

UDK_swapped_UVset.jpg

Now this is the most simple case I could find. The problem only increases if you have a more complex object. UV seams become very visible between rotated shells. Even just slightly rotated UV's create shading errors, not to mention mirrored UV's which are even worse.

At this point the only "solution" available seems to be to hide the errors in excessive normalmap detail, grungy textures, noisy specular maps and always model your assets with some sort of natural seam along the border. Or just don't put rotated objects too close to each other so that the error becomes less obvious...

I am either missing some super important setting somewhere, or this is just really broken....

Please let me know your thoughts on this, or if you have any better solutions!

Replies

  • Xendance
    Options
    Offline / Send Message
    Xendance polycounter lvl 7
    That's how it's supposed to work. The baked specular lighting doesn't take the world space rotation of the mesh into account, it only operates on UV level as far as I know.
    Dominant directional light works fine since it doesn't use baked specular lighting.
  • ivars
    Options
    Offline / Send Message
    ivars polycounter lvl 15
    I can't believe someone made the decision that rotating objects, or UV's for that matter, isn't that important. Or that this error just slipped through all the testing unnoticed. And as you can see it's not only the specular, it's any light-bake as well.
    This, and related issues, seem to be popping up all the time, but I've yet to see any official explanation or fix.
    There was this mention: http://udn.epicgames.com/Three/ContentBlog.html#Fixing%20specular%20highlights%20when%20using%20X%20and%20Y%20symmetrical%20texture%20mirroring
    ...but it doesn't seem to work, and it looks like it only address dynamic lights and specular anyway.
  • Xendance
    Options
    Offline / Send Message
    Xendance polycounter lvl 7
    The non-specular errors might be because of the low frequency bounce lighting, it happens with all modular pieces.
  • ivars
    Options
    Offline / Send Message
    ivars polycounter lvl 15
    You get the same error when baking without lightmass, so it seems it's not linked to the bounce light.
  • sprunghunt
    Options
    Offline / Send Message
    sprunghunt polycounter
    My guess as to why this doesn't concern Epic is because making floors out of many small pieces like this is inefficient from a performance point of view. So you should avoid it for other reasons other than just the specular problem.
  • Spoon
    Options
    Offline / Send Message
    Spoon polycounter lvl 11
    @ sprunghunt: It's not just floor pieces. It's every single asset you make. Mostly you can hide the seams in cavities etc, but sometimes they are out in the open, and pretty much brings the player out of the immersive world you are trying to create.
  • sprunghunt
    Options
    Offline / Send Message
    sprunghunt polycounter
    Spoon wrote: »
    @ sprunghunt: It's not just floor pieces. It's every single asset you make. Mostly you can hide the seams in cavities etc, but sometimes they are out in the open, and pretty much brings the player out of the immersive world you are trying to create.

    My point about floors applies to any piece you might want to make for an environment. There are a limited number of objects you can draw so wasting object count on simple objects isn't a good idea. Especially when it creates obvious lighting seams.
  • Xendance
    Options
    Offline / Send Message
    Xendance polycounter lvl 7
    BSP is usually the best tool if you want to make a flat floor.
  • HAWK12HT
    Options
    Offline / Send Message
    HAWK12HT polycounter lvl 12
    hmm weird, I just built an environment and didnt came across this or may be didnt noticed it as much with all the texture details etc, will check now that you have bring this topic.

    Here is what you should try, cause i first also thought UDK screwed up some stuff. Yes there are bugs and all but for most part I have seen they happen due to some wrong setup in the engine. Stuff like forgetting flipping y channel, inverting the back face in UVWs etc.

    with that being said.

    change your UV grid snap size to 1.163 units (in max or maya) doing this will make your grid 128x128 unit size of UDK.

    unwrap your boxes and make sure there are no overlapped faces in lightmap / inverted faces as well in Lightmap. Turn snaps on and snap the box uvs on grid. To keep things simple I would suggest you use a plane instead of a box and snap the UV all the way in 0 1 space in editor.

    Now goto world properties in UDK and set your diffuse boost to 1 , Indirectnormalboos to 0.0. turn off Ambient Occlusion.

    Bake light on production settings and see what happens.

    Bottom line is any break in geometry or UV will cause mess of some sort. That is why Modularity is king and unwrapping UV is an art form of its own. :D
Sign In or Register to comment.