Recent Updates Toggle Comment Threads | Keyboard Shortcuts

  • frankiezafe 19:45 on 2017-04-24 Permalink | Reply
    Tags: , , , ,   

    Long time no see, but polymorph engine development is back on track!

    The XML describing a polymorph’s project is now able to configure the Ogre’s compositor, understand the post-processing module.

    The first screenshot is using a custom compositor with this configuration:

    <workspace name="TuningScoreWS">
      <script group="General" workspace="CustomCompositor" />
        <color name="background_center" value="0,1,0" node="0" pass="1" index="4"/>
        <color name="background_border" value="1,0,0" node="0" pass="1" index="8"/>
        <variable name="centerx" value="0.5" node="0" pass="1" index="0"/>
        <variable name="centery" value="0.5" node="0" pass="1" index="1"/>
        <variable name="radius" value="0.9" node="0" pass="1" index="2"/>
        <variable name="ratio" value="1.777777778" node="0" pass="1" index="3"/>

    The required files for this compositor (shaders & nodes) can be found in the samples example.compositor.

    The second screenshot is using a default compositor, where only the background color can be modified.

    <workspace name="Default">
        <color name="background" value="1,0,0"/>

    The documentation about the XML is here:

  • frankiezafe 20:42 on 2017-04-17 Permalink | Reply
    Tags: , , , ,   

    To prepare the work session between Tomas Turine and Lisa Nelson, I prepared a OSC serialisation of all the objects available in the 3D world, including mouse and cameras, and built an interface in pd to visualise and use the data.

  • frankiezafe 11:57 on 2017-04-15 Permalink | Reply
    Tags: , , , ,   

    My website being back online, I will document the researches related to disrupted cities in several pages there.

    I’m currently working on an algorithm to nicely shrink the blocks detected in the network…

  • frankiezafe 14:31 on 2017-04-07 Permalink | Reply
    Tags: , , wiki,   

    Documentation about the XML format used to describe projects in the engine is available in the wiki. Please note that it might change in the upcoming month…

    Link in he wiki:

  • frankiezafe 19:18 on 2017-04-04 Permalink | Reply
    Tags: , ,   

    Today, certainly one of the less sexy thing i’ve ever posted…

    How to create a unique key out of two pointers in C++?

    After some investigation and a poor attempt to use boost uint128_t, i found my way using a char array.

    Here is the code:

    SomeClass* a = new SomeClass();
    SomeClass* b = new SomeClass();
    unique = new unsigned char[ 16 ]; // room for 64bits pointers
    uintptr_t ta = reinterpret_cast<uintptr_t>(a);
    uintptr_t tb = reinterpret_cast<uintptr_t>(b);
    for ( int i = 0; i < 8; ++i ) {
        unique[ i + 8 ] = ta;
        unique[ i ] = tb;
        ta = ta >> 8;
        tb = tb >> 8;
    cout << "chars: ";
    for ( int i = 0; i < 16; ++i ) {
        cout << uint16_t( unique[i] ) << " | ";
    cout << endl;
    uintptr_t newa = 
            unique[15] << 56 | 
            unique[14] << 48 | 
            unique[13] << 40 |
            unique[12] << 32 |
            unique[11] << 24 |
            unique[10] << 16 |
            unique[9] << 8 |
    uintptr_t newb = 
            unique[7] << 56 | 
            unique[6] << 48 | 
            unique[5] << 40 |
            unique[4] << 32 |
            unique[3] << 24 |
            unique[2] << 16 |
            unique[1] << 8 |
    cout << reinterpret_cast<uintptr_t>(a) << " <> " << newa << endl;
    cout << reinterpret_cast<uintptr_t>(b) << " <> " << newb << endl;
    cout << reinterpret_cast<RoadDot*>(newa) << " <> " << a << endl;
    cout << reinterpret_cast<RoadDot*>(newb) << " <> " << b << endl;

    And… done! The pointers are casted into the very useful uintptr_t as a unsigned int, stored in the array in 8 bits chunks. On 64 bits systems, pointers use 64bits… Therefore, the char array needs to have 16 slots ( 128 / 8 = 16 ).

    At the end of the code, the pointers are recreated from the characters and compared to the original values. In my terminal, here is what i saw:

    chars: 96 | 168 | 98 | 1 | 0 | 0 | 0 | 0 | 224 | 130 | 98 | 1 | 0 | 0 | 0 | 0 | 
    23233248 <> 23233248
    23242848 <> 23242848
    0x16282e0 <> 0x16282e0
    0x162a860 <> 0x162a860

    I’ll optimise this a bit, mainly by creating the char array based on the size of the uintptr_t * 2.

  • frankiezafe 16:33 on 2017-03-26 Permalink | Reply
    Tags: , code, ,   

    Finding the closest road on the right at a crossroad.

    To generate the bocks of building based on the roads structure, the method I’m building is based on a simple idea: when you arrives at a crossroad, you take the first street on the right and you go on like this until you reach a dead-end or your starting point. If you reach your starting point, the succession of roads you took defines a block of building. In theory. This technique has been suggested by Michel Cleempoel, on the way back from school.

    After a bit of preparation of the road network (removing orphan roads, having no connection with others, and dead-ends parts of the roads), the real problem arouse: how do you define right in a 3d environment, without an absolute ground reference. Indeed, I can configure the generator to use the Y axis (top axis in ogre3d) in addition to X & Z.

    At a crossroad, you may have several possibilities of roads. In the research, these possible roads are reduced to 3d vectors, all starting at world’s origin. The goal is to find the closest vector on the right of the current one, called the main 3d vector in the graphic above..

    The right is a complex idea, because it induces an idea of rotation. The closest on the right doesn’t mean the most perpendicular road on the right side. Let say I have 4 roads to choose from. Two going nearly in the opposite direction of the road i’m on, one perpendicular and one going straight on.

    If I compute the angles these roads have with the current one, results are:

    1. 5°,
    2. -5°,
    3. 90°,
    4. and 170°.

    The winner is not the 90°, but the 5° road! If I sort them, the last one must be the -5°, who is the first on the left.

    3d plane from a 3d vector

    The first thing to do is to define reference plane. To do so, you get the normal vector of the road by doing a cross product with the UP axis (Y axis in this case). The normal gives you a second vector, perpendicular to the road, and therefore defines a plane. Let’s call it VT plane, for Vector-Normal plane. For calculation, we need the vector perpendicular to this plane, rendered by crossing the road and its normal, let’s call it the tangent vector. Until here, it’s basic 3d geometry.

    projection of 3d vectors on a plane

    We can now project all the possible roads on the VT plane. These are the yellow vectors in the graphic. The math are clearly explained tmpearce on stackoverflow. Implemented in processing, it gives:

          float d = tangent );
          PVector projectedvector = new PVector();
          projectedvector.add( tangent );
          projectedvector.mult( d * -1 );
          projectedvector.add( othervector );

    We are nearly done!

    angle between 3d vectors

    The projected vectors will help the angle calculation. Indeed, the current vector and the projected ones being coplanar, they share the same normal. The way to get the angle between 2 coplanar vectors is described by Dr. Martin von Gagern, on stackoverflow, once again. See Plane embedded in 3D paragraph for the code i’ve used.

    And… tadaaammmm! The number rendered by the method is the angle i was searching for, displayed in degrees in the graphic above.

  • frankiezafe 18:12 on 2017-03-24 Permalink | Reply
    Tags: , Danse, ,   

    Ouverture Studio – atelier Lisa Nelson

    Le 24 mars 2017 à 18h30, les portes s’ouvriront sur l’atelier et les jeux, invitant le public à jouer de son attention et imagination.

    Plus d’info sur le site de charleroi-danse.

  • frankiezafe 18:58 on 2017-03-23 Permalink | Reply
    Tags: , , , gif, ,   

    Road network generation: the gif gives you an idea of the procedure executed in ~300 milliseconds by the c++.

    With a deformation:

  • xuv 18:52 on 2017-03-21 Permalink | Reply
    Tags: , ,,   

    Polymorph Engine is on 

    The Polymorph Engine is on, the go-to community website for sharing, rating and downloading indie games. It sits in the well-named “tools” section where it is already getting some attention.

    But we need your help to bring it further. So if you have an account, be sure to check the Polymorph Engine page, download the install script, give it a 5 stars ratings, or even add it to your favorites.

    While you are there, be also sure to check out and follow Frankie and xuv profiles and collections, you might discover some gems.

    Let us know about your profile in the comments. We’ll be sure to check it out.

  • frankiezafe 21:35 on 2017-03-19 Permalink | Reply
    Tags: , configuration, , network,   

    Different kind of network generated by 3 configurations (images go 2 by 2).

    Note: add a variation on the roads length (min, max will be ok).

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc