Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

[IOH] Occulsion System (Instant Dynamic Occulsion Culling)

Discussion in 'Assets and Asset Store' started by laakerules, Jan 5, 2013.

  1. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    There no choice there, you can't include anything that you can't yourself licence royalty free, else you'd be breaking the asset store licence (the licence covers your project, you can't just say "except the car" for exemple, this protects user buying assets not having to check what they own).

    For occlussion you could just have a test scene made of blocks really (you're very much free to make a separate demo with assets you own display it in a link, just not to provide it as you're not allowed to re licence it).

    If i were you i'd redo that demo with "only" content made by you (it's ok if it's butt ugly), submit that, and make a link to a web player with the same demo but the models replaced by something better.
     
  2. laakerules

    laakerules

    Joined:
    Aug 29, 2012
    Posts:
    153
    Below*
     
    Last edited: Feb 12, 2013
  3. laakerules

    laakerules

    Joined:
    Aug 29, 2012
    Posts:
    153
  4. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
  5. laakerules

    laakerules

    Joined:
    Aug 29, 2012
    Posts:
    153
    Thank you :) First submission, calls for a crazy party in my dorm room! :p jk jk
     
  6. sleglik

    sleglik

    Joined:
    Jun 29, 2011
    Posts:
    682
    Don´t buy this asset!!!!

    I just bought and regret that money spend. That code is nightmare. A lots of unused variabled. Commented code and it is not working correctly. List of bugs is too long and I spend on it only 20 minutes.
     
  7. laakerules

    laakerules

    Joined:
    Aug 29, 2012
    Posts:
    153
    Huh? what bugs? commented code would be the Custom Lod system i was starting on with the textures?

    Please tell me the bugs you had? cause on the 9 different projects that i just put it in, no bugs, including bootcamp mechanim test and angry bots.

    Did you just Drag the Prefab into the scene like the dirrections? or did you try doing something else?


    Email me @ laake5@yahoo.com or skype dalaakeboarder

    I would love to help figure out your issues, if not then get a refund.

    Also in your comment on the asset you say an hour but in your post you say 20 minutes?
     
    Last edited: Feb 13, 2013
  8. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    Just purchased it, while it seems to work there's one pretty big issue (but i'm sure it's easy to fix).
    It doesn't apply the occlusion script to nested gameobjects, this is bad as it's heavily used in any real world project to avoid cluttering the scene view when you have thouthands of objects.
    So as a test i've put all the cubes in a single gameobject, blam down to 3FPS as none of the cubes were occluded anymore :(
     
  9. laakerules

    laakerules

    Joined:
    Aug 29, 2012
    Posts:
    153
    Ight, ill work on doing that ^ thing right away, thanks for the input ronan, im fixing it rite away.
     
  10. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    On the other hand it made a nice test to check the speed difference, when not working 3FPS, when working 60fps :)

    Haven't been through the code but so far from the sample scene i'd say:
    1) It works as advertised (i own unity pro, so i'm mostly looking for this for fast prototyping without the huge bake times)
    2) It's not perfect, but that's to be expected for realtime occlusion, so sometimes it takes a bit under a second for the scene to render perfectly, i'm assuming this is mostly due to the huge number of occluded objects in view in the test scene (2500 close objects) when you're walking sideway moving most of them in out of occlusion quickly.
    3) I can't comment on the code quality (yet) but even if the code was bad it doesn't mean the soft is buggy, so from toying around with it it doesn't seem buggy unlike what was said a few posts ago.
     
  11. sleglik

    sleglik

    Joined:
    Jun 29, 2011
    Posts:
    682
    Laakerules:

    I rewrite completely your code. Now it works for nested prefabs and mainly it uses StartCouroutine so it never laggs. Also I deleted a lots of unused code and mainly I increased performance. I cannot publish that code cause it was based on yours. I can send it to you and you can use it for free.

    BTW one note if you are selling code TRY TO USE TAB CORRECTLY!!! Your code is incredible mess!!!!
     
  12. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    That's really a personal preference issue for the tabs, his use of tabs seems fairly standard too.
    Personally i don't care for that, can just use format in visual studio resave
     
  13. sleglik

    sleglik

    Joined:
    Jun 29, 2011
    Posts:
    682
    You don´t understand. That code has different amount tabs everywhere. Somewhere were two, somewhere one. I don´t have problem when people don´t use it. But code should look same all the time... not that one void looks different than others.
     
  14. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    Really doesn't matter to me, it doesn't affect readability at all and as i said, if it does, it's just one click in most IDE to have it display to your own standards.

    OTOH i'll agree code needs some cleanup, mostly removing the commented stuff, if it's work in progress it shouldn't be submited (better to keep your own copy remove whatever isn't ready than to leave it commented)

    Edit : for exemple this doesn't look overly usefull lol


    for (int j = 0; j < oldPixels.Length; j++)
    {
    //newPixels[j] = ;
    }
     
  15. sleglik

    sleglik

    Joined:
    Jun 29, 2011
    Posts:
    682
    I already rewrited it all. Main problem was nested prefabs, unused variables from editor, not using start courotine and raycasting for displaying item. I used oposoti logic. Every item is hiding itself only raycast can reveal it. It uses less raycast than used way.
     
  16. laakerules

    laakerules

    Joined:
    Aug 29, 2012
    Posts:
    153
    Yeah, that was a piece of the pixel reducer i was working on, i cleaned that out. And slegik im sorry that you think my conventions are in-superior to yours.
     
  17. sleglik

    sleglik

    Joined:
    Jun 29, 2011
    Posts:
    682
    It is not about conventions. I will give you few examples.

    1. Variable RefreshTimer, RefreshTimerMax = never used in source code
    2. You are using calculation for time only time count not Time.delta without any info, it was a really confusing
    3. Wrong skipping tags that are not used in for occlusion! Read it again and you will find your mistake.
    4. Never used variable ExtraCheckRays.
    5. Wrong hiding object (void RenderObject) that void can be reduced and make cleaner.
    6. void RefreshObject is duplicite to code what you can find in Start void.
    7. OccludeObjects void empty else block
    8. Void GetFinal should be recursive void if you are searching for parent.

    This first notes what I made when I imported that package again :). This is only description of your code.
     
  18. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    I understand your concern but i think we should be nice to the guy for his first package, especially as it seems it was hard for him to submit, so it's important for our non coding friends that are interested in the package that while the code may be far from perfect if you want to dig into it, this actually works (mostly) just fine.
    If you're into using this and not reading it or learning how to make something similar, go ahead, it works fine and should work better once the nested object bug gets fixed :)

    (and laakerules, friendly suggestion, accept sleglik's version and re submit that, the ego is worth less than a bug free more optimized version :) )
     
  19. laakerules

    laakerules

    Joined:
    Aug 29, 2012
    Posts:
    153
    ight, but really about tabs! -.-

    1. Variable RefreshTimer, RefreshTimerMax = never used in source code
    ^ Used but commented out the initialiser

    2. You are using calculation for time only time count not Time.delta without any info, it was a really confusing
    ^Does it really mater that much?

    3. Wrong skipping tags that are not used in for occlusion! Read it again and you will find your mistake.
    ^ Sorry, im confused on what you are saying here? Wrong skipping tags, do you mean by the default ones i had in there that are unchangeable?

    4. Never used variable ExtraCheckRays.
    ^ that one i just noticed and deleted so thanks.

    5. Wrong hiding object (void RenderObject) that void can be reduced and make cleaner.
    ^ Wrong hiding object? -.-

    6. void RefreshObject is duplicite to code what you can find in Start void.
    ^ refresh object is for dynamicaly created scenes at runtime so that they can call it to re-add the components needed.

    7. OccludeObjects void empty else block
    ^ oh damn sorry didnt notice that,

    8. Void GetFinal should be recursive void if you are searching for parent.
    ^ Its not just searching for a parent, well in that version it is. i left it like that for improving on it like i just did.


    And thanks for your input slegik, its greatly appreciated, i just created a seperate option for people to use coroutine if they want to rather than the late update.
     
    Last edited: Feb 13, 2013
  20. sleglik

    sleglik

    Joined:
    Jun 29, 2011
    Posts:
    682
    2. Nobody knows how long take one frame. If you have 30 fps or 60 fps it is huge difference.

    3. Please look again at that code :). You have foreach cycle where are you searching every string s in Bypass, right? But what do you do in this foreach cycle? :) You are checking if trans.tag is Bypass, or trans.tag is Player, or if trans has ComponentController. So what will happen if you have 5 tags in Bypass? You will 5x times check for CharacterController, 5x times for tag Player, 5x times check for tag Bypass etc... Do you see my point? Start void can be 5x times slower than it should be :).

    5. look at this code :)

    public void RenderObject(bool hide)
    {
    if (hide == true)
    {
    ChangeRenders(hide);
    }
    else
    {
    if (ObjectRenders != null)
    {
    ChangeRenders(hide);
    }
    else
    {
    ObjectRenders = GetComponentsInChildren<Renderer>(false);
    }
    timer = Random.Range(MaxWait - 3, MaxWait + 3);
    }
    }

    private void ChangeRenders(bool hide)
    {
    MEHIDE = hide;
    foreach (Renderer r in ObjectRenders)
    {
    r.enabled = hide;
    }
    }

    6. I agree with that. Problem is that code is used twice same. It should be one void that is calling from start and also from void "RefreshObjects".

    8. OK :)
     
  21. sleglik

    sleglik

    Joined:
    Jun 29, 2011
    Posts:
    682
    Do you want that source code? I made that nested prefabs. Now I am testing using courotine.
     
  22. laakerules

    laakerules

    Joined:
    Aug 29, 2012
    Posts:
    153
    Yeah sure ill take a look at it, ive already done nested objects though, and changed the ObjectOcclusion up for the nested objects, cause your code above still will not work with nested objects. GetComponentsInChildren<Renderer>(false); << got rid of that and made my own system through recursive system and only gets certain renderers that fit parameters. And ima get rid of the start like you said i have it duplicated, stupid me.

    One thing, with coroutines i seem to get lag spikes, i dont see how thats better, yeah it allows to use less rays per each iteration but then if you get alot of coroutines stacked up then you can get some lag spikes. so yea idk about that so i just made it an option for them.
     
  23. sleglik

    sleglik

    Joined:
    Jun 29, 2011
    Posts:
    682
    I didn´t say that this code is fixing nested prefabs. These were mistakes in your code. My code is different. You have right that startcourotine make spikes lags. I wrote that I am testing it now :).
     
  24. laakerules

    laakerules

    Joined:
    Aug 29, 2012
    Posts:
    153
    Update now version 1.3: Works with objects that are nested, only will work on objects that are meeting the parameters, and basically just makes the system all around better, i will be making a pdf of changes today and will post a link to that. Also if an object is hidden at the start or when you ReloadObjects, then it may cause issues, this was for boundries if you have them so that it wont mess with those, if this is too much trouble let me know and i will remove that part.