Results 1 to 6 of 6

Thread: MetaCircles - simple entity demo

Threaded View

  1. #1
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,778
    Blog Entries
    3
    Rep Power
    691

    Lightbulb MetaCircles - simple entity demo

    Hi,

    as the Portal 2 game I played recently modelled liquids via isosurfaces, I could not wait to try to develop similar system.
    For the start I picked 2D case of primitives I call MetaCircles. On the internet you can find them referenced as MetaBalls, but as it is simple 2D shape, the Circle suits better I think.

    Very interesting article and source of inspiration and code can be read here:
    http://www.gamedev.net/page/resource...es-in-2d-r2556

    Below I attach sample code for 2D case. The download contains 3 files:
    • MetaCircle_Demo.tBasic - the main application
    • actor_MetaCircle.tBasicU - custom entity representing single meta circle, which can be instanced in any number of copies
    • animator_MetaCircleCollection.tBasicU - custom entity serving as high level container for meta circles, taking care of calculating the whole effect

    ThinBASIC 1.8.8.0 is required.

    I hope you will like it. It is quite computionally expensive, and many further optimizations could be done (feel free to try), but I wanted to keep the code easy to navigate.
    If it runs too slow on your machine, please tune parameter at line 41 in main code:
    MetaCircleCollection_SetGridStep(%sScene, %eMetaCircleCollection, 0.15)
    
    ... to any bigger number, such as 0.2 and so on

    I hope you will like it, it is quite hypnotic to watch.


    Petr
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	MetaCircles_Sample.png 
Views:	186 
Size:	29.7 KB 
ID:	7340  
    Attached Files Attached Files
    Last edited by Petr Schreiber; 13-07-2011 at 18:34.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •