Hi All,

i've been googling for a while but with no success as to what is going on
here...

http://ch1mp.net/extrude/

i've tried the screenZOffset technique described in chapter 10 of away3d 3.6
essentials, i've looked though this...

http://savagelook.com/demos/text_demo/srcview/index.html

but that also has rendering problems when using TextField3D and
TextExtrusion. i also found this...

http://away3d.googlecode.com/svn-history/r2659/trunk/fp10/Examples/Away3D/as/src/Intermediate_TextExtrusion.as

which is doing something with SpriteRenderSession, i've found in the version
i'm using SpriteSession and applied this to my code but with no success.
well, it does appear to render the extrusion above everything else but
that's not fixing my problems with lighting and having a solid block from
dynamic text.

what's going on here? the only "face" of the solid text behaving as i'd
expect is the back (text2 in the source below). the front and the extrusion
don't react to the light as i'd expect and the extrusion renders over the
textField3D's at times to break the solid look.

here's the source... any help greatly appreciated, it's a fantastic feature
to be able to do this with dynamic text, what am i doing wrong?

package
{
 import away3d.containers.ObjectContainer3D;
import away3d.containers.Scene3D;
 import away3d.containers.View3D;
import away3d.extrusions.TextExtrusion;
import away3d.lights.PointLight3D;
 import away3d.materials.ShadingColorMaterial;
import away3d.primitives.TextField3D;
 import flash.display.Sprite;
import flash.events.Event;
import flash.text.Font;
 import wumedia.vector.VectorText;
 [Frame(factoryClass="Preloader")]
 public class Main extends Sprite
{
private var view:View3D;
 private var scene:Scene3D;
private var text:TextField3D;
private var text2:TextField3D;
 private var extrusion:TextExtrusion;
private var container:ObjectContainer3D;
 private var gothamBold:Font;
private var colourMat:ShadingColorMaterial;
 private var colourMat2:ShadingColorMaterial;
private var colourMat3:ShadingColorMaterial;
 private var light:PointLight3D;
 [Embed(source = "../lib/extrudedTextAssets.swf", mimeType =
"application/octet-stream")]
 private var FontBytes:Class;
 public function Main():void
 {
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
 }

private function init(e:Event = null):void
{
 removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
colourMat = new ShadingColorMaterial(0xCC0000);
 colourMat2 = new ShadingColorMaterial(0x00CC00);
colourMat3 = new ShadingColorMaterial(0x0000CC);
 VectorText.extractFont(new FontBytes());
view = new View3D( { x:150, y:150 } );
 text = new TextField3D("Gotham Bold");
text.text = "18";
 text.size = 127;
text.align = VectorText.CENTER;
text.bothsides = true;
 text.material = colourMat;
text.back = colourMat;
text2 = new TextField3D("Gotham Bold");
 text2.text = "18";
text2.size = 127;
text2.align = VectorText.CENTER;
 text2.z = 30;
text2.bothsides = true;
text2.material = colourMat2;
 text2.back = colourMat2;
extrusion = new TextExtrusion(text, {depth:30});
 extrusion.bothsides = true;
extrusion.material = colourMat3;
extrusion.back = colourMat3;
 container = new ObjectContainer3D();
container.addChild(text);
container.addChild(text2);
 container.addChild(extrusion);
container.z = 600;
scene = view.scene;
 scene.addChild(container);
light = new PointLight3D();
light.color = 0xFFFFFF;
 light.specular = 1;
light.diffuse = .5;
light.ambient = .5;
 scene.addLight(light);
addChild(view);
view.camera.z = 0;
 view.camera.lookAt(container.position);
addEventListener(Event.ENTER_FRAME, update);
 }
 private function update(e:Event):void
 {
container.rotationY = container.rotationY + 1 % 360;
view.render();
 }

}

}

Reply via email to