> Cool! we wanna see!

I'll post the result as soon as I am happy with it ;)

> Because you are registered here, you have almost unlimited questions  
> account!
> In case you exceed this limit, we have a donate a beer btn to refill  
> your account :))

heheh, ok good. Watch out: here comes a couple of questions...
I'll send you a crate of beer, when I'm finished with the project :)

>
> On top of my head I would say
> Just do same calculation as now, but average neighbourg20 or 10  
> depending witch tri you render.

Ehmm... I'm afraid, I'm not sure if I get it...
Ok, I have those three normals in my code that are coming from the
neighbours, right?

norm1.rotate( tri.faceVO.face.parent.neighbour01
( tri.faceVO.face ).normal, t );
norm2.rotate( tri.faceVO.face.parent.neighbour12
( tri.faceVO.face ).normal, t );
norm3.rotate( tri.faceVO.face.parent.neighbour20
( tri.faceVO.face ).normal, t );

Now I should average neighbour20 or neighbour01, depending on the tri?
But avarege of what? And how do I know which tri is renderd?

> You render a bit like a quad face. You just have to test equal value  
> for the average 2 normals at vertexes at the shared side.

I have no clue how to get the "value for the average 2 normals at
vertexes at the same side"...
That's a bit to geek for me ;)

Could you explain that to me a bit more detailed? That would be great!

The function still looks like that:

override public function renderTriangle(tri : DrawTriangle) : void {
                        _session = tri.source.session;

                        function nscreen(_v0 : ScreenVertex, _v1 : 
ScreenVertex, _v2 :
ScreenVertex) : Number3D {
                                var d1x : Number = _v1.x - _v0.x;
                                var d1y : Number = _v1.y - _v0.y;
                                var d1z : Number = _v1.z - _v0.z;

                                var d2x : Number = _v2.x - _v0.x;
                                var d2y : Number = _v2.y - _v0.y;
                                var d2z : Number = _v2.z - _v0.z;

                                var pa : Number = d1y * d2z - d1z * d2y;
                                var pb : Number = d1z * d2x - d1x * d2z;
                                var pc : Number = d1x * d2y - d1y * d2x;

                                var pdd : Number = Math.sqrt( pa * pa + pb * pb 
+ pc * pc );
                                return new Number3D( pa / pdd, pb / pdd, pc / 
pdd );
                        }

                        var t : away3d.core.math.Matrix3D =
tri.view.cameraVarsStore.viewTransformDictionary[tri.source];

                        norm1.rotate( tri.faceVO.face.parent.neighbour01
( tri.faceVO.face ).normal, t );
                        norm2.rotate( tri.faceVO.face.parent.neighbour12
( tri.faceVO.face ).normal, t );
                        norm3.rotate( tri.faceVO.face.parent.neighbour20
( tri.faceVO.face ).normal, t );

                        _nn = nscreen( tri.v0, tri.v1, tri.v2 );
                        _nn.normalize( 1 );
                        _nn.rotate(tri.faceVO.face.normal, t);

                        eTri0.x = width * (     ( ( (_nn.x + norm1.x) * ox) * 
oy)       + off   );
                        eTri0.y = height* ( ( ( (_nn.y + norm1.y) * ox) * oy)   
+ off   );
                        eTri1.x = width * (     ( ( (_nn.x + norm2.x) * ox) * 
oy)       + off   );
                        eTri1.y = height* ( ( ( (_nn.y + norm2.y) * ox) * oy)   
+ off   );
                        eTri2.x = width * (     ( ( (_nn.x + norm3.x) * ox) * 
oy)       + off   );
                        eTri2.y = height* ( ( ( (_nn.y + norm3.y) * ox) * oy)   
+ off   );

                        var mat : Matrix = new Matrix( eTri1.x - eTri0.x, 
eTri1.y -
eTri0.y, eTri2.x - eTri0.x, eTri2.y - eTri0.y, eTri0.x, eTri0.y );
                        mat.invert( );

                        _session.renderTriangleBitmap( bitmap, mat, tri.v0, 
tri.v1, tri.v2,
smooth, false, _session.graphics );
                }

New hints are greatly appreciated!
cheers,
Spog






Reply via email to