I’m trying to add bullet holes to an armoured plate. I add the hole, but I want a tube to show the depth of the plate. So far I’m able to add the tube in the right place (click on the plate to add a bullet hole) but the material of the cylinder is only on the outside (check out blue colour on flipside of plate)
var holeMat:ColorMaterial = new ColorMaterial(0x0000FF, 1); holeMat.lights = [_light]; holeMat.bothSides = true;
var c:Cylinder = new Cylinder(holeMat,-23, -20,20,16,1,false,false,false); //MeshHelper.invertFaces(c); plate.addChild(c);
Using MeshHelper.invertFaces, I get the following:
RangeError: Error #3669: Bad input size. at flash.display3D::VertexBuffer3D/uploadFromVector() at away3d.core.base::SubGeometry/getVertexNormalBuffer() at away3d.core.base::SubMesh/getVertexNormalBuffer() at away3d.materials.passes::DefaultScreenPass/render() at away3d.materials::MaterialBase/renderPass() at away3d.core.render::DefaultRenderer/drawRenderables() at away3d.core.render::DefaultRenderer/draw() at away3d.core.render::RendererBase/executeRender() at away3d.core.render::RendererBase/render() at away3d.core.render::DefaultRenderer/render() at away3d.containers::View3D/render() at RealtimeDeformation/redraw()
I tried with a cube and get the same error.
I have the latest version of MeshHelper.as
Any ideas?
Cheers,
Pete
theMightyAtom, Sr. Member Posted: 29 June 2011 06:49 PM Total Posts: 669
[ # 1 ]
I should also mention, generally I can’t get lights to work on the reverse side of faces even with bothsides=true on the material. They are always black. I have hunted for a bothSides for the PointLight, but haven’t found any way to apply light on both sides of a plane.
Choons, Sr. Member Posted: 29 June 2011 09:39 PM Total Posts: 281
[ # 2 ]
I see what you mean. Still looks good though. Normal mapping for the bent metal edge of the hole?
John Brookes, Moderator Posted: 29 June 2011 10:04 PM Total Posts: 732
[ # 3 ]
It is a bug.
Works if you don’t add a light to the material.
theMightyAtom, Sr. Member Posted: 30 June 2011 06:44 AM Total Posts: 669
[ # 4 ]
That’s a big bug. So I guess the only workaround at the moment is to double the geometry, using a plane for each side?
Choons, yeah, you sussed it
For me that’s the real power of Molehill over other engines, the ability to easily build and manipulate complex multi-layer materials, with vector and bitmap layers, blend modes, etc. at runtime.
John Brookes, Moderator Posted: 30 June 2011 09:20 AM Total Posts: 732
[ # 5 ]
The normal and vertexData gets lost in the Invert function.
As in
normals = new Vector.<Number>();
tangents = new Vector.<Number>();
but nothing is put into them. So when you add a light it breaks.