Search Unity

  1. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  2. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  3. If you couldn't join the live stream, take a peek at what you missed.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Assets [RELEASED - FREE] Aura - Volumetric Lighting

Discussion in 'Works In Progress' started by raphick, Nov 16, 2016.

  1. XN4k3dBR

    XN4k3dBR

    Joined:
    Sep 15, 2015
    Posts:
    11
    When trying to compile for windows 10 UWP two errors occur:

    ERROR 01
    "Shader error in 'Hidden/Aura/ProcessOcclusionTextureShader': forced to unroll loop, but unrolling failed. at line 71 (on d3d11_9x)

    Compiling Fragment program
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF3 SHADER_API_MOBILE UNITY_HARDWARE_TIER1 UNITY_COLORSPACE_GAMMA UNITY_LIGHTMAP_RGBM_ENCODING"

    ERROR 02
    "Shader error in 'Hidden/Aura/ProcessOcclusionTextureShader': can't use flow control on this profile at line 75 (on d3d11_9x)

    Compiling Fragment program
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF3 SHADER_API_MOBILE UNITY_HARDWARE_TIER1 UNITY_COLORSPACE_GAMMA UNITY_LIGHTMAP_RGBM_ENCODING
    "
    Can you help me?
     
  2. FrozenEmpire

    FrozenEmpire

    Joined:
    Sep 10, 2016
    Posts:
    51
    Thanks for your hints. I managed to get the other parties surface shader working with the final colour Fog applied... but couldn’t get the lighting to work since there seems to be issues with surface shaders recognising the usage of Texture2DArrays. As you say, surface shaders seem to have some limitations/issues!! At least applying the fog is good enough
     
  3. raphick

    raphick

    Joined:
    Nov 15, 2016
    Posts:
    154
    Surface shaders are actually a bunch of weird macros generating uneatable book of code...

    You don't need Texture2DArray if you want to sample the lighting out of Aura, it is encoded in a Texture3D like the fog.
    Just use those lines:
    Code (CSharp):
    1. sampler3D Aura_VolumetricLightingTexture;
    2.  
    3. float4 Aura_SampleLightingTexture(float3 position)
    4. {
    5.     return tex3Dlod(Aura_VolumetricDataTexture, float4(position, 0));
    6. }
    7. float4 Aura_GetLightingValue(float3 screenSpacePosition)
    8. {
    9.     return Aura_SampleLightingTexture(float3(screenSpacePosition.xy, Aura_RescaleDepth(screenSpacePosition.z)));
    10. }
    11. void Aura_ApplyLighting(inout float3 colorToApply, float3 screenSpacePosition, float lightingFactor)
    12. {
    13.     float3 lightingValue = Aura_GetLightingValue(screenSpacePosition).xyz * lightingFactor;
    14.  
    15.     colorToApply = lightingValue;
    16. }
     
  4. raphick

    raphick

    Joined:
    Nov 15, 2016
    Posts:
    154
    I answered on the github ;)
     
  5. matteumayo

    matteumayo

    Joined:
    Jul 25, 2016
    Posts:
    153
    Is single-pass VR support something that's still being looked into?

    Thanks.
     
  6. raphick

    raphick

    Joined:
    Nov 15, 2016
    Posts:
    154
    tbh VR is not something I actively look into, BUT I quite have understood what impeach single pass and it is actually really close to the one-camera only design issue, so one step at a time I think this will be achieved
     
    matteumayo likes this.
  7. FrozenEmpire

    FrozenEmpire

    Joined:
    Sep 10, 2016
    Posts:
    51
    Good point! I had copied over the standard Aura functions which had the BlueNoise lookup that needed Texture2DArray. But without that it can be simplified as above.

    Edit: After testing the Aura lighting in the surface shader with your suggestions, the lighting seems to fix all pixels on the same colour ? Is this really the right approach to lighting for surface shaders which are using the "finalcolor" mechanism ? Something doesn't seem quite right...

    The fog however works perfectly with finalcolor - this on it's own looks good enough for me I think!
     
    Last edited: Jun 9, 2018
  8. raphick

    raphick

    Joined:
    Nov 15, 2016
    Posts:
    154
    Lighting and "foggin" occur at different stages.

    If you want to use the lighting information out of Aura, you must use a custom lighting model : https://docs.unity3d.com/Manual/SL-SurfaceShaderLighting.html

    The fog must stay in the finalColor function as it happens after everything else.
     
  9. FrozenEmpire

    FrozenEmpire

    Joined:
    Sep 10, 2016
    Posts:
    51
    Ahh, I see. Well that explains why I was having issues

    Custom lighting sounds complex, I’ll probably stay with just the fog
     
  10. Oderus_Urungus

    Oderus_Urungus

    Joined:
    Jun 8, 2017
    Posts:
    30
    I already have, and I'm currently using Aura in my game, but I'd like the Gaia extension. Do I have to redownload the entire Aura file from here?
     
  11. raphick

    raphick

    Joined:
    Nov 15, 2016
    Posts:
    154
    nah you can, from the github, just overwrite the AuraLight.cs, AuraVolume.cs and download the GaiaExtension.cs, it should do
     
    Oderus_Urungus likes this.
  12. RendCycle

    RendCycle

    Joined:
    Apr 24, 2016
    Posts:
    127
    Thanks for sharing this! I've managed to get it to work I think. But I get console errors in Unity 2018.1.

     
  13. raphick

    raphick

    Joined:
    Nov 15, 2016
    Posts:
    154
    Those are not errors but warnings because they deprecated some APIs, don't worry about them, i'll consider changing them in the futur
     
    RendCycle likes this.