Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Couple of performance questions

Discussion in 'Editor & General Support' started by Sync1B, Apr 3, 2006.

  1. Sync1B

    Sync1B

    Joined:
    Sep 13, 2005
    Posts:
    561
    Ok, so on my 3D sphere map (shown here) all of my stations, big ships, ect, are all being rendered twice, once on the gameworld camera once on the radar camera. My question is because this is being rendered twice is it pretty much using the same amount of reasorces as having 2 different objects?

    I would like to use the same mesh but with a different shader for the radar. I would doubt there is much of a performance difference between those options any way but I was just curious.

    Second, in my game you can go extremely far away from objects and one of the small issues I was having is Z fighting. I was wondering how resource taxing it would be to have one camera rendering close objects and far away objects. (kinda like a LOD system with out the deatail).

    For example lets say we have a camera with a near clip plane of 0.1 and far of 2,000 and another camera with a near of 2,000 and far of 50,000. Neil said then you would be rendering every thing twice. What I didnt understand is if one camera has a near clip of 2,000 how is it rendering any thing closer then that sinse it doesnt see it? This also isnt a huge deal because I have worked out ok numbers for using one camera 1:20000 seems to be a good ratio. Once again im just curious.

    Third, when using a multi camera LOD system can it really speed things up that much? It seems to me your sacrificing less polys being rendered at once for more objects, which I know can be reasource heavy. So how much of a performance gain can there really be?

    Thanks a lot,
    Bill
     
  2. NicholasFrancis

    NicholasFrancis

    Joined:
    Apr 8, 2005
    Posts:
    1,587
    Having an object rendered twice is pretty much the same cost as rendering two objects.

    For the 2-camera setup, there is very little performance hit from rendering with 2 cameras. Only the objects that straddle your threshold gets rendered twice.

    For using lodded cameras, the trick is to group many objects together into one for the low-lod. spaceships are hard to do this with, but if you have a city, in the near version, you have one building pr. object. In the low-lod, you have 4 objects for the entire city.

    An example with spaceships could be that you don't render gun turrets and other details in the low-lod.
     
  3. socksy

    socksy

    Joined:
    May 21, 2005
    Posts:
    244
    You render the camera from 2000 to 50,000 first, and instead of clearing it you set the camera to no clear. This means that the next camera draws on top of the previous, rather than on a blank colour/skybox. You set the second camera to clear properly.