Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug Problem with Directional Light and imported object

Discussion in 'Editor & General Support' started by stykko, Aug 19, 2022.

  1. stykko

    stykko

    Joined:
    Jan 26, 2021
    Posts:
    3
    Hi everyone, I tried to import a level for my game in .obj format and if I look at the imported object with the camera the directional light seems to stop working.
    This also happens when trying to play the game. During the import I also disabled the import of lights. I leave a short video where you can see the problem. Thank you for your help!
    I use Unity Editor with version 2021.3.8f1 and HDRP (DX12).
    Video link: https://1drv.ms/v/s!AtLsur-Ing99fA3VoxP5u3Wv9zo
    Have a good day!
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,954
    I'm not clicking on a link like that. :) Do you have a youtube account? Or just add an image to the forum post.

    Is it perhaps backface culling you're seeing? Or just scaling? Start with a basic cube, get that working.
     
  3. stykko

    stykko

    Joined:
    Jan 26, 2021
    Posts:
    3
    Hi, sorry for the link, it's OneDrive :)
    But if you feel safer I'll leave you also for YouTube.
    As you will see the problem is only there when this object is rendered, I also tried scaling it.
    Could it be a problem with the .obj format?
    YT:
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,954
    That kinda looks like maybe the bounds computation is wrong. The bounds SHOULD be properly handled at the import stage. You could get a reference to the Mesh using the MeshFilter and recompute the bounds, just to eliminate that possibility. On the object in question it would be (in
    Start()
    ):

    Code (csharp):
    1. var filter = GetComponent<MeshFilter>();
    2. var mesh = filter.mesh;
    3. mesh.RecalculateBounds();
    4. filter.mesh = mesh;
    and see if maybe something changes?

    What exactly is the object in question? Is it a giant sky dome or sphere with that white outline on it? What if you set the scale really small, like (0.01, 0.01, 0.01)?
     
  5. stykko

    stykko

    Joined:
    Jan 26, 2021
    Posts:
    3
    Eventually I wanted to try using the same object in FBX format and it gave a positive result. Probably the problem with the .obj is what you described. I still thank you for the help!