Auteur : FabKzo

Stretching equirectangular bottom field to patch nadir

Today I’ll share a little bash script I’ve done using imagemagick to patch equirectangular nadir :

#Fabrice Kerzerho 2017

while [ $# -gt 0 ];do
PWidth=$(identify -format « %w » $picture)
PHeight=$(identify -format « %h » $picture)
hauteurcrop=$(echo « $PHeight-($PHeight/9.6) »|bc)
echo « hauteurcrop : $hauteurcrop »

convert « $picture » -crop « $PWidth »x »$hauteurcrop »+0+0 temp_nadir_ball.tif

convert temp_nadir_ball.tif -crop « $PWidth »x »$stretch »+0+ »$(echo « $hauteurcrop »-« $stretch »|bc) » -resize « $PWidth »x »$(echo « $PHeight/9.6″|bc) »! -channel RGBA -blur 0x8 nadir-patch.tif

convert « $picture » -page +0+ »$hauteurcrop » nadir-patch.tif -flatten « ${picture%.*}-patch.jpg »

rm temp_nadir_ball.tif
rm nadir-patch.tif

I use it inside Thunar’s custom actions on lots of panos to produce and upload them quickly to google maps ( no really need to perform perfect personnal panos to such service, unless you’ve made them as a paid service ).

Let’s visualize the mapped result :

Perfect for quick panos production :-);

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 ).

# 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 :
# Author: FabKzo


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

while [ $# -gt 0 ]; do
    echo $pano
    echo "createPano"
    #takes each face to create the final image
    convert -resize x$finalsize toTo.tif ${pano%.*}-cubemap.png
    rm cubeUp.tif cubeDown.tif toTo.tif cube????.tif cube.pto
    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 .

Testing WordPress WP-VR-VIEW plugin


I’ve just found this wordpress plugin from Alexander Tumanov which permits to visualize your hosted panos.

Let test it there for some still pictures of mines:

Well, it seems to do its job but no zoom on your view,
nor heading choice (while mine have xmp photosphere datas);

No problem in full screen ; but forget to put hotspots ;

Nevertheless it’s an « easy install » nice plugin for simple cases.

To compare with direct google services you can go on my google+ page :

FabKzo on Google +

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.

Opensource panorama viewer: Panovisu 1.3

Nowadays opensource alternatives for html5 panorama viewing are at least  2: Pannellum and Panovisu !

Panovisu results of a Frenchs initiative  : not only it displays your  equirectangular or cubic panos, but you can make a complete VR tour with its java editor !

You’ll need a very recent java installation on your computer to launch it,  it has been tested on all recent browsers : all webGL activated are ok but Safari ( as far as I know)

Lets link to its website:

I can help to translate if you don’t read or speak french !


There a personal demo of mine :

Litte Vr tour in Oudon, Loire Atlantique, france

Enjoy it , let me know any bug or problem, I would back them up to its dev !