Hi
Papervision-list,
I
have some trouble with 3D-Objects (no matter if primitives or Collada) and applied
shaded material on them.
What
happens is, that I do have these nasty black artefact-lines.
What
I wanted to get:
Loading
a collada-Object through the DAE-parser into PV3D and applying a phong-shaded BitmapMaterial
to it.
What
I got:
Ugly
black artefacts on the „corner“ of the 3D-Object.
Result
can viewed here: http://www.mediaville.de/lab/collada_tests/3/
Then
I thought it might be something wrong with the 3D-Model, so I decided to do the
same with a primitive of Papervision. But I got the same ugly artefacts.
Result
can be seen here: http://www.mediaville.de/lab/sphere_with_shading_bug/
In
the same code-sample I now integrated the possibility to switch bewtween
different materials mapped to the sphere by pressing 1 to 5 on the numeric
keypad. These artefacts can only be seen with the combination of a
BitmapMaterial and a Shader (no matter which one). If you apply the same loaded
Bitmap-Texture as a MovieMaterial (without shader) to the sphere (hit „5“
on the above sample), there are no artefacts. And if you apply the
PhongMaterial onto the sphere (hit „4“) it’s the same. So it
doesn’t seem to be neither the material nor the Shader. But the
combination of it?!
How
I coded it (using PV3D 2.1.920):
I
loaded the bitmap through a loader and added an EventListener:
var imgLoader:Loader = new Loader();
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
bitmapMaterialLoaded);
imgLoader.load(new URLRequest("assets/textures/orange.png"));
In
the „bitmapMaterialLoaded“-Handler I shaded the image and applied
it to a sphere:
var bitmap:Bitmap = e.target.content as Bitmap;
var bmMaterial:BitmapMaterial = new
BitmapMaterial(bitmap.bitmapData);
var light:PointLight3D = new PointLight3D(true, true);
var phongShader:PhongShader = new PhongShader(light, 0xFFFFFF, 0x999999);
var shadedBitmapMaterial: ShadedMaterial = new
ShadedMaterial(bmMaterial, phongShader);
var sphere:Sphere = new Sphere(shadedBitmapMaterial, 500);
scene.addChild(sphere);
I
tried to get an answer in the shortly released book „Papervision3D
Essentials“ (great work, my compliments to the auhors Jeff Winder and
Paul Tondeur) but unfortunately I couldn’t. Also I had a look in the
Papervision-Forum, but also no results that helped me further.
What
I found was an article about the same phenomenon: http://www.nabble.com/BitmapMaterial-%2B-PhongShader-%2B-DAE.--Why-black-lines-on-the-material--td18491117.html.
There was the conclusio (back in january 2009) that „skinned or
animated DAEs are not properly working“. With the above sphere-example this can’t
be the solution form y problem. I also tried to use different types of renderer
– with no success.
Please,
does anybody know what’s going wrong???
The
full code and the used texture is attached to this mail.
Thanks
in advance,
Markus