- Home /
Rendering one side of a cube?
How do I make it so that I only render a select number of faces on a a cube and not all six?
Why do you want to render only some cube sides? Do you want to render something like a box or a tunnel? Unity shaders use cull back option, which means they do not render the back sides. If you place a camera inside a cube, for instance, you will not see any face because all of them will be showing their back sides to the camera.
The one problem with that is I believe that if I have a large number of cubes in a plane, then it will still render the side even if I cant see them causing extra lag
Ok, your concern is about performance. Back culling is used exactly to avoid rendering invisible sides, which would be a waste of time, so you don't need to worry about this. But there are worse problems: Unity renders everything in the camera frustum - even things that are behind mountains or buildings. It becomes particularly heavy when you have a complex terrain with several mountains and valleys one after the other, or when the player is inside a building with many rooms, enemies, itens etc.
Answer by Jessy · Aug 03, 2011 at 01:59 PM
Use a square, not a cube.
I am sorry, I dont really have any experience in this area, how would I generate just a square? does it involve creating a mesh? Thanks for the answers!
You can use planes - just adjust the scale to get the desired size. But remember that cull back thing: you can only see one side of the plane - the other is invisible because it's the back side. You will need a 2 sided shader to render both sides, but these shaders don't correctly process the lights in the back side because normals are reversed.
Yes. You need to learn to model, or have a modeler $$anonymous$$mmate, if you're going to use Unity. The default plane is not a square; either – it's 100 squares! (Better for specular highlights with vertex lighting.)
He's worried about performance - using planes definitely will not be a good alternative...
Your answer
Follow this Question
Related Questions
Generate cubes in 5 areas 1 Answer
Mapping Cube to Sphere - Using 64 planes as a cube "side" 1 Answer
Generating a grid of cubes with space between. 2 Answers
Procedurally Generated Cube Mesh 3 Answers
How do I combine faces of cubes? 1 Answer