# How render work on cubeMaterial?

Hello ,

until yesterday i believed object3D was a set of mesh and mesh was a set of geometry + material with only 1 object for each . I have discovered structure of cubeMaterial , so the mesh of object3D contain 1 geometry ( boxGeometry ) and 6 materials !

So the question is , how does the render work on this type of mesh ? any doc about it ? ( it is to improve my knowledge about three.js )
thank you very much

and other question , relative with my previous thread , If several material is possible in one mesh how is set customDistanceMaterial to take all map of all material into account ?

You can apply multiple materials as an array of materials to your mesh. That means the geometry is divided into several parts and rendered with different materials. The groups property of geometries defines this division.

Internally, the renderer creates multiple render items from such a multi-material object. It’s essentially the same like having multiple meshes (one for each material).

thank for answer . First i ve searched groups property …didn’t find cause i was again with R124 , so i switch to R128 and indeed i found groups .

i ve developed different property see result : ( for boxgeometry(2,4,6) )

groups

;start : 0
;count : 6
;materialIndex : 0

;start : 6
;count : 6
;materialIndex : 1

;start : 12
;count : 6
;materialIndex : 2

;start : 18
;count : 6
;materialIndex : 3

;start : 24
;count : 6
;materialIndex : 4

;start : 30
;count : 6
;materialIndex : 5

;start : 30
;count : 6
;materialIndex : 5

we can see materialIndex go until 5 cause 6 Materials and count go until 36 cause 12 triangles ( 6 faces *2 triangles in cube) * 3 vertex

so now Index property :

;name :
;array : 0,2,1,2,3,1,4,6,5,6,7,5,8,10,9,10,11,9,12,14,13,14,15,13,16,18,17,18,19,17,20,22,21,22,23,21
;itemSize : 1
;count : 36
;normalized : false
;usage : 35044
;updateRange : [object Object]
;version : 0
;isBufferAttribute : true

i see length 36 ,so it is the start /count in groups , and value is a set between 0 and 23

searching about it and found property attributes.position .

;name :
;array : 1,2,3,1,2,-3,1,-2,3,1,-2,-3,-1,2,-3,-1,2,3,-1,-2,-3,-1,-2,3,-1,2,-3,1,2,-3,-1,2,3,1,2,3,-1,-2,3,1,-2,3,-1,-2,-3,1,-2,-3,-1,2,3,1,2,3,-1,-2,3,1,-2,3,1,2,-3,-1,2,-3,1,-2,-3,-1,-2,-3
;itemSize : 3
;count : 24

so 24 vertex * 3 coord = 72 for the lengh but i dont undertand why 24 ?

edit: so i ve got after counting and identified vertex : 8 vertex * 3 times in the array

0,11,17
1,9,20
2,13,19
3,15,22
4,8,21
5,10,16
6,14,23
7,12,18

Edit2 : i ve compared with R214 , before it was vertices property = 8 objects and faces property = 12 objects so it was more logics . why this change in R128 to store 3 times the 8 vertices ?