away3d / away3d-core-fp11

Away3D engine for Flash Player 11
http://www.away3d.com
Other
640 stars 273 forks source link

Merge.apply creates dark materials, 4.1.1 #624

Closed flxeken closed 10 years ago

flxeken commented 11 years ago

When I use the merge tool on two meshes with lighted materials on them I end up with one mesh with pitch black material. If I remove the lightpicker from the materials afterwards they have the right color. It seams that something happens with the way they reflect light when they merge.

to reporoduce:

  1. Create two meshes and apply different ColorMaterials to them. Make sure both materials have the same lightpicker.
  2. merge them by creating a new instance of Merge and calling the apply function.

I get similar problems when using Explode on loaded 3D-models, I have not seen this happen before 4.1 update.

JohnBrookes commented 10 years ago

Its because of this line https://github.com/away3d/away3d-core-fp11/blob/dev/src/away3d/tools/commands/Merge.as#L274 Its adding position data to the normals. So var m:Matrix3D = mesh.sceneTransform.clone(); m.appendTranslation( -mesh.scenePosition.x, -mesh.scenePosition.y, -mesh.scenePosition.z); m.transformVectors(normals, normals);

said this on skype a few months ago. Forgot :/

gonchar commented 10 years ago

thank you for the issue!