I’m trying to set RenderSettings.customReflection with a RenderTexture, but I’m not sure how or if this is even possible. I can create a RenderTexture that is a cubemap, but I can’t get a Cubemap object from that to plug into RenderSettings.customReflection.
I tried casting but it gives “error CS0039: Cannot convert type UnityEngine.RenderTexture' to UnityEngine.Cubemap’ via a built-in conversion”
I tried casting to a Texture and then a Cubemap, but then I just get null. That makes sense, but it was worth a try.
Haven’t been able to find any conversion methods. Seems like this should be possible. Am I missing anything? Maybe I should submit a feature request?
I would like to know that too. We get the texture from ReflectionProbe.BlendCubemap, so it's a Cubemap.
To achieve what you want, I would suggest creating a giant Reflection Probe around your environment and add a script that uses the ReflectionProbe.BlendCubeMap() function.
This will return a RenderTexture that you can assign by script in the probe. The function is quite efficient (~0.3 ms). Here’s a simple proof-of-concept script:
Simply add this script to a probe, set the two cubemap, press play and use the slider to see it blend between the two maps. This will work on all objects affected by the probe.
You did not answered his question. The method you mentioned that still created a RenderTexture cubemap that can not apply to the RenderSetting.customRefection.
I would like to know that too. We get the texture from ReflectionProbe.BlendCubemap, so it's a Cubemap.
– maxxa05