How to use a scene capture cube without severe performance loss?


I am trying to make something which makes use of portals, only when I use a scene capture cube I lose 80% performance.

Is there any way to fake a capture cube? I know I can use a scene capture 2D, but that just doesn’t give the result I want.

How does the Source Engine do it without a lot of performance loss?

What is the main difference you need to use a scene capture cube for? Have you tried instead increasing the FOV of a scene capture 2d? If you aren’t using it for a full stereo reprojection it might work. Also you can turn down the resolution of the cube render target but I am pretty sure the main perf issue is that scene capture cube will actually use 6 scene capture 2d operations. So this means your CPU tasks will be done 6 times including things like occlusion and culling.

Have you tried using the “Show only actors” filter to list only the bare minimum scene actors for the cube? Doing that and keeping the count very low is about the best I can think of to improve the speed without doing some code changes of some kind. Basically it should lessen the CPU burden to tell the engine which meshes to render instead of it having to figure it out 6 times, but I haven’t tested this for performance yet.

Well in Source Engine the portals are 2d planes so as RyanB said, higher FOV 2d capture actor should do exactly what you want.
Unless you have 3D portal geometry that needs to show other dimensions, you should be able to get by with 2d capture. Even then you can screen project 2d capture over 3d portal geometry and still get decent result.

Maybe if you really need that 3d capture cube, you can update it’s sides one per frame. This way you’ll have new cube capture every 6th frame and you can blend it with the previous one. Choppy, but still a cube.

I changed it to 2D but with a higher FOV you can’t look sidewards if you stand to the side.

I want the same portals as in this video:

Sorry to hijack this thread, Ryan a quick note on “Show only actors” i am using 4.13, this option wont update the target texture when lights move on the captured actor, by default without this option all seems fine but as soon as i pick an object through the filter it just stops updating it altogether. I will check again but so far no luck. Hope there aren’t any known issues with it in the preview builds?

I changed it to 2D but with a higher FOV you can’t look sidewards if you stand to the side.

I want the same portals as in this video:[/QUOTE]

I believe you have to point the 2d capture actors at an angle from their portal surfaces depending on the angle between the camera and the oposite portal surface. The same applies for 2d capture actors movement. This makes me think that the 2d capture actors FOV should match the first person camera FOV. Keep in mind that I don’t have actual experience doing this :slight_smile:

After looking at your video, my advice will be to choose a frame from it with both portals visible and draw on paper the top down schematic with all view vectors and figure out what will go where and why :slight_smile:

That isn’t my video and I am not one for drawing something on paper.

You should get in the habit then since sometimes it is invaluable to be able to conceptualize these kinds of problems with sketches.

I belive that you also need to use clipplane that is placed where portal lies.

But on paper you can’t calculate performance loss and that is what this thread is mainly about.

Thanks for the suggestion though.

For performance you need to use SceneCapture2D. To make that work you may need to sketch it up.

Thanks for the suggestion.