AndrewRayCode / AndrewRayCode/three-subdivision-modifier

THREE.SubdivisionModifier.prototype.modify lose materialIndex

Open
#2 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4
Forks
1
PR merge metrics
No merged PRs in 30d

Description

When I am using :

var modifier = new THREE.SubdivisionModifier( 2 );
modifier.modify( geometry, materials );

to modify a cube with different material for each face, I found an issue that new faces always have materialIndex = 0;

I changed a little code to apply the newFaces materialIndex with oldFaces materialIndex, then solved this issue:

on step 3. after newFaces have been created, I add following codes:

for ( i = 0, il = newFaces.length; i < il; i ++ ) {
newFaces[i].materialIndex = oldFaces[ parseInt(i/4)].materialIndex;
}

hope this can help.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.