Search Unity

Problems with deferred lighting

Discussion in 'Editor & General Support' started by eskovas, Jan 23, 2013.

  1. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Hello
    I recently purchased Unity Pro and i was switching some things and the deferred lighting seems to not be working properly.
    for example if i don't use lightmaps, then the whole scene disapears...
    $deferredprob.jpg
    1: Deferred lighting with lightmaps
    2: Forward with lightmaps
    3: Deferred lighting without lightmaps

    One other problem is that the camera is rendering double the polygons in deferred lighting than with forward.

    I tried to create a new scene in the project and the same thing happens, but when i create a new project, everything is ok.

    I'm using some shaders created with Strumpy Shader Editor but not on all objects.

    Can someone say why this is happening?

    Thanks
     
  2. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Nobody knows why this happens?
    Do you have any ideias that could explain this?
     
  3. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Here's another image:
    I created a new scene and created a plane and a spot light and this happens
    $deferared.jpg
    Why is this happening?

    EDIT: fixed image
     
    Last edited: Jan 23, 2013
  4. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    bump

    I really need to fix this and i have no ideia why this is happening...
     
  5. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Bump again...
     
  6. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    One more bump

    is there anyone who knows how to fix this?
    I asked this 24 hours ago and i still have no awnser... this is an important problem.
     
  7. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Eskovas:

    It sounds like you are in the middle of a project and under pressure!

    However, 24 hours is not a long time to wait when asking a question. It takes time for people to see, read, understand and formulate a reply to any topic. Moreover, many helpful people are put off by insistent demands for answers and bumps. I find that when our community sees many bumps on a thread in a short period of time, they steer clear. Lastly, 24 hours is not a lot of time to try out solutions on your own.

    To the problem at hand, I don't see enough information to know where to begin.

    I have done a quick test replicating your plant and spot project and I have no issues. The only thing I can suggest for you re: the plane and spot test is that the transform of the spot is very large:


    ... and the range of the spot is only 10. Could it be that the plane is too far away to be lit by the spot?

    When I did my test, I made sure the plane was at origin (0,0,0) and the spot was only 5 units above it (0,5,0). This way, I was sure the light was reaching the plane.:


    Taking this scene, I then checked it in the various lighting paths, lightmapped it, and checked again.

    I'm having no issues.

    Can you tell us more about your main scene? What is the target platform? What shaders are you using? Have you tried swapping out shaders for default shaders? Have you tried changing target platform? In each of these cases, does the behaviour change?
     
  8. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Thanks for the reply
    I know i shoudn't have bumped this thread so many times and i'm sorry for that.

    The problem only happens on my project, if i create a new project then the problem disapears.

    I thought it was a setting or something else specifically in my project but i have searched on my own and coudn't find any fix.

    To answser your questions:
    target platform : PC
    shaders : Unity default shaders and 2 shaders created with strumpy shader editor (those shaders only multiply 2 diffuse textures and 2 normal textures)
    Have you tried swapping out shaders for default shaders? : not yet since there's many objects
    Have you tried changing target platform? : not yet, i'll try that.
     
    Last edited: Jan 24, 2013
  9. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    So i tried to switch platforms to web player and it's the same.
    I also created and saved a scene with the plane and light, then i exported a package with that scene to another project and in that project everythings normal.

    here's a screen with a point light:
    $deferredbug.jpg

    Edit: In that image there's another problem, in the statistics window it says 6 render textures and i'm not using any.
     
  10. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Hmm, I wish I had an answer to this. I have never seen this sort of problem. However on a side note, I would like to say I am a fan of your shooter game, and I am growing impatient for a beta. ;D
     
  11. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Thanks :)

    @Little Angel

    So i decreased the size of the light and i found out that it looks like the affected part is the volume of the light (can't explain xD), here's the image from different angles:
    $light.png
     
  12. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    @ Little Angel

    I built the scene with the point light and plane using deferred lighting and the build works, so i guess the problem is in something that's affecting only the editor.

    EDIT:
    Ok this is even more weird xD
    i was deleting some things from the project folder that i didn't need to see if i could fix this and suddently the scene view changed and doesn't do that problem anymore but it's even more strange, here an image:

    sometimes it stays like the first pic, other times the objects in the scene become pink or black.

    EDIT2

    Now i discovered in the scene view that if the scene is in perspective mode, then the whole scene disapears but in isometric mode i am able to see the scene but the light isn't correct.

    Should i re-install unity? i updated Unity to 4.01 yesterday, so i don't know if i really need to re-install it, also the problem is only in my project... when i create a new one, the problem goes away.

    EDIT3:
    Fixed image
     

    Attached Files:

    Last edited: Jan 25, 2013
  13. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    I am unable to new your attached images. Can you try hosing them on a site like tinygrab.com, skitch.com or dropbox.com and then linking them as an image, either using the image box in the header of the new post window or by using the tags IMG and /IMG in square brackets?

    How big is your project? Would it at all be feasible to put your assets into a new project, just in case something's messed up in the project?

    You could also try quitting Unity, making a backup of your project (just in case!) and deleting your "Library" directory. It will rebuild on restart of the project and see if this fixes things.
     
  14. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Well the project is 2GB, i'll try to put everything in a new project if everything else doesn't work.

    I also deleted the Library directory and everything's the same.

    btw i fixed the image in my last post
     
  15. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    So i decided to do what you said, to export the assets to another project and it's still the same...
    So i guess it might be a file that is affecting the editor...
    Here is an image of my map:
    $islandDeferredbug.jpg

    Do you have any more ideas to fix this problem besides start deleting files from my project folder?

    Edit: the scene view should be showing the map, but it disapears.

    Edit2:

    I made a new scene with the plane and point light and i noticed that in the preview window of the camera, everything's fine but in the scene view and game view there's still that bug:
    $aUntitled.jpg
     
    Last edited: Jan 25, 2013
  16. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Humph - down to basic troubleshooting, I guess. Do you have Unity installed on another computer? I'd hesitate saying simply reinstall Unity, but if you could test it on another machine, you could rule on whether it's the application.
     
  17. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    No, i don't have Unity on another machine, i don't even have another machine...
    I don't think the problem is with the application since the problem is only in my project and not in other projects.
    I applied SSAO to the camera to see if it had any effect, here is the result:
    $Untitlead.jpg
    I don't know if these images help anything...
     
  18. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Humph:


    Can you post ScreenShots of all of your GameObjects in that temp scene? With all of the components open/exposed?

    Just to make sure something small hasn't been missed?
     
  19. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    I made a scene similar to your last image and also included an image with forward rendering
    here it is:


    EDIT: fixed image
    EDIT2: the inspector on the right of the red line is from the image left to the red line.
     
    Last edited: Jan 25, 2013
  20. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Here it is with some simple materials from Angry Bots:


    Now, to be fair, I was able to make the surfaces render black, or with holes cut in them, or not render at all, depending upon which AngryBots custom shader I chose.

    If it were me, my next step would be to duplicate the project, or take a test version you already have, and then start monkeying with the shaders. Set them all to diffuse. Just take the existing material and crank the shader back to something basic. Does this behave as expected? If so, then you could have a custom shader issue.
     
  21. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    The only difference I see is linear color space, rather than gamma - which I have corrected for here:

    This is lightmapped...


    This is not...

    I'm not really sure.

    Stepping through the project one asset at a time?

    I've asked for additional help, so we'll see what I can find out.
     
  22. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Finally!!!!
    Problem solved ( i believe )
    I deleted a standard assets folder that had lots of files and folders inside it and the scene view and game view turned pink, so i restarted unity and deferred lighting works!
    here's proof :


    the problem wasn't with the custom shaders i had, but with something i might have changed or something else in the standard assets folder.
    Anyway problem solved and thank you Little Angel for the support.

    Edit: Fixed image
     

    Attached Files:

    Last edited: Jan 25, 2013
  23. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Yeah! Great!

    I'm glad it's all fixed.

    Like when the ufo lands in your back yard, takes your lemonade and leaves... you weren't sure what it was, but you're happy it's gone.
     
  24. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Well one problem goes away and another one comes... now the lighting doesn't work well and the lightmaps don't work...

    EDIT:
    here's an image of what's happening:


    that bug is all over the map and the lightmaps aren't working.

    Edit2:
    that bug only happens in deferred lighting, but the lightmaps don't work in any...

    Edit3 : i tried lightmapping in a completely new scene and it doesn't work
     
    Last edited: Jan 25, 2013
  25. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Ok one more problem solved!

    i just deleted all the shaders i had in my project folder and custom shaders i had and everything works now.
     
  26. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Yay! That's good.

    Let us know if you have any more issues.