[Papervision3D] [Papervision3D ] OutlineMaterial: what now?

Bart Wttewaall mailinglists.wttewaall at gmail.com
Mon Dec 1 15:27:35 PST 2008


It looks like you just want a cartoony effect by drawing a big black line
around your mesh. Why not use useOwnContainer and then add a GlowFilter to
it's container with black and strength at 100?

2008/12/1 Boris Munser <boris at unvoll.com>

> I'm trying to create a new papervision material for my needs:
> OutlineMaterial (not only a silhouette).
> what I did:
> - added Boolean var "culledOnLastframe" to Vertex3D.as
> - duplicated and modified WireframeMaterial.as to OutlineMaterial.as
> modifications of OutlineMaterial:
> override public function drawTriangle(face3D:Triangle3D, graphics:Graphics,
> renderSessionData:RenderSessionData, altBitmap:BitmapData = null,
> altUV:Matrix = null):void
>  {
>  //linewidth based on face parent screenZ:........
>  distToCam = face3D.Instance.screenZ;
>  lineWidth = Math.min( Math.max(1000/distToCam, 1), 3);
>  graphics.lineStyle( lineWidth, lineColor, lineAlpha );
>
>  if( face3D.v0.culledOnLastframe && face3D.v1.culledOnLastframe )
>  {
> graphics.moveTo( face3D.v0.vertex3DInstance.x, face3D.v0.vertex3DInstance.y
> );
>   graphics.lineTo( face3D.v1.vertex3DInstance.x,
> face3D.v1.vertex3DInstance.y );
>
>  }
>  if( face3D.v1.culledOnLastframe && face3D.v2.culledOnLastframe )
>  {
>      graphics.moveTo( face3D.v1.vertex3DInstance.x,
> face3D.v1.vertex3DInstance.y );
>   graphics.lineTo( face3D.v2.vertex3DInstance.x,
> face3D.v2.vertex3DInstance.y );
>  }
>  if( face3D.v2.culledOnLastframe && face3D.v0.culledOnLastframe )
>  {
>   graphics.moveTo( face3D.v2.vertex3DInstance.x,
> face3D.v2.vertex3DInstance.y );
>   graphics.lineTo( face3D.v0.vertex3DInstance.x,
> face3D.v0.vertex3DInstance.y );
>  }
>  //renderSessionData.renderStatistics.triangles++;
>  graphics.moveTo( face3D.v0.vertex3DInstance.x,
> face3D.v0.vertex3DInstance.y );
>  graphics.lineStyle();
>
>  }
>
> - changed TriangleMash3D.as "project" function to set all vertices'
> culledOnLastframe.value to false before render
> - within modified TriangleMash3D.as, all faces' vertices are set to
> culledOnLastframe=true if culled;
>
> Result: http://unvoll.com/schrottplatz/outlineshaderwoes.jpg
>
> - what you see there is a compositeMaterial (bitmap+OutlineMaterial)...
> - what the material does: draw lines between everly vertex of a
> TriangleMesh3D which is part of a triangle that was culled during the last
> rendering process...
> - the problem is the BAD lines that are drawn when there is not enough
> geometry between opposite edges of the lowpoly mesh (a well-subdivided
> sphere would render fine because of a "notCulled" vertex avoiding the
> linedraw)
> - I'm trying to keep this cheap on calculations. (thinking of
> vertex.connectedFaces.dictionary..compare, diff vertex face.normals to
> camera normal.. ouch)
> - how can I "cull" the BAD lines?
> - am I missing something?
>
> I.m stuck,
> Boris
>
>
> -
>
>
>
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20081202/b8d76d39/attachment-0001.html>


More information about the Papervision3D mailing list