Java3D Alpha Problem

Hello,
I have a PositionInterpolator with an Alpha. I need to alter the Increasing- and/or Decreasing-Time of the Alpha-Object while the scene is running. When I do it, the value of my Alpha-Object alters nearly unpredictable... I mean, what's the philosophy of this Alpha-Obect? When eg the actual value of it is 0.5 and I know that it is increasing and now I alter the Increasing-Time to the double value of what it was before, my alpha value won't change to 0.25, as one might guess... so what's the philosophy???
Thanks for your help...
braveheart

Thank you for your post Alex,
though it's not quite the 'right answer' for that I searched but it gave me a good hint at where to search or what to try. So i have tested the alpha object with it's startTime and the actual time.
As far as I've found it goes this way: assuming that you have an alpha object with decreasing and increasing capability and the in- and decreasingTime is 1000ms. Now the alpha value is computed as follows: the actualTime of your system (System.currentTimeInMillis) less the startedTime of your alphaObject, the result mod-divided through your in- or decreasingTime, this in turn gives you the rest of your in- or decreasing movement.
Eg if in the above stated example the passedTime is 7300ms, then you are in the decreasing-mode and have still 700ms to go. Therefore the alphaValue will be 0.7. This at least is valid when you haven't set any in- or decreasingRampDuration... this makes the equation quite 'unpredictable'...
But I find this philosophy quite nonsensical... because it don't take into account the actual movement but computes the alphaValue from the start, as if it had moved through the passedTime with the new in/decreasingTime... which really isn't the case... so I think that your velocity assumption isn't quite the case here??
I must admit that the java3d functionality classes aren't really what you might expect from a java derived language. I don't think that I will ever again write a programm in java3d... it don't seem like real programming but having to fiddle with all kinds of inadequacies... well, again, thank you for your post...
dominik

