Search Unity

Feature Request Changing cubemap settings runtime (srgb, mipmap and size)

Discussion in 'General Graphics' started by WonkeeKim, Jun 2, 2022.

  1. WonkeeKim

    WonkeeKim

    Joined:
    Apr 8, 2013
    Posts:
    19
    Hi,

    Is it possible to change below settings of Cubemap in runtime?
    - sRGB
    - Mipmap
    - Size

    It seems it's not possible and I wonder Unity has any plan for enabling this.

    I have a cubemap that is captured in runtime, and want to use it as a reflection probe texture.
    (I know there is Realtime type in reflection probe but that will render another cubemap so I don't want it.)

    The cubemap is rendered for a different purpose and mipmap is not enabled which disables Standard shader smoothness so I want to change it in runtime.

    Thank you
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,343
    It is not possible, because it's not how graphics APIs work.

    When you change a texture asset's settings, what's actually happening behind the scenes is that texture on the GPU is being destroyed, and a new one is being created from scratch.

    In your case your cubemap is presumably being rendered on the GPU to a cubemap render texture. If you wanted one that had the above alternate settings, the only way to do that would be to create a new cubemap and copy the data from the original one to the new one. This is something you'd want to do anyway if you're planning on using it for a reflection probe on the standard shader, since you'd need to generate the appropriately blurred mip maps.
     
    WonkeeKim likes this.