I'm coming back to Unity lighting after an exile in 2D and... hoo boy:

polycounter lvl 8
Offline / Send Message
Reverend Speed polycounter lvl 8
I am confused.

Aside from dealing with this problem, I'm trying to come to grips with GI in Unity and to identify the suitable lighting / lightmapping settings for a metroidvania played from this camera angle...


The game mostly takes place indoors and outdoors, with a timeline from 3pm to 8am. Ideally, it would be possible to warp between two locations with vastly different outdoor lighting (eg. night-time, sunset, midday, etc).

I'm a fairly experienced Unity gameplay programmer and artist, but I keep banging my head against GI/Lighting issues and contradictory advice. Is there anybody here that could set me right? Thank you.

 --Rev 

Replies

  • TheGabmeister
    Offline / Send Message
    TheGabmeister greentooth
    Hmmm... About the the lightmapping question you posted in the Unity forums, can you take a screenshot of the scene under Baked Lightmap Draw mode? We might be able to find some more information here.


    Ideally, the object you mentioned should display the lightmap pixels as a checker pattern, and the corresponding baked lighting. If the object is being ignored by the progressive lightmapper, then it should be invisible.
  • RyanB
    Offline / Send Message
    RyanB Polycount Sponsor
    Check the size of the individual model's area of lightmap being used.  The model may be using a very tiny portion of the lightmap if the scale of the model is too small. 

    Set your "Indirect Resolution" to 0.1 and your render times will speed up a lot. 

    20 1024 lightmaps for that scene is a lot and I would take a look at the area each object is using in the lightmap.  Usually, I lower the smaller objects and increase the floor and walls area in the lightmaps.  This allows me to reduce the number of lightmaps and put the resolution on the bigger surfaces where detail is noticed.

    Multiple times of day could be done in numerous ways depending on the constraints of the game.


  • Reverend Speed
    Offline / Send Message
    Reverend Speed polycounter lvl 8

    @TheGabmeister - I do have sort of a solution now, but I figure I owed it to you to provide a picture of the Baked Lightmap view...! =) Great idea, smart troubleshooting - but I have a special blend of stupid for you. See below...!

    @RyanB - Thank you very much for the indirect resolution tip! I'll take any advice I can get on Unity's GI, especially speeding up non-final bakes. I was normally doing bakes with lightmap resolution of 2 in order to get a faster bake, but I went for the default numbers for my Unity Answers post, just to be safe. Thank you for the advice regards the time of day lighting - I think I'll cover this when I get the current problem sorted.

    Speaking of the current problem - regrettably, this appears to come under the heading of 'self-own'.

    In my project, I have several quad models stretched out over the rooms on the right of the first picture attached. These MeshRenderers are marked as 'Shadows Only', with their attached materials marked as Double Sided Global Illumination enabled.

    In addition, I have two stretched quads extending the external wall of the hospital, with Cast Shadows set to 'Off' and the attached materials marked as Double Sided Global Illumination enabled.

    The intention was that the shadowcatchers would light the interior as if it was shielded from the Direction Light (as the interior of a building is shielded from the sun), whilst allowing the player to peer into the interior of the ground floor. The hospital wall extension was intended to act as a relatively naturalistic 'wipe' as the camera crossed into the interior space, then hiding the exterior.

    Instead, everything is brutally f'd in the a, with a load of errors including the unlit models that I've been asking about.

    If you'd like to see the effect I'm trying for, without Global Illumination and in a webplayer, please enter the data seen in the attached picture and walk through the indicated door.

    Can anybody suggest a way for me to achieve my desired effect with Global Illumination? 


    Thanks for all the help so far, folks!

  • Reverend Speed
    Offline / Send Message
    Reverend Speed polycounter lvl 8
    So, the solution for this particular error appears to be to never use single-sided geometry for static objects. Replaced my blockers with a standard cube, marked 'shadows only' and everything appears to have baked as intended. Lesson learned. Thanks to everybody who made suggestions.
  • RyanB
    Offline / Send Message
    RyanB Polycount Sponsor
    I would use layers instead of trying to physically block the light.  Using layers, you don't need any shadowcasters which makes your life a lot easier and de-clutters your scenes.
  • HAWK12HT
    Offline / Send Message
    HAWK12HT polycounter lvl 7
    Hi, double side geo might not always be the option. Lightmapping is a nightmare to begin with and like you said you have quads stretched out meaning that Unity lightmap might be stretching it even if you are seeing squares in bake view, it will be screwing things up regardless. You should try and model those planes with a very small lightmap UV with MeshRenderers dual side shadow option on and I am pretty sure it will resolve your issue. Apart from that keep in mind that unity dont like too big geos (your plane shadow catcher) and clamp down the lightmap size of that object unless you have manually made the second lightmap UV for that particular mesh and set its lightmap resolution to acceptable number (.01, .1 etc depends on your total lightmap res and indirect res). 





Sign In or Register to comment.