FP10 problem with renderer z-sorting

2 views
Skip to first unread message

ben

unread,
Sep 2, 2009, 8:16:48 AM9/2/09
to away3d.dev
Hi everyone, back from holydays, I've decided to port a project to
FP10, everythings works fine, but I now have a strange
behaviour, objects are rendered as if they had ownCanvas and pushBack
(or Front) applied, even if they do not !!

Maybe something with the renderer : basciRenderer ?
As when I change angle of camera they sort correctly (sometimes, when
far from the screen bounds..).

I uploaded a file to visualize : F10z-problem.jpg.

thanks !

;-)


Rob Bateman

unread,
Sep 11, 2009, 6:40:15 PM9/11/09
to away3...@googlegroups.com
Hey Ben

are you still having this problem? there's nothing known about that would cause something like this - but for us to investigate any further we would really need a slice of code that demonstrated what you are seeing. let us know

Rob
--
Rob Bateman
Flash Development & Consultancy

rob.b...@gmail.com
www.infiniteturtles.co.uk
www.away3d.com

ben

unread,
Sep 11, 2009, 6:44:57 PM9/11/09
to away3d.dev
HI Rob, I'm still havin this issue, this is a very long piece of code
and I really don't get the problem (it's only a port to F10 of a fully
working FP9 project).
I have custom methods in every corner, but none that could change
anything to the rende pipe.
In order to make a real debug, I could send you the full source (and
point at the custom stuffs), as soon as I clean it a little...
agree ??

Rob Bateman

unread,
Sep 11, 2009, 7:14:36 PM9/11/09
to away3...@googlegroups.com
I'm afraid searching through someone elses project is not something we can commit to. If the bug is consistent, it really shouldn't be that hard to isolate. all that we ask is you send the cleanest example of the engine misbehaving, and we'll (hopefully!) manage to do the rest

cheers

Rob

ben

unread,
Sep 11, 2009, 7:35:15 PM9/11/09
to away3d.dev
ALL APOLOGIZE !! ! !!!

I know where it comes from :

I have some custom fx property on my bitmapMaterial, it achieves
interesting material render or fake some others at low perf, all takin
place in the renderTriangle methid of the session and based on matrix
transformation.
With f10 I had to change my method and let the bitmapMaterial choose
btw two way of render depending on how fx property was set:

ex: the "refract" property is set :
in the renderTriangle method of BitmapMaterial I can swap btw two
renderTriangleBitmap Method (wher i can manage my matrix tricks), the
old and the F10 :
if(refract){
_session.renderTriangleBitmap(_bitmap, getMapping(tri), tri.v0,
tri.v1, tri.v2, smooth, repeat, _graphics,"refract");}
else {_session.renderTriangleBitmapF10(_renderBitmap, getUVData(tri),
_screenVertices, _screenIndices, tri.startIndex, tri.endIndex, smooth,
repeat, _graphics);}

what I forgot, is that I'm a lazy boy:
when creating it as I couldn't find the old v0,v1,v2 of face, (or
something like that) in the old renderTriangleBitmap, I made some
change to it :

/**
* Draws a triangle element with a bitmap texture into the graphics
object.
*/
//public function renderTriangleBitmap(bitmap:BitmapData,
map:Matrix, screenVertices:Array, screenIndices:Array,
startIndex:Number, endIndex:Number, smooth:Boolean, repeat:Boolean,
layerGraphics:Graphics = null):void
public function renderTriangleBitmap(bitmap:BitmapData,
map:Matrix, v0:ScreenVertex, v1:ScreenVertex, v2:ScreenVertex,
smooth:Boolean, repeat:Boolean, layerGraphics:Graphics =
null,fx:Boolean = false):void
{
if (!layerGraphics && _layerDirty)
createLayer();
//// <----------ben mod, in order to use screenVertex
a2 = (v1x = v1.x) - (v0x = v0.x);
b2 = (v1y = v1.y) - (v0y = v0.y);
c2 = (v2x = v2.x) - v0x;
d2 = (v2y = v2.y) - v0y;

m.a = (a = map.a)*a2 + (b = map.b)*c2;
m.b = a*b2 + b*d2;
m.c = (c = map.c)*a2 + (d = map.d)*c2;
m.d = c*b2 + d*d2;
m.tx = (tx = map.tx)*a2 + (ty = map.ty)*c2 + v0x;
m.ty = tx*b2 + ty*d2 + v0y;
//<---------------END
/*

_index0 = screenIndices[startIndex]*3;
_index1 = screenIndices[startIndex+1]*3;
_index2 = screenIndices[startIndex+2]*3;

a2 = (v1x = screenVertices[_index1]) - (v0x = screenVertices
[_index0]);
b2 = (v1y = screenVertices[_index1+1]) - (v0y = screenVertices
[_index0+1]);
c2 = (v2x = screenVertices[_index2]) - v0x;
d2 = (v2y = screenVertices[_index2+1]) - v0y;

m.a = (a = map.a)*a2 + (b = map.b)*c2;
m.b = a*b2 + b*d2;
m.c = (c = map.c)*a2 + (d = map.d)*c2;
m.d = c*b2 + d*d2;
m.tx = (tx = map.tx)*a2 + (ty = map.ty)*c2 + v0x;
m.ty = tx*b2 + ty*d2 + v0y;
*/
///// just a trick for fx
if(fx) {m.scale(.5,.5);repeat = true;};
area = v0x*(d2 - b2) - v1x*d2 + v2x*b2;

if (area < 0)
area = -area;
if (layerGraphics) {
layerGraphics.lineStyle();
layerGraphics.moveTo(v0x, v0y);
layerGraphics.beginBitmapFill(bitmap, m, repeat, smooth
&& area > 400);
layerGraphics.lineTo(v1x, v1y);
layerGraphics.lineTo(v2x, v2y);
layerGraphics.endFill();
} else {
graphics.lineStyle();
graphics.moveTo(v0x, v0y);
graphics.beginBitmapFill(bitmap, m, repeat, smooth &&
area > 400);
graphics.lineTo(v1x, v1y);
graphics.lineTo(v2x, v2y);
graphics.endFill();
}
}

and the fact is that go back to the old v0,v1 seems to make the z
sorting incorrect.
I have to pass screenVertices, screenIndices, startIndex,... instead.

And I don't understand why I didn't ???
I'll have to take a look at it because it seems that I could use them
at first... Lazyness, or something that is out of my mind when writing
now...
I'll maybe have questions about it !

thanks again Rob !

Reply all
Reply to author
Forward
0 new messages