Similar Messages

  • JFrames and Java3D simple problem

    Hi ive created a program using jframes in Java and im wanting to move it over to java 3d but im having problems. Ive litterally just looked at java 3d so my knowledge is limited. All i want is to set up my canvas so that i have a Jframe panel on the right and a 3d ball on the left. Here's my failed attempt......
    import com.sun.j3d.utils.geometry.*;
    import com.sun.j3d.utils.universe.*;
    import com.sun.j3d.utils.image.*;//imports image functions
    import javax.media.j3d.*;
    import javax.vecmath.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.awt.*;
    public class Prog extends JFrame
        private Canvas3D canvas;
        private SimpleUniverse universe = new SimpleUniverse();  // Create the universe      
        private BranchGroup group = new BranchGroup(); // Create a structure to contain objects
        private Bounds bounds;
        public Prog()
            super("Program");
            GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
            canvas = new Canvas3D(config);
            //getContentPane().setLayout( new BorderLayout( ) );
            //getContentPane().add(canvas, "Center");
            Container c = getContentPane();
            setSize(600,400);
            c.setLayout(new BorderLayout( ));
            JPanel leftPanel = new JPanel( );
            leftPanel.setBackground(Color.BLACK);
            c.add(leftPanel, BorderLayout.CENTER);
            c.setLayout(new BorderLayout( ));
            JPanel rightPanel = new JPanel( );
            rightPanel.setBackground(Color.GRAY);
            c.add(rightPanel, BorderLayout.EAST);
            JButton goButton = new JButton("  Go  ");
            goButton.setBackground(Color.RED);
            rightPanel.add(goButton);
         Light();//Creates A Light Source
           // Create a ball and add it to the group of objects
           Sphere sphere = new Sphere(0.5f);
           group.addChild(sphere);
           // look towards the ball
           universe.getViewingPlatform().setNominalViewingTransform();
           // add the group of objects to the Universe
           universe.addBranchGraph(group);
        public void Light()
            // Create a white light that shines for 100m from the origin
            Color3f light1Color = new Color3f(1.8f, 1.8f, 1.8f);
           BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
            Vector3f light1Direction = new Vector3f(4.0f, -7.0f, -12.0f);
           DirectionalLight light1 = new DirectionalLight(light1Color, light1Direction);
            light1.setInfluencingBounds(bounds);
           group.addChild(light1);
        public static void main(String[] args)
           Prog frame = new Prog();
         frame.setVisible(true);
    }It Compiles but the 3d ball and the Jframe gui are in different windows but i want them in the same window but i duno how ?

    Hi tesla66 I'm sorry if I didn't correct your code, but drop some new code trying to solve the problem. I've used the cube instead the sphere because it's easier to see is rotating but just change "new ColorCube(0.4f)" with " new Sphere( 0.4f )". I wrote even some coments tought they're helpful. Tell me if I solved the problem
    import java.awt.*;
    import javax.swing.*;
    import javax.media.j3d.*;
    import javax.vecmath.*;
    import com.sun.j3d.utils.universe.SimpleUniverse;
    import com.sun.j3d.utils.geometry.*;
    public class JFrameAndCanvas3D extends JFrame
         private Canvas3D canvas3D;
         public static void main(String[] args)
            new JFrameAndCanvas3D();
         public JFrameAndCanvas3D()
              initialize();
        public BranchGroup createSceneGraph()
            BranchGroup objRoot = new BranchGroup(); //root
            // Creates a bounds for lights and interpolator
            BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);
            //Ambient light
            Color3f ambientColour = new Color3f(0.2f, 0.2f, 0.2f);
            AmbientLight ambientLight = new AmbientLight(ambientColour);
            ambientLight.setInfluencingBounds(bounds);
            objRoot.addChild(ambientLight);
            ///Creates a group for transforms
            TransformGroup objMove = new TransformGroup();
            //You must set the capability bit to allow to write transform on the object
            objMove.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
            //Adds a color cube
            objMove.addChild(new ColorCube(0.4));
            //Creates a timer
            Alpha rotationAlpha = new Alpha(-1, //-1 = infinite loop
                                            4000 // rotation time in ms
            //creates a transform 3D based on Y axis roation
            Transform3D t3d = new Transform3D();
            t3d.rotY(Math.PI/2);
            //Creates an rotation interpolator with an alpha and a TransformGroup
            RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objMove);
            rotator.setTransformAxis(t3d);//setta l'asse di rotazione
            //sets a bounding region. withouth this scheduling bounds the interpolator won't work
            rotator.setSchedulingBounds(bounds);
            //add the interpolator to the group
            objMove.addChild(rotator);
            //Adding the group to the root
            objRoot.addChild(objMove);
            objRoot.compile();//improve the performance
            return objRoot;
        public void initialize()
            setSize(800, 600);
            setLayout(new BorderLayout());
            GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();//default config
            canvas3D = new Canvas3D(config);
            canvas3D.setSize(400, 600);
            add(canvas3D, BorderLayout.WEST); //adding the canvas to the west side of the JFrame
            SimpleUniverse simpleU = new SimpleUniverse( canvas3D );
            JPanel controlPanel = new JPanel();
            controlPanel.setLayout(new BorderLayout());
            controlPanel.setSize(400, 600);
            JLabel label = new JLabel();
            label.setText("I'm the control Panel");
            controlPanel.add(label, BorderLayout.CENTER);
            add(controlPanel, BorderLayout.EAST);
            //Positioning the view
            TransformGroup viewingPlatformGroup = simpleU.getViewingPlatform().getViewPlatformTransform();
            Transform3D t3d = new Transform3D();
            t3d.setTranslation(new Vector3f(0, 0, 3)); //moving back from the cube--> +z
            viewingPlatformGroup.setTransform(t3d);
            canvas3D.getView().setBackClipDistance(300.0d); //sets the visible distance
            canvas3D.getView().setFrontClipDistance(0.1d);
            canvas3D.getView().setMinimumFrameCycleTime(20); //minimum time refresh
            canvas3D.getView().setTransparencySortingPolicy(View.TRANSPARENCY_SORT_GEOMETRY); //rendering order
            BranchGroup scene = createSceneGraph();
            simpleU.addBranchGraph(scene);
            setVisible(true);
    }-->Davil

  • Intersecting Layers with alpha problem

    Hi,
    I have a problem with Motion when two layers intersect. On layer is totally opaque, and the second layer has transparent areas. The problem occurs in areas when the transparent areas intersect with opaque areas. In those regions I get a dark gray line appearing.
    Check out this image and you will see what I mean.
    http://jack.fxhome.com/MotionLine.jpg
    Note: I get this unwanted line in the exported frame as well.
    Why does motion do this?
    Is there anyway around this?
    Thanks

    1) Try setting your Render Quality to Best (under the View pop-up menu)
    2) Try changing the alpha interpretation of the layer with transparency - select it, press Shift-F, and try the different options in the Inspector's Media tab.

  • Java3d gaming problem *HELP*

    Hi all,
    I am a student completing my dissertation and need some help urgently.
    I have a game that has a main JPanel added to a JFrame and want to add another JPanel to the JFrame which I have done successful.
    The problem is the new JPanel, which is to load an object file, displays nothing.
    Can anyone give me pointers as what i need to do - do i need to have a canvas3d, or transformgroup or something?
    The idea i had in mind was to have this second Jpanel display the life of the user and link to the main JPanel so that if the user got hurt this secondpanel would update to show this.
    Thanks in advance,
    Catheren

    Catheren,
    This was taken from one of the Java 3D examples taken from the SDK. It is used to load an *.obj file. It uses the Canvas3D class.
    *     @(#)ObjLoad.java 1.22 02/10/21 13:46:12
    * Copyright (c) 1996-2002 Sun Microsystems, Inc. All Rights Reserved.
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    * - Redistributions of source code must retain the above copyright
    *   notice, this list of conditions and the following disclaimer.
    * - Redistribution in binary form must reproduce the above copyright
    *   notice, this list of conditions and the following disclaimer in
    *   the documentation and/or other materials provided with the
    *   distribution.
    * Neither the name of Sun Microsystems, Inc. or the names of
    * contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    * This software is provided "AS IS," without a warranty of any
    * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
    * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
    * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
    * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES
    * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
    * DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
    * OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
    * FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
    * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
    * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE,
    * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
    * You acknowledge that Software is not designed,licensed or intended
    * for use in the design, construction, operation or maintenance of
    * any nuclear facility.
    import com.sun.j3d.loaders.objectfile.ObjectFile;
    import com.sun.j3d.loaders.ParsingErrorException;
    import com.sun.j3d.loaders.IncorrectFormatException;
    import com.sun.j3d.loaders.Scene;
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import com.sun.j3d.utils.applet.MainFrame;
    import com.sun.j3d.utils.universe.*;
    import javax.media.j3d.*;
    import javax.vecmath.*;
    import java.io.*;
    import com.sun.j3d.utils.behaviors.vp.*;
    import java.net.URL;
    import java.net.MalformedURLException;
    public class ObjLoad extends Applet {
        private boolean spin = false;
        private boolean noTriangulate = false;
        private boolean noStripify = false;
        private double creaseAngle = 60.0;
        private URL filename = null;
        private SimpleUniverse u;
        private BoundingSphere bounds;
        public BranchGroup createSceneGraph() {
         // Create the root of the branch graph
         BranchGroup objRoot = new BranchGroup();
            // Create a Transformgroup to scale all objects so they
            // appear in the scene.
            TransformGroup objScale = new TransformGroup();
            Transform3D t3d = new Transform3D();
            t3d.setScale(0.7);
            objScale.setTransform(t3d);
            objRoot.addChild(objScale);
         // Create the transform group node and initialize it to the
         // identity.  Enable the TRANSFORM_WRITE capability so that
         // our behavior code can modify it at runtime.  Add it to the
         // root of the subgraph.
         TransformGroup objTrans = new TransformGroup();
         objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
         objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
         objScale.addChild(objTrans);
         int flags = ObjectFile.RESIZE;
         if (!noTriangulate) flags |= ObjectFile.TRIANGULATE;
         if (!noStripify) flags |= ObjectFile.STRIPIFY;
         ObjectFile f = new ObjectFile(flags,
           (float)(creaseAngle * Math.PI / 180.0));
         Scene s = null;
         try {
           s = f.load(filename);
         catch (FileNotFoundException e) {
           System.err.println(e);
           System.exit(1);
         catch (ParsingErrorException e) {
           System.err.println(e);
           System.exit(1);
         catch (IncorrectFormatException e) {
           System.err.println(e);
           System.exit(1);
         objTrans.addChild(s.getSceneGroup());
         bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
            if (spin) {
           Transform3D yAxis = new Transform3D();
           Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE,
                               0, 0,
                               4000, 0, 0,
                               0, 0, 0);
           RotationInterpolator rotator =
               new RotationInterpolator(rotationAlpha, objTrans, yAxis,
                               0.0f, (float) Math.PI*2.0f);
           rotator.setSchedulingBounds(bounds);
           objTrans.addChild(rotator);
            // Set up the background
            Color3f bgColor = new Color3f(0.05f, 0.05f, 0.5f);
            Background bgNode = new Background(bgColor);
            bgNode.setApplicationBounds(bounds);
            objRoot.addChild(bgNode);
         return objRoot;
        private void usage()
          System.out.println(
         "Usage: java ObjLoad [-s] [-n] [-t] [-c degrees] <.obj file>");
          System.out.println("  -s Spin (no user interaction)");
          System.out.println("  -n No triangulation");
          System.out.println("  -t No stripification");
          System.out.println(
         "  -c Set crease angle for normal generation (default is 60 without");
          System.out.println(
         "     smoothing group info, otherwise 180 within smoothing groups)");
          System.exit(0);
        } // End of usage
        public void init() {
         if (filename == null) {
                // Applet
                try {
                    URL path = getCodeBase();
                    filename = new URL(path.toString() + "./galleon.obj");
                catch (MalformedURLException e) {
               System.err.println(e);
               System.exit(1);
         setLayout(new BorderLayout());
            GraphicsConfiguration config =
               SimpleUniverse.getPreferredConfiguration();
            Canvas3D c = new Canvas3D(config);
         add("Center", c);
         // Create a simple scene and attach it to the virtual universe
         BranchGroup scene = createSceneGraph();
         u = new SimpleUniverse(c);
         // add mouse behaviors to the ViewingPlatform
         ViewingPlatform viewingPlatform = u.getViewingPlatform();
         PlatformGeometry pg = new PlatformGeometry();
         // Set up the ambient light
         Color3f ambientColor = new Color3f(0.1f, 0.1f, 0.1f);
         AmbientLight ambientLightNode = new AmbientLight(ambientColor);
         ambientLightNode.setInfluencingBounds(bounds);
         pg.addChild(ambientLightNode);
         // Set up the directional lights
         Color3f light1Color = new Color3f(1.0f, 1.0f, 0.9f);
         Vector3f light1Direction  = new Vector3f(1.0f, 1.0f, 1.0f);
         Color3f light2Color = new Color3f(1.0f, 1.0f, 1.0f);
         Vector3f light2Direction  = new Vector3f(-1.0f, -1.0f, -1.0f);
         DirectionalLight light1
             = new DirectionalLight(light1Color, light1Direction);
         light1.setInfluencingBounds(bounds);
         pg.addChild(light1);
         DirectionalLight light2
             = new DirectionalLight(light2Color, light2Direction);
         light2.setInfluencingBounds(bounds);
         pg.addChild(light2);
         viewingPlatform.setPlatformGeometry( pg );
         // This will move the ViewPlatform back a bit so the
         // objects in the scene can be viewed.
         viewingPlatform.setNominalViewingTransform();
         if (!spin) {
                OrbitBehavior orbit = new OrbitBehavior(c,
                                      OrbitBehavior.REVERSE_ALL);
                BoundingSphere bounds =
                    new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);
                orbit.setSchedulingBounds(bounds);
                viewingPlatform.setViewPlatformBehavior(orbit);        
         u.addBranchGraph(scene);
        // Caled if running as a program
        public ObjLoad(String[] args) {
          if (args.length != 0) {
         for (int i = 0 ; i < args.length ; i++) {
           if (args.startsWith("-")) {
         if (args[i].equals("-s")) {
         spin = true;
         } else if (args[i].equals("-n")) {
         noTriangulate = true;
         } else if (args[i].equals("-t")) {
         noStripify = true;
         } else if (args[i].equals("-c")) {
         if (i < args.length - 1) {
              creaseAngle = (new Double(args[++i])).doubleValue();
         } else usage();
         } else {
         usage();
         } else {
         try {
         if ((args[i].indexOf("file:") == 0) ||
              (args[i].indexOf("http") == 0)) {
              filename = new URL(args[i]);
         else if (args[i].charAt(0) != '/') {
              filename = new URL("file:./" + args[i]);
         else {
              filename = new URL("file:" + args[i]);
         catch (MalformedURLException e) {
         System.err.println(e);
         System.exit(1);
    // Running as an applet
    public ObjLoad() {
    public void destroy() {
         u.cleanup();
    // The following allows ObjLoad to be run as an application
    // as well as an applet
    public static void main(String[] args) {
    new MainFrame(new ObjLoad(args), 700, 700);

  • Java3D Install Problem

    I've been using java3d for about 6 months and need to install it on another machine, but can't get it installed correctly. I've installed the sdk 1.4.1_05 correctly and then installed j3d 1.3.1. When I try and run HelloUniverse from either the command prompt or as an applet through IE6 I get this error:
    *** ERROR: Canvas3D constructed with a null GraphicsConfiguration
    *** This will cause a NullPointerException in a subsequent release
    java.lang.NullPointerException: Canvas3D: null GraphicsConfiguration
         at javax.media.j3d.Canvas3D.<init>(Canvas3D.java:1100)
         at javax.media.j3d.Canvas3D.<init>(Canvas3D.java:1065)
         at HelloUniverse.init(HelloUniverse.java:97)
         at sun.applet.AppletPanel.run(AppletPanel.java:348)
         at java.lang.Thread.run(Thread.java:536)
    Can anyone help me? Is java3d installed incorrectly or is this something else wrong?

    I don't know about this particular error, but I have had failiures installing Java 3D on older machines with older 3D cards. Both openGL and DirectX.
    Maybe your OS is the problem... You in Linux? Windows? Solaris?

  • Java3D installation problem

    Downloaded java3d-1_2_1_01-win32-directx-sdk.exe
    InstallAnywhere didn't show me the JVM selection screen and it didn't install anything.
    The registry has the JavaSoft SDK 1.3 & runtime 1.3 entries.
    I am running Windows ME with DirectX 8.0
    Any idea ?

    OK, Looks like this is a known problem with Java3D, JDK 1.3.1 and WinME. http://www.j3d.org/installing.html
    Is there a vanilla zip file available ? Maybe I can simply install the jar to the right place bypassing installAnywhere (but here) ?

  • Freeze frame with Alpha problem.

    I have exported a 3 second graphic with alpha channel from After Effects.
    It keys perfectly until I drop on a freeze frame to lengthen it.
    There is a luminance drop of about 5% between the AE clip and the freeze
    of that clip. The freeze still maintains the alpha but you can see the change in luminance as soon as you apply the freeze to the clip.
    I have trashed prefs already but to no avail.
    Working in 8 bit uncompressed with a AJA Kona LHe card
    Any ideas how to rectify this??

    OK, here is the solution. Working in 8 bit, my video processing
    was selected to be 'Render in 8 bit YUV' which seems sensible.
    The problem with the freeze frames disappears when I select
    'Render all YUV material in high precision YUV'
    So now we know!! Thanks for the help and advice.

  • Pre multiplied alpha problem

    Hello,
    I am making a drawing app. In it I am using a feathered brush ( ie a gradient with 0 alpha on edges). I copypixel from this brush bitmap to my canvas on every mouse move. Problem with this is that color on the edges is different than that on the center. I read on internet that it is because flash uses pre-multiplied alpha in bitmapdata.
    Is there a way to solve this problem. Can I turn off the pre-multiplexing of alpha with base color? Please help
    Thanks

    No that is not the problem. Problem is not about alpha getting darker, Its that when flash pre multiply alpha with RGB it changes the value of RGB, it changes the orignal color hence making a great data loss.
    for example
    var map:BitmapData = new BitmapData(1,1,true,0xffffffff);
    map.setPixel32(0,0,0x00ffffff); // RGBA(255, 255, 255, 0);
    trace( map.getPixel32(0,0).toString(16)) // traces 0x00000000
    map.setPixel32(0,0,0x20fcfcfc);
    trace( map.getPixel32(0,0).toString(16)) // traces 0x20ffffff
    When I draw a yellow gradient circle on bitmapdata with 0 alpha outside and then copypixels of that bitmapdata to other bitmapdata the edges become green, because flash had pre multipled the yellow with alpha and change its orignal RGB
    values.
    you can see result here
    Edit: Take color values like this:
    1) A yellow that is slightly towards green like: 0xf5ff00 then it will round it to green
    2) A yellow that is slightly towards red like: 0xffec00 then it will round it to red.
    3) A perfect yellow 0xFFFF00 then it wont round it to anything and you will get the desired result

  • Sound Blaster Tactic3d alpha problems

    Hi, i have some problems with installing Sound Blaster Tactic3d alpha drivers.
    First is that i don't have pannel after installing drivers and second one is that my microphone is muted. Can someone help me ?
    *EDIT*
    Problems fixed (downloaded and installed this : http://www.userdrivers.com/Sound-Card/Creative-Sound-Blaster-Tactic3D-Alpha-Pack--0-000-for-Windo... ), but now control pannel is freezing on pop up.

    Hi,
    This could be caused by residual files from previous installation. It would advisable to uninstall and reinstall the package with a clean boot of your system. This article may help.

  • Bitmap Alpha Problem

    Hi;
    I'm trying to tweak a script I found online to work for my application.  The problem I am having is to make a certain part of the bitmap that is  created by code transparent...but only a certain part of it. The code  has the following:
    _fire = new BitmapData(865, 92, false, 0xffffff);
    Note
    the alpha flag must be set to false, which is the source of my problem,
    or nothing prints to screen at all. I need to make certain pixels
    transparent. _fire is added to the stage and then called thus:
    _fire.paletteMap(_grey, _grey.rect, ZERO_POINT, _redArray, _greenArray, _blueArray, _alphaArray);
    at the end of the script. The colors for the arrays are created thusly:
    private function _createPalette(idx:int):void {
    _redArray = [];
    _greenArray = [];
    _blueArray = [];
    _alphaArray = [];
    for (var i:int = 0; i < 256; i++) {
    var gp:int = new int();
    gp = _fireColor.getPixel(i, 0);
    if (gp < 1050112)
    _redArray.push(255);
    _alphaArray.push(255);
    } else {
    _redArray.push(gp);
    _alphaArray.push(0);
    _greenArray.push(0);
    _blueArray.push(0);
    I
    added that if clause to capture when the color is black because that's
    where I need to make it transparent. The problem is that where I need it
    to be transparent, it's blue (why blue I don't know). Is there any way
    to make it transparent? The entire code follows.
    TIA,
    George
    package {
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.BlendMode;
    import flash.display.DisplayObject;
    import flash.display.Loader;
    import flash.display.LoaderInfo;
    import flash.display.Sprite;
    import flash.display.StageQuality;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.filters.ColorMatrixFilter;
    import flash.filters.ConvolutionFilter;
    import flash.geom.ColorTransform;
    import flash.geom.Point;
    import flash.system.LoaderContext;
    import flash.net.SharedObject;
    import flash.net.URLRequest;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    [SWF(width=465, height=92, backgroundColor=0xffffff, frameRate=30)]
    public class Fire extends Sprite {
    private static const ZERO_POINT:Point = new Point();
    private var _fireColor:BitmapData;
    private var _currentFireColor:int;
    private var _canvas:Sprite;
    private var _grey:BitmapData;
    private var _spread:ConvolutionFilter;
    private var _cooling:BitmapData;
    private var _color:ColorMatrixFilter;
    private var _offset:Array;
    private var _fire:BitmapData;
    private var _redArray:Array;
    private var _zeroArray:Array;
    private var _greenArray:Array;
    private var _blueArray:Array;
    private var _alphaArray:Array;
    public function Fire() {
    //            stage.scaleMode = StageScaleMode.NO_SCALE;
    //            stage.quality = StageQuality.LOW;
    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.CO  MPLETE, _onLoaded);
    loader.load(new URLRequest('images/fire-color.png'), new LoaderContext(true));
    private function _onLoaded(e:Event):void {
    _fireColor = Bitmap(LoaderInfo(e.target).loader.content).bitmap  Data;
    _canvas = new Sprite();
    _canvas.graphics.beginFill(0xffffff, 0);
    _canvas.graphics.drawRect(0, 0, 865, 465);
    _canvas.graphics.endFill();
    _canvas.addChild(_createEmitter());
    _grey = new BitmapData(865, 465, false, 0xffffff);
    _spread = new ConvolutionFilter(3, 3, [0, 1, 0,  1, 1, 1,  0, 1, 0], 5);
    _cooling = new BitmapData(865, 465, false, 0xffffff);
    _offset = [new Point(), new Point()];
    _fire = new BitmapData(865, 92, false, 0xffffff);
    addChild(new Bitmap(_fire));
    _createCooling(0.16);
    _createPalette(_currentFireColor = 0);
    addEventListener(Event.ENTER_FRAME, _update);
    //            stage.addEventListener(MouseEvent.CLICK, _onClick);
    private function _onClick(e:MouseEvent):void {
    if (++_currentFireColor == int(_fireColor.height / 32)) {
    _currentFireColor = 0;
    _createPalette(_currentFireColor);
    private function _createEmitter()isplayObject {
    var tf:TextField = new TextField();
    tf.selectable = false;
    tf.autoSize = TextFieldAutoSize.LEFT;
    tf.defaultTextFormat = new TextFormat('Verdana', 80, 0xffffff, true);
    tf.text = '__________________________________________';
    tf.x = (465 - tf.width) / 2;
    tf.y = 0;
    //            tf.y = (465 - tf.height) / 2;
    return tf;
    private function _createCooling(a:Number):void {
    _color = new ColorMatrixFilter([
    a, 0, 0, 0, 0,
    0, a, 0, 0, 0,
    0, 0, a, 0, 0,
    0, 0, 0, 1, 0
    private function _createPalette(idx:int):void {
    _redArray = [];
    _greenArray = [];
    _blueArray = [];
    _alphaArray = [];
    for (var i:int = 0; i < 256; i++) {
    var gp:int = new int();
    gp = _fireColor.getPixel(i, 0);
    if (gp < 1050112)
    _redArray.push(255);
    _alphaArray.push(255);
    _greenArray.push(255);
    _blueArray.push(255);
    } else {
    _redArray.push(gp);
    _alphaArray.push(0);
    _greenArray.push(0);
    _blueArray.push(0);
    private function _update(e:Event):void {
    _grey.draw(_canvas);
    _grey.applyFilter(_grey, _grey.rect, ZERO_POINT, _spread);
    _cooling.perlinNoise(50, 50, 2, 982374, false, false, 0, true, _offset);
    _offset[0].x += 2.0;
    _offset[1].y += 2.0;
    _cooling.applyFilter(_cooling, _cooling.rect, ZERO_POINT, _color);
    _grey.draw(_cooling, null, null, BlendMode.SUBTRACT);
    _grey.scroll(0, -3);
    _fire.paletteMap(_grey, _grey.rect, ZERO_POINT, _redArray, _greenArray, _blueArray, _alphaArray);

    I am importing it into another *.as file:
        import Fire;
           var myFire:Fire = new Fire();
               addChild(myFire);
    TIA,
    beno

  • JAVA3D rotation problem

    I'm using JAVA3D that creates a map. The map is split into 4 parts. I forced each part to rotate only around the X-axis and this is done with the user clicking on it with the mouse. I want to limit the rotation where the user can rotate up to 90 degrees only downwards, and want to eliminate the option of rotation upwards. Is that possible.
    Another question is that when the user rotates one of the parts, the part comes out towards the user. Is it possible i can stop that and make it rotate on itself?
    Thanks in advance

    well my dear friend sorry to disappoint you but i did understand and that's the way rotX/Y/Z work within the Transform3D.
    the behavior you desire by the rotation is based on a cylindric coordinate system in which the point of view will move on the cylinder while the upVector of the lookAt method stay at the Y axis(Y axis is "up" in Java3D).
    since the Transform3d is based on spherical coordinate system you can't use it.
    the only way i know is to write an object as the Transform3d but much simpler, well lets see:
    class Transform extends Transform3D {
       Point3d position=new Point3d();
       Point3d lookingAt=new Point3d(1,0,0); // looking at the x axis
       Vector3d upVector=new Vector3d(0,1,0); // y is up
       double totalAngleXZ=0; // its a must to add the angle and to calculate it from the top since it creates a bug later on
       double totalAngleY=0; // its a must to add the angle and to calculate it from the top since it creates a bug later on
       public void rotXZ(double angle) {
          totalAngleXZ+= angle;
          lookAt();
       public void rotY(double angle) {
          totalAngleY+= angle;
          lookAt();
       private void lookAt() {
            lookingAt.set(Math.cos(totalAngleXZ),Math.cos(totalAngleY),Math.sin(totalAngleXZ));
            lookAt(position,lookingAt,upVector);
    }now if i'm not mistaken this should work...
    best of luck.

  • Alpha problem in Flash

    I lately generated a single color wireframe graphic in
    Illustrator, and saved this as .png format, set the background as
    transparent, I imported it into Flash library as graphic symbol,
    and drag it onto the stage, but the alpha channel was completely
    disable, I couldn't apply transparency onto the wireframe object, I
    wonder why?

    I haven't seen this come up before, but usually this forum deals with end user issues.  I'd recommend hoping over to bugbase.adobe.com and entering a bug.  We'll take a look and let you know what we find.
    Thanks,
    Chris

  • Java3D game problem(about wall)?(urgent " )

    I am developing a 3D shoot game which contain a 3D mase,but...why the wall is transparent when I run towards the wall??how can solve this problem??
    Moreover,I wonder how to run smoothiy in 3D game??

    yep..I see through to the other side(only left-side and right-side wall )..
    Anyway I want to run on the plane smoothly and dont want to see inside and behind the wall..
    following is the suitation of my game:
    | * | | | * * |
    | * | / | * * |
    | * | / | * * |
    | *| / \ * * |
    | *| / \ * * |
    | * \~ \ \ * * |
    |*__________\__\________\ * * |
    * is transparent

  • Java3D Picking Problem

    Hi, I have problem with picking. I have two shapes 3D (for example) and if there are separately (not hidden) picking is OK. But when I rotate them using myMouseRotate or rotation.rotY(angle) so one of them is hiden, it's always pick me only one of them, even it's hidden. I use pickClosest() method. What's wrong?
    Please help me
    pozdrawiam
    Wojtek

    It doesn't work because I need to pick one of this shape. I think that it's something with rotation... Check this simply full code below. Press any key to rotate. At the begining you pick ColorCube and it' ok. But if you rotate 180 degrees you will pick ColorCube again and it's wrong. Additionally if you change "angle = 3.14/2;" to "angle = 3*3.14/2;" you can pick Sphere but can't pick ColorCube.
    How can I solve it?? Maybe when I rotate something is change with direction of pick rays.
    Code - Pick_1.java:
    import com.sun.j3d.utils.picking.*;
    import com.sun.j3d.utils.universe.SimpleUniverse;
    import com.sun.j3d.utils.geometry.*;
    import javax.media.j3d.*;
    import javax.vecmath.*;
    import java.awt.event.*;
    import java.awt.*;
    import com.sun.j3d.utils.behaviors.mouse.*;
    import java.util.Enumeration;
    public class Pick_1 extends MouseAdapter {
         private PickCanvas pickCanvas;
         static double angle = 0.0;
         public class SimpleBehavior extends Behavior{
         private TransformGroup targetTG;
         private Transform3D rotation = new Transform3D();
         // private double angle = 0.0;
         // create SimpleBehavior
         SimpleBehavior(TransformGroup targetTG){
         this.targetTG = targetTG;
         // initialize the Behavior
         // set initial wakeup condition
         // called when behavior beacomes live
         public void initialize(){
         // set initial wakeup condition
         this.wakeupOn(new WakeupOnAWTEvent(KeyEvent.KEY_PRESSED));
         // behave
         // called by Java 3D when appropriate stimulus occures
         public void processStimulus(Enumeration criteria){
         // decode event
         // do what is necessary
         angle += 0.1;
         rotation.rotY(angle);
         targetTG.setTransform(rotation);
         //rotation.set(new Vector3f(-0.1f, 0.0f, 0.0f));
         //targetTG.setTransform(rotation);
         this.wakeupOn(new WakeupOnAWTEvent(KeyEvent.KEY_PRESSED));
         public Pick_1()
         Frame frame = new Frame("Box and Sphere");
         GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
         Canvas3D canvas = new Canvas3D(config);
         canvas.setSize(400, 400);
         SimpleUniverse universe = new SimpleUniverse(canvas);
         BranchGroup group = new BranchGroup();
              TransformGroup objTransform = new TransformGroup();     
         objTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
         objTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
         group.addChild(objTransform);     
         /*      MouseRotate myMouseRotate = new MouseRotate();
         myMouseRotate.setTransformGroup(objTransform);
         myMouseRotate.setSchedulingBounds(new BoundingSphere());
         group.addChild(myMouseRotate);
         MouseTranslate myMouseTranslate = new MouseTranslate();
         myMouseTranslate.setTransformGroup(objTransform);
         myMouseTranslate.setSchedulingBounds(new BoundingSphere());
         group.addChild(myMouseTranslate);
         MouseZoom myMouseZoom = new MouseZoom();
         myMouseZoom.setTransformGroup(objTransform);
         myMouseZoom.setSchedulingBounds(new BoundingSphere());
         group.addChild(myMouseZoom);
         SimpleBehavior myRotationBehavior = new SimpleBehavior(objTransform);
         myRotationBehavior.setSchedulingBounds(new BoundingSphere());
              group.addChild(myRotationBehavior);
         //create a sphere
         Vector3f vector2 = new Vector3f(0.6f, 0.0f, 0.0f);
         Transform3D transform2 = new Transform3D();
         transform2.setTranslation(vector2);
         TransformGroup transformGroup2 = new TransformGroup(transform2);
         Appearance appearance = new Appearance();
         appearance.setPolygonAttributes(
         new PolygonAttributes(PolygonAttributes.POLYGON_LINE,
         PolygonAttributes.CULL_BACK,0.0f));
         Sphere sphere = new Sphere(0.1f,appearance);
         transformGroup2.addChild(sphere);
         objTransform.addChild(transformGroup2);
         // create a color cube
         Vector3f vector = new Vector3f(0.3f, 0.0f, 0.0f);
         Transform3D transform = new Transform3D();
         transform.setTranslation(vector);
         TransformGroup transformGroup = new TransformGroup(transform);
         ColorCube cube = new ColorCube(0.1);
         transformGroup.addChild(cube);
         objTransform.addChild(transformGroup);
         //dodatkowo przesuniecie od razu o 90 stopni
              Transform3D obrot = new Transform3D();
                   angle = 3.14/2;
              obrot.rotY(angle);                                   //!!!!! takie przesuniecie dobrze dziala
         objTransform.setTransform(obrot);                //WIEC O CO CHODZI!!!!!!!!!!!!!!!
         universe.getViewingPlatform().setNominalViewingTransform();
         universe.addBranchGraph(group);
         frame.addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent winEvent) {
         System.exit(0);
         frame.add(canvas);
         pickCanvas = new PickCanvas(canvas, group);
         pickCanvas.setMode(PickCanvas.BOUNDS);
         canvas.addMouseListener(this);
         frame.pack();
         frame.show();
         public static void main( String[] args ) {
         new Pick_1();
         public void mouseClicked(MouseEvent e)
         pickCanvas.setShapeLocation(e);
         PickResult result = pickCanvas.pickClosest();
         if (result == null) {
         System.out.println("Nothing picked");
         } else {
         Primitive p = (Primitive)result.getNode(PickResult.PRIMITIVE);
         Shape3D s = (Shape3D)result.getNode(PickResult.SHAPE3D);
         if (p != null) {
         System.out.println(p.getClass().getName());
         } else if (s != null) {
         System.out.println(s.getClass().getName());
         } else{
         System.out.println("null");
         /*pickCanvas.setShapeLocation(e);
         PickResult result = pickCanvas.pickClosest();
         if (result == null) {
         System.out.println("Nothing picked");
         } else {
         // PickIntersection pi = result.getClosestIntersection(
         pickCanvas.getStartPosition();
         Shape3D s = (Shape3D)result.getNode(PickResult.SHAPE3D);
         System.out.println(s.getClass().getName());
    } // end of class Pick

  • DisplayObject.alpha problem on MouseEvent

    Hello,
    I have a button (VehiclesButton) which on rollover I want it to trigger a mouse event so an image(VehiclesCentral) to the side of it (I've just set the alpha to 0 so its invisble, but its on the stage) will have its alpha increased to 100 and become visible
    VehiclesButton.addEventListener(MouseEvent.MOUSE_OVER,test);
    function  test(e:MouseEvent):void
    VehiclesCentral.DisplayObject.alpha = 100 ();
    When I publish this though I get no compiler errors, only an error when I actually go onto it and rollover the button. I get the following error message:
    TypeError: Error #1006: value is not a function.
    at QualityPortal_fla::MainTimeline/test()
    (Quality Protal_fla is the file name I am working on).
    Thanks
    Sean

    Try:
    VehiclesButton.addEventListener(MouseEvent.MOUSE_OVER,test);
    function  test(e:MouseEvent):void
         VehiclesCentral.alpha = 1;

Maybe you are looking for

  • Apple TV connection.

    I have a relatively new Yamaha receiver with surround sound to which a blueray and a DVR are connected to . All feeds to a Panasonic plasma. The connection instructions say to connect Apple TV to the TV via HDMI. My tv doesn't have an HDMI connection

  • Coodinating Colors in Multi-Camera Shoots

    I sometimes use three video cameras on a shoot: a Canon 5D II, 5D III and Sony HXR NX5U.  I white balance each camera at the exact same spot and same lighting conditions immediately before the shoot.  The video clips that are subsequently produced do

  • Class methods, (sqlite)

    Hey, I'm working on a sqlite database application and I need to declare class variables (or something similar) to use within a class method. what i'm trying to do is compile and run some sql queries throughout my app. Now all the instance methods I c

  • Alternate to Apple Brand Power Supply?

    So I've run through two power supplies (both broken where it connects with the computer) and I'd really rather not buy another apple brand supply. I understand the strange outside ring is only for the color on the charger so it's probably and any ada

  • Problems with using Canon LiDE 210 and OSX 10.7.4

    I am getting nowhere with installing the Canon LiDE 210 scanner software on my 2010 MBP. All I get when I try to scan is "insufficient memory". I can scan using Image Capture and with the trial VueScan software so the problem looks as if it is someth