DOTS portals rendering

I am trying to build a DOTS solution with portals. It falls into the following limitations:

  • No portal is rendered twice (there’s no recursion)
  • Each portal belongs to an area, that is accessible only via one path (no loop connections via portals)
  • There’s a lot of areas (with simple geometry), connected via portals

My current approach is using a render texture and a material per portal, and a single portal camera, that I disable, move to the corresponding location and assign it some portal’s render texture. Then I call Render on that camera. I use Hybrid Renderer in this project, but not sure how to properly utilize it (or if I even need a custom renderer). Also, I have the feeling that my recursive system, that moves camera, assigns different render textures and calls Render method is something wrong in terms of how DOTS and Hybrid Renderer suppose to work. On the other hand, camera is still a managed component. I wonder if there’s a way to optimize this workflow, since even small recursion count with almost no geometry causes quite noticable FPS drop, and the thing that causes it — is each camera.Render() call

Is it functioning correctly? My only suggestion is to try using a pool of cameras with correct priorities and then enabling and disabling them but then letting Unity tell them to Render rather than render them explicitly. That might fix a resource bottleneck issue. But I haven’t tried, so it could just make the problem worse.

Thank you, I will try this approach!

Not a DOTS implementation but I find this resource interresting :

I came across this awesome video earlier, thank you! This guy uses pretty much same logic with manual camera placement and render. I believe, there might be something about shaders and screen-space portal bounding boxes that he utilizes