Car Shadows

Discussion in 'Car Modding' started by McNolo, Jul 16, 2012.

  1. McNolo

    McNolo Registered

    Joined:
    Oct 5, 2010
    Messages:
    476
    Likes Received:
    945
    Hi:

    I have a new problem. I am converting a mod and the shades of the cars are not correct. I see a space without shade under the wheels. I have seen an option in the panel "shadows" that allows me to solve it (MAP 0 BIAS), but I don't know as keeping the changes that I make in that panel.

    Can somebody help me?

    Thank you.
     
  2. tjc

    tjc Registered

    Joined:
    Jun 4, 2012
    Messages:
    5,884
    Likes Received:
    405
    Do you mean you have a gap in the shadows like this McNolo:

    [​IMG]

    If so it`s been around for a while with rf2 I think. Hopefully be sorted soon.
     
  3. McNolo

    McNolo Registered

    Joined:
    Oct 5, 2010
    Messages:
    476
    Likes Received:
    945
    Yes, but worse in my case. Look that video:



    If you modify "MAP 0 BIAS" of "Shadow Settings" Panel, you can correct it, but the problem is that the changes not saves.
     
  4. vicent-sollana

    vicent-sollana Registered

    Joined:
    Jan 21, 2012
    Messages:
    416
    Likes Received:
    17
    Hi, I think this is caused by the "tgm" file
     
  5. Johannes Rojola

    Johannes Rojola Registered

    Joined:
    Sep 8, 2011
    Messages:
    1,038
    Likes Received:
    38
    It is caused because of one sided meshes. The "negative" side of the polygon doesn't cast shadow, even material is set to 2-sided.
     
  6. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    No, it's the opposite actually :)
    Shadows in rF2 are casted by backfaces, but of course shadowmaps have limited precision so shadow doesn't start exactly where mesh is. Casting shadows from front faces is much better and I have recently suggested it to ISI.

    You will see similar things all over Monaco - under balconies, near curbs and building edges and so on.
     
  7. Johannes Rojola

    Johannes Rojola Registered

    Joined:
    Sep 8, 2011
    Messages:
    1,038
    Likes Received:
    38
    That is what it does currently, the problem is that backface doesn't cast shadow.

    It read somewhere officially that graphic engine has to "see" the poly to be able to cast shadow from it. Backfaced polys cannot be seen.
     
  8. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    No, if the front face would cast shadow you would see it on the ground with no gaps.

    [​IMG]

    If front faces cast shadow, then there is no "light bleeding" near corners. There's a risk of "shadow bleeding" on lit surfaces though.
    But it's far easier to solve shadow bleeding than to deal with light bleeding, so casting shadows from front faces is a better way.

    Yes, documentation states that light is casted from faces that are "seen" by light, but it just ain't so.
    Game engines may cast shadows from back or front faces. Most games cast shadows from front faces, but rF2 just happens to cast shadows from backfaces - opposite to what documentation says.


    Anyway, this has nothing to do with modding and if anyone has such problem with his cars - don't worry about it. It's up to ISI to fix it in the rendering engine.
     
    Last edited by a moderator: Jul 20, 2012
  9. Johannes Rojola

    Johannes Rojola Registered

    Joined:
    Sep 8, 2011
    Messages:
    1,038
    Likes Received:
    38
    Yes I meant rF graphic engine.
     
  10. vicent-sollana

    vicent-sollana Registered

    Joined:
    Jan 21, 2012
    Messages:
    416
    Likes Received:
    17
    Thanks a lot for the info.
     
  11. McNolo

    McNolo Registered

    Joined:
    Oct 5, 2010
    Messages:
    476
    Likes Received:
    945
    Thank you all, I show you what I talking about:

    Here, the shadows without changes, of outside camera:

    [​IMG]


    Here, onboard camera, without changes (Map 0 Bias=0.00010):

    [​IMG]


    And finally, the onboard camera with Map 0 Bias corrected (-0.00003):

    [​IMG]


    The Shadow Setting Panel are here for something, but all the changes that you made, not saves. I think that is incomplete, or not finished, but if not, I like to know how we can modify and save the changes made.

    I guess that ISI will speak about this at some time.
     
  12. Tuttle

    Tuttle Technical Art Director - Env Lead

    Joined:
    Feb 14, 2012
    Messages:
    2,480
    Likes Received:
    775
    I guess this feature will be implemented in future updates. I've the same issue all the time and the most annoying stuff (for me) are the bad shadows inside cockpits that you can easily solve with the Bias and the split ratio...

    Solid shadows are a must so I'm sure will be fixed. :)
     
  13. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    You need to be carefull with shadow bias.

    The whole idea of shadow bias is caused by the fact, that shadowmaps are textures and therefore have limited size, resolution and depth precision.

    If you look at this picture again:

    [​IMG]

    You can see that these gray shadows have blocky edges - I painted it this way, so you can see that lack of precision.
    If shadow is casted from front faces (left example), then imperfections may cause shadow to pop on top of the object like this:

    [​IMG]

    On the other hand, casting shadows from back faces like in rFactor 2 (right example) may leave gaps near edges and let light pass through.

    To solve it, you can use bias to pull shadow closer to light source or push it further away from light source:

    [​IMG]

    While it's pretty safe with shadows casted from front faces (left example) it may cause shadows to pop on object's edges if you cast them from back faces (right example).

    It's better to cast shadows from front faces, but you need to push that shadow deep enough into shadow casting surface to avoid such ugly black stripes you can see on that Skyrim screenshot.
    But if you do that, you will clearily see that shadow begins not exactly where shadow caster is, but a bit further down the path of light.
    Check out this thread: LINK - you can see examples of thin shadow casters in both rFactor 2 (rear wing example in first post) and pCARS (mirror example in second post). In my second post I've described how shadow bias may help to solve that, but can cause a side effect (the same you see in Skyrim).

    Thin surfaces are always a problem, because they can be thinner than shadowmap precision can handle:

    [​IMG]

    The only way of optimizing shadow bias is to let game engine do it on the fly, depending on angle between light direction and shadow caster:

    [​IMG]

    Red lines on 3 examples above show how much shadowmap needs to be pushed down the path of light to minimize both artifacts on lit surfaces aswell as gaps in shadows near edges of objects.

    So shadowmap bias should not be some constant value set by user. It should be dynamic, and user control should be last resort - just in case something changes in the future in GPU architectures.
     
    Last edited by a moderator: Jul 20, 2012

Share This Page