Unity3D:具有多球体网格的多摄像机渲染的性能

乌尔帕索

我有一个Unity 3D场景,其中有多个摄像头看着同一个对象(一个巨大的大脑网格,约100k tri),但从相同的角度来看并不必要。

在同一3D场景中,存在大量的球面图网格(从100到30000)。

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在所有摄像机中,我必须显示带有部分绘图网格的大脑网格。

根据摄影机视图的不同,每个图可以具有不同的大小(网格滤镜和球形对撞机),不同的材质(不透明或透明),并且可以可见或不可见。球形碰撞器必须具有与网格相同的尺寸。

我为每个球面网格设置了一个共享的网格。他们的资料可以是我定义的几种共享资料之一。

Before rendering the scene, for each camera view in the OnPreCull function i have to define which plots are visibles and how they look.

This part can be very costly, i tried several things :

  • setting gameobject inactive : too costly
  • setting local scale to vector3(0,0,0) : better but i can see that the rendering is still done in the profiler
  • setting a total transparent material : same result, but the in the profiler the rendering is now transparent instead of opaque
  • setting a layer not in the cameras layers masks : huge script cost

I don't kwnow if i can make an efficient culling system with all theses cameras looking at the same point...

I welcome any new ideas.

Fattie

First issue:

Regarding your specific question with the four dots.

Simply set the renderer.enabled = false, that's all there is to it.

Note however that as I mention in a comment, you would never try to "cull yourself" in Unity (unless I have misunderstood your description).


Second issue:

Regarding the small spheres. I suspect you have very many in the scene. You simply can't do that. In video games (the most difficult of all 3D engineering), you just do this with billboarding. It's how say "grass" is done in a scene. You can achieve this nicely with the particle system in Unity, or other techniques. An implementation is beyond the scope of this answer, but you will have to fully investigate billboarding. Simply it's a small flat image which always faces the camera in the render pass.


Issue 2B:

Note however that sphere colliders are wonderful, and you can use as many as you want. I'm sure this is obvious from base mathematical reasons. Side tip: often folks try to "write their own" thinking it will be faster. It's impossible to outwrite the 100? person-years of spatial culling scientific research in PhysX, and moreover they use the metal, the gpu, so you can't beat it.


Issue three:

Is there a chance you're using a mesh collider somewhere in the project? Never use mesh colliders, at all. (It's extremely confusing they are mentioned or used in Unity; they only have one or two very specific limited uses.)


Issue four:

I'm confused about why you are turning things on and off. I have a guess.

I suspect you are not using more than one "stage"!

There's an amazing trick about video games when you have more than one camera. In fact you have "offscreen" scenes! So you may have players in a dungeon or the like. Off "to the side" you may have an entirely duplicate or triplicate setup of the whole thing running (you could "see it if the camera turned the wrong way") for the other cameras. (In the example you would have different qualities on the dopplegangers, coloring, map-style or whatever the case is.) Sometimes you make a whole double just to run physics calculations or address other problems.

Fascinating extreme example of that sort of thing.

In short in your situation,

对于每个摄影机视图,您可能都需要一个摄影机和大脑的整个“舞台”

同样,它可以是http://answers.unity3d.com/answers/299823/view.html,但这确实是日常工作。在您的整个场景中,您将看到八个并排坐着的快乐大脑,每个大脑都有自己的摄像头。在每个项目中,您将显示任何相关的项目/角度等。(显然,如果某些项目是“相同的,除了视角之外”,则可以使用“同一大脑并带有多个摄像头”:但是我不会这样做,最好为每个视图都配备一脑一摄像头)

我相信这可能是您遇到的基本问题!

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

将实时镜头从摄像机流式传输到Unity3D

为什么在Unity3D中摄像机绕z轴旋转?

Unity3D和OpenCV集成并彼此传递摄像机帧

围绕角色旋转摄像机(上下)Unity3D

让摄像机跟随播放器-对象在3D空间中的位置和旋转(Unity3d)

unity3d(2d!)-摄像机以播放器为中心,但永远不会超出“地图”范围

在Unity3D中将背景设置为超出摄像机限制的区域(视口矩形)

当您浏览互联网时,黑客访问您的网络摄像机有多容易?

显示1没有摄像机渲染

将位置从3D摄像机转换为2D摄像机

CameraManager仅提供2个摄像机ID,但是一个设备具有3个物理摄像机。为什么?

libvlcsharp-如何从rtsp流摄像机强制多播

带有2个渲染器的VTK摄像机剪辑

Unity3D:如何制作发光的渐变球体?

Unity 5.4-在没有FoV操纵的情况下缩放RTS摄像机

如何在 Unity C# 中进行有限的摄像机移动

将多个摄像机图像显示到网格视图

将Unity中的2D摄像机移动限制在地图的边缘

在A帧中同时从两个摄像机渲染

仅LibGDX渲染(如果摄像机看到)

如何在具有特定结构的python中从红外摄像机加载dat文件

无法使用OpenCv 3.4.5从具有C ++ dll的IP摄像机(rtsp)抓取帧

OpenCV项目3D坐标到2D摄像机坐标

摄像机移动时,除播放器外,场景中的所有内容看起来都模糊不清。Unity2D

unity 前进位置 = 摄像机角度

如何使摄像机从 Unity 中的目标对象后面跟踪

Unity3d与网格的碰撞

3D成像的准确性和摄像机数量

如何合并摄像机固定位置的两个3D点云。