x


How to create a procedural mesh with multiple materials?

I'd like to create a procedural mesh that makes use of multiple materials. How can this be done? I don't see any way from the mesh API to be able to change the material assigned to triangles? I understand the materials are set in the MeshRender, but how does the material renderer know which material to assign during rendering the different parts of the mesh?

more ▼

asked Apr 23 '10 at 12:00 PM

Montdidier gravatar image

Montdidier
1 1 1 2

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

1 answer: sort voted first

Use Mesh.subMeshCount and Mesh.SetTriangles(), and assign materials with Renderer.materials. They go in order (the first material goes with the first submesh, etc.).

more ▼

answered Apr 23 '10 at 03:55 PM

Eric5h5 gravatar image

Eric5h5
80.1k 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:

x1353
x298
x291
x273

asked: Apr 23 '10 at 12:00 PM

Seen: 2938 times

Last Updated: Apr 23 '10 at 12:00 PM