Search Unity

[v1.1.0] Lily Render 360 - Stitch-free equirectangular rendering

Discussion in 'Assets and Asset Store' started by eliemichel, Mar 1, 2019.

  1. eliemichel

    eliemichel

    Joined:
    Jan 24, 2016
    Posts:
    2
    This is the support thread for Lily Render 360.

    Lily Render 360 is a tool for rendering a Unity scene into equirectangular images. It has been written with precomputed rendering in mind, so it focuses on image quality rather than rendering speed. Nevertheless, efforts have been made to make it efficient where it did not mean sacrificing quality.



    Features
    • Custom camera orientation. Lily Render 360 uses the orientation of the camera it is attached to. Whether you need to rotate a 360 video or play the hell with motion sickness, this is a must have.
    • Custom stitch lines orientation. If you need to place the stitch lines while maintaining the camera orientation; or if you want the camera to turn while the stitch lines remain in place, you can orient the stitch lines using a reference object.
    • Smooth stitch lines. Lily Render 360 provides several tools to minimize stitching artifacts. It can render an extra margin around each face of the cubemap and then smoothly merge the overlap region. Or it can render two cubemaps with different orientations and merge them.
    • Render in sRGB (Gamma) or HDR Linear color spaces.
    Example

    This has been developped mainly to fix the stitching artifacts due to post effects like strong bloom:


    Without Lily Render 360


    With Lily Render 360

    More example and usage information on the GitHub repository: https://github.com/eliemichel/LilyRender360

    Any feedback is welcome, including feedback on the publication process, since this is my first Asset release.
     
    thieum, Mark_01 and mgear like this.
  2. eliemichel

    eliemichel

    Joined:
    Jan 24, 2016
    Posts:
    2
    A new version of LilyRender360 is available!

    Source : https://github.com/eliemichel/LilyRender360/tree/v1.1.0
    Unitypackage: https://gum.co/kMcSf

    New features:
    • Add horizontal and vertical fields of view
    • Add the possibility to override the output height
    • Add a start frame parameter
    Bug fixes:
    • A major bug in the Y rotation of the stitching lines
    • Rename the 'quit after frame' parameter to 'end frame'
    • End time is not used when checkbox is disabled
     
  3. ioesten

    ioesten

    Joined:
    Feb 19, 2018
    Posts:
    14
    Hi ElieMichel,

    we would love to use your fabulous lilyrender shader/cg script combo to improve our 360 images (using EXR for high res) inside large 3d models. I have one issue - when taking all 6 face images straight after one another, as you do in your code, the sky is rendered black.

    We have seen this before and did manage to fix it by adding a couple of wait frames between each individual face image taking.

    Unfortunately when i do this and then apply your 'ConverToEquirect' the resultant face order gets messed up. The bottom face appears in front, the front face gets lost and what should be the bottom shows the top (sky).

    I cannot understand why this happens. Each face render is still taken separately and placed into your face texture array. The conversion method uses the face textures from that array. Why would waiting for a few frames, even just one, mess up the order in which they appear in the resultant equirect?

    The reason for the desired wait is to allow the background sky to render properly before the render image is taken.

    I would be very grateful, if you could help explain!

    Many Thanks!

    Ingrid
     
  4. ioesten

    ioesten

    Joined:
    Feb 19, 2018
    Posts:
    14
    Have now found that i was just inserting my wait frame at the wrong place, all good now.
     
  5. daveblancas

    daveblancas

    Joined:
    Aug 27, 2021
    Posts:
    2
    Hi eliemichel,

    First of all - congrats for the work, I can obtain the results I want so this is excellent!

    I was wondering if there should be an easy way to export 6 images for a cubemap, instead/apart of the equirect image.
    Not sure if this can be done directly from the shader.
    I am using a C# script to convert the equirect to 6 images but it is super slow (I am working with 8k equirects).

    I'm doing this because I need to render cubemaps in some cases (I have a viewer that handles both cubemap and equirect formats).
     
  6. thieum

    thieum

    Joined:
    Apr 8, 2011
    Posts:
    61
    Thanks @eliemichel,
    Really good script you shared away. A shame I didn't bump into it earlier...

    I tweaked it in my project for rendering a single frame of an HDRP raytraced scene.
    But out of the box the reflections were broken.
    As the lighting/reflections are view dependant, a 360 requires a face render per frame, so I'd like to share my quick trick:

    - turn the RenderCubemap() job into a coroutine, calling
    Code (CSharp):
    1.         _cam.transform.Rotate(90, 0, 0);
    2.         yield return null;
    3.         _cam.Render();
    before each face rendering as to await the next frame update,
    - in LateUpdate(), in if (_frame == startFrame) block, move the main routine into a new coroutine that awaits the latter and call it from there
    Code (CSharp):
    1.     IEnumerator DelayCommand()
    2.     {
    3.         string filename = AbsoluteFramePath(_frame);
    4.         if (File.Exists(filename) && !overwriteFile)
    5.         {
    6.             Debug.LogWarning("File '" + filename + "' already exists. Skipping frame (check 'Override' to force overriding existing files).");
    7.         }
    8.         else
    9.         {
    10.             yield return StartCoroutine(RenderCubemap(0));
    11.             if (doubleRender)
    12.             {
    13.                 RenderCubemap(1);
    14.             }
    15.             ConvertToEquirect();
    16.  
    17.             RenderTexture.active = _equirect;
    18.             _tex.ReadPixels(new Rect(0, 0, _equirect.width, _equirect.height), 0, 0);
    19.             byte[] data = format == Format.EXR ? _tex.EncodeToEXR(Texture2D.EXRFlags.CompressZIP) : _tex.EncodeToPNG();
    20.             RenderTexture.active = null;
    21.             File.WriteAllBytes(filename, data);
    22.         }
    23.     }
    24.  
    25.     void LateUpdate()
    26.     {
    27.         ChechParameters();
    28.  
    29.         if (_frame == startFrame)
    30.         {
    31.             StartCoroutine(DelayCommand());
    ,
    - (and delay the command Application.Quit() at least 6 frames !°)

    I finally got 8K raytraced 360 renders in a go !
    You made my day, merci !!!
     
    Last edited: Jan 28, 2023