I’m attempting to create a UI window in my main scene, which would display the contents of a camera in a separate scene(camera is pointed at a sphere). The second scene will ultimately be a spherical map of the world, used to track player position, and then load terrain in the first scene on a flat plane. I need a visual readout in the first scene as a UI window, and I’m having a lot of trouble understanding subviewports and how to instance the second scene.
Subviewport have an option for instantiating a new world3d. This would allow you to place the map sphere as a separate scene under the view port. (Otherwise it shares the world3d with the main viewport.)
Thanks for your reply. In the Inspector, once I’ve created a World 3D instance for the SubViewport, how do I link it to another scenes camera? Does this need to be done in GScript?
Ideally it would use the camera in the map sphere scene, but I can’t get that to work. For now, I’ve given the SubViewPort a child node Camera, in the main scene, and then added the sphereMap to the World 3D property of the subViewPort. This currently breaks the camera and renders a gray square.
It works on 4.2.2, it will be gray if you don’t have an environment and bg transparency is off.
Then your camera needs to be setup to see the sphere. I would advise making a saved scene outside the subviewport to establish the subject. Then after setting that up add the saved scene as the child of the subviewport.
Make sure to set the subviewport to own its world3d and also provide a word3d in the resource selector below it.
Here is the result with toroid with a week Omnilight.
Wow thanks so much!! I’m able to get to get SubViewPort to display a separate scene now, but I’m now sure it’s quite right. I notice that your SubViewport node has a little “scene” icon to the right of it. I rightclicked my SubViewport node, and instantiated the GlobeMap scene, but my node heirarchy looks different than yours. Are you doing something different than instantiating?
Also, the way I’m doing it, it still seems to work even if SubViewport has no World3D connected. So I think I must be missing something. Thanks again btw, I’ve been stuck on UI stuff for so long.
If you want both the main viewport and subviewport to see the same world. Then you don’t have to create a separate world3d, but the subviewport scene will also exist in your “real” world. (Unless you hide it far away.)
Sorry I made a separate scene with the subviewport. I was trying to see if it would render its world3d, but it didn’t.