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. Dismiss Notice

Realtime GI (LPV) for dx9 and Mac (will release soon for FREE)

Discussion in 'Works In Progress - Archive' started by brianasu, May 12, 2014.

  1. brianasu

    brianasu

    Joined:
    Mar 9, 2010
    Posts:
    369
    So are you sampling the color or is it encoded as a spherical harmonic?
     
  2. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Well, it's sort of halfway... :D
    I did try SH, but I found directly encoding a 3x3 cubemap, as colored light directions (Z+,Z-, etc.) was a lot easier, and likewise, my system uses coefficients that point in the same directions as conventional cubemap faces.

    And all of the light probing is done on the CPU, but that also means no dynamic batching... :(

    EDIT: Actually, I also have a 7th coefficient now: a color that influences how much direct light falls on an object. This helped fix issues with shadow occlusion guessing wrongly... :D
     
  3. env_warby

    env_warby

    Joined:
    Nov 22, 2013
    Posts:
    23
    Man that video looks great i downloaded the package from github but it gives me this error in unity 5.31p2

    Invalid pass number (1) for Graphics.Blit. Material=Hidden/Voxelize, npasses=1
    UnityEngine.Graphics:Blit(Texture, RenderTexture, Material, Int32)
    LightBleeding:LateUpdate() (at Assets/simple voxelisation/Scripts/LightBleeding.cs:320)


    also line 322 and 324

    Is this an easy fix?! I would love to tinker around with this


    Either way consider me impressed =)
     
  4. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    588
    got the same issue with unity 5.2.3p2 any chance for a fix ?
    Invalid pass number (3) for Graphics.Blit. Material=Hidden/Voxelize, npasses=1
    UnityEngine.Graphics:Blit(Texture, RenderTexture, Material, Int32)
    LightBleeding:LateUpdate() (at Assets/simple voxelisation/Scripts/LightBleeding.cs:324)
     
  5. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    That's due to a failed shader compile. Probably means one of the shaders broke from being given to the new pipeline...
    Hopefully, brianasu's still around to fix it. Of course, if someone's willing to check, I could try correcting the errors, but this pack isn't mine, so chances are, I'll stuff something... :rolleyes:
     
  6. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,366
    Here are the fixed shaders that will allow the system to run on unity5.x
     

    Attached Files:

    blackbird likes this.
  7. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Wow, someone actually did it. What was wrong with them? :)

    EDIT: Actually... was it something like; "Don't want it, cause not everything's initialized?" :D
     
  8. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,366
    Yes, UNITY_INITIALIZE_OUTPUT(v2f, o); was missing in various places.
     
    blackbird likes this.
  9. Misciagno

    Misciagno

    Joined:
    Jul 27, 2013
    Posts:
    88
    How does this system work? Does it require baking? Does it work in deferred rendering?
     
  10. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    588
  11. env_warby

    env_warby

    Joined:
    Nov 22, 2013
    Posts:
    23
    @elias_t: the compile error is gone thanks for that ! :)

    @Misciagno: No need for baking .... and I can see stuff in deferred rendering and it doesnt look all that different from legacy/forward render modes so I am gonna say YES it DOES work in deferred rendering however:

    It seems like the lpv is attached to a lightsource which is rather different from the experimental LPV implementation I saw in unreal 4 there its attached to the camera.
    I tried attaching the lpv to the cam which "sort of works" in unreal engine 4 the voxels/blocks/volumes kind of "step forward" similiar to the stable fit mode of a dynamic shadow casting directional light. That doesnt seem to exist here and its beyond my coding skills to mod it in. the "smooth movement of the LPV and its blending looks very wrong unfortunately. But if you are not moving the camera and tweak your values right ... it looks pretty cool :)

    @brianasu I would love to have a proper LPV implementation in unity if you were willing to continue this thing I would pay good money via the assetstore or a patreon account or anything like that ... your call :)
     
  12. env_warby

    env_warby

    Joined:
    Nov 22, 2013
    Posts:
    23
    In unreal this "fixed in space" 3d grid follows your cams fov while you move/look around:


    (that right there is a debug visualization of your voxel grid)

    What I mean by fixed in space is that when you rotate your cam cubes that leave your view on one side get replaced with new cubes on the other side each cube always appears to stay in place but there is a very small/limited/constant number of cubes total... which you can tweak.


    ... thats a total noob way of explaining it but i hope you guys understand :D