Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question I get "seams" when rendering 360 images with path tracing

Discussion in 'High Definition Render Pipeline' started by EugenioA, Nov 8, 2023.

  1. EugenioA

    EugenioA

    Joined:
    Jul 9, 2020
    Posts:
    9
    Hi. I wrote a code to render cubemaps with accumulation (path tracing). As you can see in the picture, there are "seams" where the 6 faces meet. Capture_638350581543873362.jpg

    Here is part of thecode that renders 1 face and copies it inside the cubemap renderTexture.
    Code (CSharp):
    1. for (int camOrientation = 0; camOrientation < eulerAngles.Length; camOrientation++)
    2.         {
    3.             cam.transform.eulerAngles = eulerAngles[camOrientation];
    4.             RenderTexture rt = RenderTexture.GetTemporary(verticalResolution, verticalResolution);
    5.             yield return StartCoroutine(CaptureRenderTexture(value => rt = value, true));
    6.             Graphics.CopyTexture(rt, 0, cube, camOrientation);
    7.             RenderTexture.ReleaseTemporary(rt);
    8.         }
    9.         cube.ConvertToEquirect(equirectMono);
    10.         SaveAsImage(equirectMono);
    Any idea on how to get rid of the "seams"?
     
    Weidz_ likes this.
  2. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    459
    I don't think its fixable unless unity implement panoramic mode for camera. There's no reason denoised samples will match at the edges when stitching separate images. Probably result will improve if you'll use very high amount of samples in pathtracing so that denoising wouldn't impact image very much.
     
  3. nuFF3

    nuFF3

    Joined:
    Dec 7, 2013
    Posts:
    6
    Yeah, as Onigiri said it's unfixable at the moment since we're splicing separate images together.
    Each cube face will not have the same spatial information after all. Sure the Albedo and Normals will be accurate, but the noisy beauty pass does not have the same info from face to face spatially. Because of this you're bound to get denoising artifacts like edges of each face being "visible".
    You can try to "overscan" rendering the images, then crop the results and then stitch them together again. Not sure if it would remove the seams but it might help a little.
    You could also try to render every face to a big rendertexture, and then send that through to the denoiser.
    Basically what I'm suggesting is rendering each face at whatever resolution you desire (1024x1024 perhaps per face), but render them into one large rendertexture like one of these (from Unity docs)
    https://docs.unity3d.com/Manual/class-Cubemap.html
    CubeLayout6Faces1.png
    As an example, the one where it's stored one next to each other, +X -X +Y -Y +Z -Z, and then send beauty pass, albedo, and normals to the denoiser. Three rendertextures effectively.
    Even with the horribly documented denoising Unity provides, you can send it information and get a denoised result back.
    Take a look at the denoised package and see what you can find, iirc there's a barebones example script in there.
     
  4. EugenioA

    EugenioA

    Joined:
    Jul 9, 2020
    Posts:
    9
    Thanks. Your comments make sense. I'll test some more in the comming days.
    Right now I found I have another problem... copying the texture with
    Graphics.CopyTexture(rt, 0, cube, camOrientation);
    actually mirrores the texture :eek:. Shouldn't be too hard to fix