Search Unity

Is there a method to render from camera directly onto a sphere instead of flat clip-plane?

Discussion in 'Editor & General Support' started by Dreamback, Mar 4, 2019.

  1. Dreamback

    Dreamback

    Joined:
    Jul 29, 2016
    Posts:
    220
    I have a somewhat complicated issue. I'm currently doing a camera render to a spherical texture by first doing Camera.RenderToCubemap into a RenderTexture, and then RenderTexture.ConvertToEquirect. This is just as if Unity was rendering to a sphere instead of a clip-plane, and is exactly what I need.

    The problem is I have a shader capturing data during the RenderToCubemap (using a replacement shader), and that data is captured from the flat planes of the cube map, so even though the screen positions are stored as a sphere, the data isn't. If the Cubemap has Bilinear filtering enabled, that fixes the problem, the data gets warped into a spherical shape! ...but then some of the data gets filtered incorrectly.

    So what I want is some way to have the camera render directly to a sphere, and I'm not exactly sure how to go about that. It's hard to search for because I just find lots of people who only care about capturing images for 360-degree videos, and bilinear filtering works pretty good for images.