- Home /
Orthographic Camera with an angled Near Clipping Plane?
I am designing an Isometric BaseBuilding game using Voxels (Block style) and the Orthographic camera, nested into a Camera Target that itself will be moved on the x,y,z. I have all the building of the world done, but a problem I have is I intend to 'slice' the levels at each y level. I think this can be done one of two ways.
- In each "block" render, disable the meshes above the y-level of the Camera Target, which means I need to ensure that all pathfinding and jobs function in the unrendered areas. I also need to redraw the level immediately above the Camera Target, and I am unsure of the performance impact of that if I were to quickly traverse levels.
- Set the Near Clipping Plane to "flatten" on the y level, which cuts off the camera view of anything above the Camera Target, keeping everything rendered and unchanged.
I'd like to solve this before I get too far in designing everything else, so I at least have a foundation for my rendering method that I can carry through the rest of the program. Thoughts?
Not quite certain if I understand, you want to NOT draw any blocks that are above a specific height (the height of the current level)?
$$anonymous$$y initial thought would be to do this with a shader that ignores or outputs a transparent pixel, for every point with a height (in view-space, not world-space) over a particular value.
Yes, that is what I am trying to do.
I am looking, honestly, for the most efficient way to do things. Would it be more efficient to use another check for shader rendering based on the height of my Camera Target, or would just letting the camera "cut-off" on the near plane be more efficient?
Since I am using a Camera Target (empty GameObject) as the measurement (anything above it, is to be transparent), and that will be the focal point of the Camera itself, I will be functioning off of World Space ins$$anonymous$$d of the viewport.
I'm not sure which way would be more efficient, the shader or the clipping, I'd guess it depends on the implementation.
To achieve your goal of NOT rendering these objects (clipping), you can disable the block's $$anonymous$$eshRenderer
component. This will not affect physics or anything else, just whether or not it sends the mesh to the render pipeline. Note: This would require EITHER:
-that ALL blocks have a reference to the camera, in order to compare their height to it, and appropriately enable/disable the $$anonymous$$eshRenderer Component (probably in Update()).
OR
-that you have a function that will go through your blocks and turn the $$anonymous$$eshRenderer component on/off, whenever you move the camera up/down.
Fair enough, I can envision how that would work. I'll give that a shot tonight. Thanks!
Your answer
Follow this Question
Related Questions
How to use 2 Cameras in FPS 2 Answers
have a camera from a different scene? 1 Answer
2 different cameras 2 Answers
Putting an image in the middle of two cameras (not repeated) 2 Answers