Catégorie : News

  • Equirectangular to cubemap bash script

    I was working on another try to use blend4web for a personal application, and I remembered that if you want to use an environment map it has to be a Blender specific 2 rows cubemap ( 2*3 cubes faces).

    blender cubemap
    Blender cubemap

    I’ve found ways to make it with gimp, after using Bruno Postle’s panotools script ( erect2cubic Erect2cubic ), or directly inside Blender (link 1: Blendswap cubemap maker , from : cubemap making inside blender).




    But all those ways needed to treat each panos one after the other; too long when you have to transform 20 panoramas…
    So I wrote a little bash script to transform equirectangular panoramas initially to those specific cubemaps, then I extended it to match further types of cubemaps ( it seems that unity uses cross styled cubemaps ).

    #!/bin/sh
    # 2016 11 03 sh script
    # This script aim to transform an equirectangular pano to a cubemap image used for environment mapping
    # it uses : Hugin, Bruno Postle's panotools scripts (perl) ,imagemagick's "convert" and montage command line tools and zenity for gui.
    # Find it useful ? Any bugs, ideas?, mail me at : mail@fabkzo.com
    # Author: FabKzo www.fabkzo.com
    
    pano=0
    order=0
    front=cube0000.tif
    right=cube0001.tif
    back=cube0002.tif
    left=cube0003.tif
    up=cube0004.tif
    down=cube0005.tif
    
    createPano (){
                        #create pto file
                        erect2cubic --erect=$pano --ptofile=cube.pto;
        
                        #create each cube faces
                        nona -o cube cube.pto;
                        imgsize=$(identify -format %h cube0000.tif);
                        echo $imgsize;
                        }
    blendercubeMap (){
                        convert $left $back $right +append cubeUp.tif;
                        convert $down $up $front +append cubeDown.tif;
                        convert cubeUp.tif cubeDown.tif -append toTo.tif;
    }
    
    horizontalcross (){
                        montage null: $up null: null: $left $front $right $back null: $down null: null: -geometry $imgsize -background none -tile 4x3 toTo.tif;
    }
    
    verticalcross (){
                        convert -rotate 180 $back $back 
                        montage null: $up null: $left $front $right null: $down null: null: $back null: -geometry $imgsize -background none -tile 3x4 toTo.tif;
    }
    
    horizontalline (){
                        convert $right $left $up $down $front $back +append toTo.tif;
    }
    
    verticalline (){
                        convert $right $left $up $down $front $back -append toTo.tif;
    }
                        
    finalsize=` zenity --entry --title="Enter Cubemap final height in px" --text="height" --entry-text="4096" `
    final=` zenity --list --radiolist --title="3D software cubemap type" --column="Choice" --column="Cubemap"\
                            TRUE "Blender" \
                            FALSE "horizontal-cross" \
                            FALSE "vertical-cross" \
                            FALSE "horizontal-line"\
                            FALSE "vertical-line"`
    
                    case $final in
                            "Blender")
                            order="blendercubeMap";;
                            "horizontal-cross")
                            order="horizontalcross";;
                            "vertical-cross")
                            order="verticalcross";;
                            "horizontal-line")
                            order="horizontalline";;
                            "vertical-line")
                            order="verticalline";;
                            
                            *)
                        esac
    
    while [ $# -gt 0 ]; do
        pano=$1
        echo $pano
        echo "createPano"
        
        createPano
        
        
        #takes each face to create the final image
        $order
        
        convert -resize x$finalsize toTo.tif ${pano%.*}-cubemap.png
        
        rm cubeUp.tif cubeDown.tif toTo.tif cube????.tif cube.pto
        
        shift
        done
        zenity --info --text="DONE"

     

    Pass it your panos, then it should result in a lot of .PNG cubemaps ready to use to create game assets inside blend4web or blender game engine ( first option ):

    examples :

    Equirectangular pano example
    Equirectangular pano example
    Blender cubemap
    Cubemap horizontal cross Blender cubemap
    cubemap vertical cross
    cubemap vertical cross

     

     

    cubemap horizontal line
    cubemap horizontal line




    Feel free to use those examples and tell me back if I’ve done an error on the other outputs or if you encounter problems to use it . Linux only . Enjoy it , share it .

  • Compositing with equirectangular panos : (1)

    Compositing with equirectangular panos : (1)

    First, considering the 2/1 equirectangular projection with Tissot’s indicatrix, we can see that the more the apparent vertical angle, the more the deformation :

    equirectangular projection
    Fabkzo’s equirectangular study

    (suite…)

  • Compositing with 360° to make stylized flat printable panos (intro )

    Now that 360° photography is a relatively common practice, and after seeing thousands of them in virtual tours, google street view, social networks etc etc , I can establish that there are 3 types of use, all implying different shoot processing:
    (suite…)

  • Example of 360° 4k video with 3d integration

    I’m able today to use equirectangular panos for video and photosimulations.
    Not only aimed to street views, pro photographers, hdri maps for renderings or games, those 360 panos can be used to produce high quality videomontages.

    To get the right scale and topo you have to produce a conformal spherical view, with a horizon error < 0.05 degrees.
    It has been georeferenced with a real topo grid; you can use the srtm if you want but it can be done with almost 5 points.
    I made this really quick sequence with blender 2.76 , make it loop or pause it to navigate.

    PS: Visualize it with chrome browser to display 360 video effect.

  • Peirce Quincuncial panos

    I’ve been searching a way for long time to make peirce quincuncial panos under Linux.

    Why? I discovered a textured 3d sphere on setchfab, available for download, mapped with a square image, rendering it like a 360 pano.

    (suite…)