How to render two scenes at once

Hi all, i’d like to render a scene into a texture, and then use that texture in another scene. What is the best way to do this? I have a hackish solution working which is having both scenes in the same space and Unity scene - but miles apart. Camera1 renders it’s portion of the space (scene1) to a texture, and that is used in the other scene at the other end of the space. However this feels quite ghetto. Is there a proper way to do this? E.g. like having two scenes somehow loaded at once but not affecting each other (lights, fog etc.).

Also in a case like this, how can i control render order? I.e. scene1 is rendered first to a texture, then that texture is used in scene2 and that is rendered.

P.S. this is with Unity Pro. I’m comfortable with coding and I’m aware of LoadLevel / LoadLevelAdditive etc. However I dont think I can be loading scenes and changing like that every frame.

P.P.S. the two scenes are completely independent. I.e. imagine someone in room1 doing a video chat, on their monitor they see someone else in another room2 talking back. I first need to render the person in room2 to a texture, and then use that texture on the monitor in room1 and render that. Except they might not be rooms, they could be vast open expanses. E.g. person2 is on a boat in the middle of an ocean and person1 is on a flying saucer in space. Putting both settings in the same unity scene is a pain. I am currently creating them both in separate unity scenes, and using LoadLevelAdditive (once, at startup) to load one scene into the other, but offset by 1000s units - but that feels a bit ghetto.

Are you sure that's the best way? Wouldn't it be better to fake it somehow? I can't imagine loading an entire scene could be a good method, when you only want to render a tiny portion of it!

1 Answer

1

One approach could be to put the second scene on completely different layers, and to adjust lights, cameras, collision settings etc. to prevent the scenes interfering with one another. However, there are several limitations and issues which may cause problems, especially if both scenes are rather complex:

  • The limited total number of layers
  • The limitations in the culling mask for lights (I think there is a maximum number of “unchecked” layers per light, or for all lights, or something like this. Not sure about this.)
  • The amount of work to change all layers of all objects of one scene
  • The general mess this solution creates in the scene view
  • All the little interferences between scenes I might have forgot about

So I guess this would only be a considerable solution if one of the scenes is very simple (say, only one or two layers). And even in this case, the lights may still cause problems.

Or instead of different layers, place them widely apart in space in the same scene.