hello,
i did a test with a plane and 2 lights.
the plane material bothsides = true.
but seems that the light only affect one side of the plane
when the other side remains black.
is it a bug?
bothsides and lightsSoftware: Away3D 4.x |
||
YG, Newbie
Posted: 29 November 2011 07:03 PM Total Posts: 18 hello, i did a test with a plane and 2 lights. but seems that the light only affect one side of the plane is it a bug? |
||
theMightyAtom, Sr. Member
Posted: 29 November 2011 09:03 PM Total Posts: 669 [ # 1 ] I think you’d call it a “known limitation”. The lights use the normals of an object, so when you look at the reverse side of a plane the normals are pointing away, thus no light. The only workaround I’m aware of is using double geometry, ie. 2 planes back to back. That way you can also have different materials on both sides, as in a playing card, for example. Good Luck! |
||
inSertCodE, Sr. Member
Posted: 29 November 2011 10:57 PM Total Posts: 105 [ # 2 ] theMightyAtom is right. Clone the subGeometry of the plane, flip it (I think it can be done with scale - 1 ?) or better, edit the normals of the second sub geometry with -1 values everywhere were you have 1 and you’re good to go. |
||
inSertCodE, Sr. Member
Posted: 30 November 2011 12:06 AM Total Posts: 105 [ # 3 ] Here, non-tested code as a hint. Assuming you have a plane called _Plane.
private var _subG:SubGeometry; or directly
_Plane.geometry.addSubGeometry(_Plane.subMeshes[0].subGeometry.clone());
after that
for (var i:int = 0; i < _Plane.subMeshes[1].subGeometry.numVertices * 3; ++i) { ...or…
for (var i:int = 0; i < _Plane.subMeshes[1].subGeometry.numVertices * 3; ++i) { |
||
theMightyAtom, Sr. Member
Posted: 30 November 2011 07:50 AM Total Posts: 669 [ # 4 ] For a simple plane, I would either just rotate your second plane 180, or just use the MeshHelper
MeshHelper.invertFaces(yourMesh)
It’s a bit easier than doing it “by hand” and doesn’t rely on having a normal that is exactly “1” in some direction. |
||
|
||
theMightyAtom, Sr. Member
Posted: 30 November 2011 02:16 PM Total Posts: 669 [ # 6 ] The normal is the direction it is facing, as a vector. When you are looking at the back of the plane, all the normals are facing away. If they are to build 2 sided materials in Away3D 4, the normals must face in both directions, or the light must know to use negative and positive normal directions in it’s output calculation. So far this hasn’t been implemented, but I remember Fabrice talking about including it. |
||
|
||
theMightyAtom, Sr. Member
Posted: 02 December 2011 09:02 AM Total Posts: 669 [ # 8 ] There’s a good primer here about the way most 3d technologies, including Away3D/Stage3D function, in the form of a slideshow. Happy exploring |
||
|