x


Most efficient way to create cubes with multiple textures

Hi all,

I'm trying to make a level manager that can build levels using different types of cube prefabs. I've got the basics working, but the problem I've come up against is when I have a cube that requires multiple textures.

I wasn't able to get multiple textures to work in Unity, so I dropped into Cinema4D and made the cube in there, then brought it back into Unity. When I look at the imported object in Unity I see that for each cube I have 6 separate planes and meshes which seems inefficient to me considering the amount of cubes that will be made.

Does anyone have any idea how I could streamline this a little nicer? I want to be able to create hundreds of different types of cubes.

Thank you in advance for any help that's offered.

more ▼

asked Aug 02 '10 at 01:59 PM

meroon gravatar image

meroon
28 3 3 8

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Yep that's to be expected.

In terms of making it more efficient you want to look into combining cube faces that share the same material. How you achieve that depends on your project and requirements.

I would start by just building the planes for all the cubes in a level, then sort them by material type and finally use those to build new meshes, one for each type of material containing all of the faces that use that material.

If you levels are very large I might break down the 'one mesh per material' into several based on spatial volume, so that gross level culling can take place.

This should of course be done once at the start of the level. If you need it working in an 'editor' type mode, then just use a single special cube, that uses 6 materials so the designer can see what they are placing and once placed, rebuild the meshes that need it.

more ▼

answered Aug 02 '10 at 05:18 PM

Noisecrime gravatar image

Noisecrime
1.5k 17 23 40

(comments are locked)
10|3000 characters needed characters left

That's about as streamlined as it's going to get. I suppose the "proper" way to do it is to use submeshes, so the cube will have 6 materials, with each material applying to a separate submesh. However, in practical rendering terms the results are basically the same either way.

more ▼

answered Aug 02 '10 at 02:10 PM

Eric5h5 gravatar image

Eric5h5
80.2k 41 132 519

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2196
x812
x291
x75
x53

asked: Aug 02 '10 at 01:59 PM

Seen: 2409 times

Last Updated: Aug 02 '10 at 01:59 PM