Jump to content

Multiview viewport


photo

Recommended Posts

Hello.

How to change main viewport image size so I can fit multiple camera views? (Like 3dMax divide screen with 1,2,3,4 views)

Viewport class do not set output size, only image dimensions https://developer.unigine.com/en/docs/2.5/api/library/rendering/class.viewport?rlang=cpp&words=viewport#highlight 

Searching forum I found that I can render to Image/texture and place it above main render window using WidgetSprite , but overlapping render images just waste of performance.

how to setup proper multi-camera-view in main view?

thanks

Link to comment

ok,

I'm done multiview with 3 WidgetSprite and got frame rate drop from ~600 to ~40 on scene with one simple object.

each view has struct like:

		public WidgetSprite spr;
		public TextureRender m_pTextureRender;
		public Texture m_pTexture;
		public Texture m_pTextureDS;

in render, for each frame and each view, I have:

			if (m_pTextureRender.isEnabled() == 0) m_pTextureRender.enable();
			m_pTextureRender.setColorTexture(0, m_pTexture);
			viewport.render(Game.get().getPlayer().getCamera());// one camera for tests
			m_pTextureRender.disable();

			m_pTexture.getImage(viewportImage);
			w_sprite.setImage(viewportImage);

I suppose it do a lot of texture copying

Is there any possibility to make it work faster?

Link to comment

Hi,

We didn't have much time to get this working yet, sorry.

Is there any chance to have 'Release' build working? It's required because there is big overhead with debug builds. Right now I already have quite big spikes with a single window running (30-70 fps on GTX 970):
image.png

With multiple windows (Operators Cam button pressed):
image.png

The Average FPS is not changed much.

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

We've checked your test scene. The performance drop is caused mostly by constantly copying textures from GPU to CPU and vice-versa. You can use WidgetSpriteVIewport to avoid this.

Please, check the attached modified sources.

Thanks!

UnigineApp.cs

UnigineRenderTarget.cs

  • Like 1

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...