I want to create a cubemap from a webcamtexture to put into a cubemap of an HDRI sky

I would like to use omnidirectional camera footage to perform image based lighting in real time with Raytracing.
So, I want to create a cubemap from a WebcamTexture to put into a cubemap of an HDRI sky.
but WebcamTexture is 2DTexture, not cubemap. I want to know how to put webcamTexture from omnidirectional camera into HDRI sky.
I’m sorry for my poor English, but I would appreciate any help.

1 Like

You can not assign the WebcamTexture directly to the sky. One (more optimized solution) would be to create a custom sky type. But to keep it simple, I propose to use an intermediate CustomRenderTexture which job will be to convert the 2DTexture from WebcamTexture to a cubemap.

  1. Create a new CustomRenderTexture
  2. Copy these settings in your CustomRenderTexture inspector
  3. Create a new CustomRenderTexture Shadergraph
  4. Setup the shadergraph like this to map the 2D Texture to the Cubemap
  5. Create a new material using the shadergraph (don’t forget to save :slight_smile: ), assign your WebcamTexture on the material, and assign the material to the slots in the CustomRenderTexture asset.
  6. Use a HDRI Sky volume component in you scene, and set it as the active sky. Set the CustomRenderTexture as cubemap for the sky, set ambiant mode to dynamic, and it should work !
1 Like

thank you for teaching me !! I have done successfully. It’s very helpful, since I lost the road for long time.