Updated Fire Sphere with Source

There have been a few requests for the the source to the Fire Sphere demo I posted forever ago. I’ve finally gotten around to cleaning up the code and getting it to work with the latest rev of PV3D.

Fire Sphere

Liquid Metal

The material applied to the sphere is created using a static PNG with a DisplacementMapFilter applied to it. The DisplacementMapFilter uses a BitmapData object that has had perlin noise applied to it to give the flame effect. A lot of other effects can be created this way as well. Things like rippling water or clouds. It’s just a matter of changing the original image and tweaking the settings of the filter and the noise.

You can get the source here. It’s really quite simple. The whole thing is under 200 lines of code.


14 Responses to “Updated Fire Sphere with Source”
  1. Mr.doob Says:

    Does the Perlin Noise makes it that slow? I just can’t take a look at the sources now :(

    Nice liquidMetal btw! :) reminds me to the end of this demo:

  2. xero / fontvir.us Says:

    you should do a tutorial on diffrent types and uses of perlin noise. thanx for the source!

  3. Paul Says:

    Yes, it likely is the perlin noise that makes it so processor intensive.

  4. Ryan [draw.logic] Says:

    Excellent love the metal tunnel. I hope you post more often as it is always top notch stuff. I am happy to see more material work by doob and on the pv3d list. It seems that away3d has been going hard on that but pv3d is not so much in that area such as the chrome ball and some material work posted lately on http://www.away3d.com/.

  5. 3D Fire Sphere with Source - Really Great « Flash Enabled - Get Ready With Flash… Says:

    [...] Read the original post and download source here. [...]

  6. Mike Duguid Says:

    Whnenever I use perlin noise effects, I tend to render them once to a seperate double sized bitmap which I then scroll and loop to use for displacement etc – this is a lot less processor intensive but has the down side of increased memory consumption and doesn’t of course randomly evolve, but for most effects is sufficient.

  7. [ draw.logic ] 3D Materials, Texturing and Mapping in AS3 and the Limits of Flash and Software Rendering « Says:

    [...] Recent work by actionscript architect [...]

  8. p Says:

    hi, great work. When I setup a fla in CS3 with your source I get this error:

    TypeError: Error #1007: Instantiation attempted on a non-constructor.
    at FireSphere/::configureTexture()
    at FireSphere$iinit()

    any pointers? ta p;)

  9. Paul Says:

    Hmm, no idea. Unfortunately I don’t have CS3 so it’s difficult for me to debug. Did you set the FireSphere class up as class that is associated with the root, the application class, or whatever it is called in CS3?

  10. Paul Says:

    Do you have an AS2 version of the fire sphere?

  11. Paul Says:

    I don’t have an AS2 version. But, the code is there if you’d like to port it.

  12. Drew Says:

    TypeError: Error #1007: Instantiation attempted on a non-constructor.
    at FireSphere/::configureTexture()
    at FireSphere$iinit()

    It is right here:

    public function FireSphere()


    i really don’t want this error to be. any ideas? i am lost

  13. Giles Says:

    I got the same error running the code in Flash CS3. It seems to be that CS3 objects to FireTexture being instantiated, e.g. it’s complaining that you’re trying to create an instance of a variable. Essentially, the method of creating a Class called ‘FireTexture’ based on the Embed meta-tag is invalid in Flash, but valid in Flex.

    For anyone that wants to solve this, import the PNG into the library of the FLA file, and set its class to FireTexture. Remove the [Embed(source="../fire.png")] statement and the FireTexture definition below it. Then replace the two opening lines of configureTexture() with:

    this.fireTexture = new FireTexture( 400, 200 );

    Thanks for the example Paul :)

  14. Marilyn Says:

    I’m just getting used to Flash CS4.
    Could someone show me the AS3 import code that goes in the .fla file for the Fire Sphere? I’ve been getting a series of syntax errors. I know the import code must be very simple, but it has eluded me.

    The Fire Sphere is absolutely wonderful!

Leave a Comment