Jump to content

Planetarium Camera Help...


rbray89

Recommended Posts

Hey all... I'm in need of "cloning" the planetarium scaled camera (with modified culling mask), but I have had trouble getting it to render on screen properly.

Here is what I have tried:

overlayCamera = (Camera)Camera.Instantiate(
PlanetariumCamera.Camera,
new Vector3(0, 0, 0),
Quaternion.FromToRotation(new Vector3(0, 0, 0), new Vector3(0, 0, 1)));
overlayCamera.depth = PlanetariumCamera.Camera.depth + 1f;//tried variety from .00000001 to 10 offset
overlayCamera.cullingMask &= ~(1 << 10);
overlayCamera.cullingMask |= (1 << 18);
overlayCamera.nearClipPlane = .1f;
overlayCamera.clearFlags = CameraClearFlags.Depth; //(with and without this or set to None)

But when I try this, it seems to cull the skybox and planets if clearFlags is set to none, and will cull just the planet if set to Depth. Any Ideas?

Thanks!

Link to comment
Share on other sites

Hmmmm. What are you trying to accomplish by modifying the planetarium cam? Perhaps I can be more helpful with that info.

It isn't that I want to modify it, per-se, but I want to add a planetary overlay very near the surface and I want to avoid z-fighting by adding the overly on another layer and using another camera with a higher render priority to render it on-top.

Link to comment
Share on other sites

Ok, I figured it out. I'll try to remember to post the exact code, but it is something like this:

GameObject go = new GameObject();
Camera newCam = go.AddComponent<Camera>();
newCam.CopyFrom(ScaledCamera.Instance.camera);
newCam.Transform.Parent = ScaledCamera.Instance.camera.Transform;
//you may have to update newCam.Transform.localRot and localPos to (0,0,1) & (0,0,0)
//now set masks, depth, etc.

Link to comment
Share on other sites

  • 2 years later...
Ok, I figured it out. I'll try to remember to post the exact code, but it is something like this:

GameObject go = new GameObject();
Camera newCam = go.AddComponent<Camera>();
newCam.CopyFrom(ScaledCamera.Instance.camera);
newCam.Transform.Parent = ScaledCamera.Instance.camera.Transform;
//you may have to update newCam.Transform.localRot and localPos to (0,0,1) & (0,0,0)
//now set masks, depth, etc.

Hi there,

Do you have any more information to share on this subject? I know it's been a while since your post that I have quoted, but if you'd be willing to share some sample code that renders the mapview camera I'd really appreciate it. I am specifically trying to render the mapview in my own screenTexture, but so far am just getting a black screen.

Thanks muchly,

Ainamogel

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...