قالب:Cubemap viewer/doc

Usage

خطأ: لا توجد وحدة بهذا الاسم "Uses calculator".

Creates a 360-degree image viewer out of a cubemap image file.

This is similar to Template:PanoViewer except it's on-wiki and uses cubemap instead of equirectangular projection.

Syntax

If you have a single cubemap file containing all the faces (e.g. file:Eesti Lennundusmuuseum. Hävitaja F-4C Phantom II kabiin (cubemap).jpg ) use the montage parameter. If you have spearate files that all follow the correct naming convention (See below), then use the faces= parameter.

Simple example [Shown at the right]:

{{Cubemap viewer
|montage=Eesti Lennundusmuuseum. Hävitaja F-4C Phantom II kabiin (cubemap).jpg
|panoviewer=Eesti Lennundusmuuseum. Hävitaja F-4C Phantom II kabiin.jpg
|viewbox height=350
|viewbox width=400
|pitch=-5
|yaw=90
|hfov=94
|caption=Cockpit of a McDonnell Douglas F-4 Phantom II.
}}


Common options (See template data for all options)

{{Cubemap viewer
|faces=Franklin Park photosphere, May 2019
|hfov=45 <!-- Horizontal field of view in degrees -->
|pitch=25 <!-- pitch (up/down) in degrees -->
|yaw=114 <!-- yaw (left/right) in degrees -->
|textcontrols=1 <!-- show text controls -->
|zoomcontrols=1 <!-- show zoom controls -->
|arrowcontrols=1 <!-- Show arrow controls -->
|caption=Your caption here
|align=left
|viewbox width=200
|viewbox height=200
|resolution=600 <!-- Resolution to use for rendering images. -->
|pannoviewer= <!-- Image in equirectangular format to make a link to pannoviewer -->
}}

If you need to use it without the image frame wrapper, you can use {{Cubemap viewer/core}}.

Examples

Using multiple files all following the correct naming convention prefixed with Franklin Park photosphere, May 2019

By specifying faces=Franklin Park photosphere, May 2019, this will automatically use File:Franklin Park photosphere, May 2019 (left).jpg, File:Franklin Park photosphere, May 2019 (front).jpg, File:Franklin Park photosphere, May 2019 (right).jpg, File:Franklin Park photosphere, May 2019 (back).jpg, File:Franklin Park photosphere, May 2019 (up).jpg, File:Franklin Park photosphere, May 2019 (down).jpg for the faces. It will also make the panoviewer link go to File:Franklin Park photosphere, May 2019 (front).jpg.

File:Olympic Village Cafeteria CubeMap 360.png
File:Skybox example.png
File:Panorama cube map.png You can specify viewbox width and viewbox height
File:Basílica de San Patricio 360 panoramic view.jpg Example adjusting viewpoint

In this example we adjust the viewpoint to make the floor design be central. We also set overlap=0 to ensure all the strong lines line up

{{Cubemap viewer
|faces=Basílica de San Patricio 360 panoramic view
|caption=[[St. Patrick's Basilica, Montreal]].
|yaw=185
|pitch=-3
|hfov=70
|viewbox height=420
|viewbox width=300
|horizontal adjust=-11
|arrowcontrols=
|overlap=0
|background=#9b764a
|align=none
}}
File:Women's Cross Country 5KM Relay CubeMap 360.png
File:Earth cube map.png [Inside out]


Template data

Render a 360 panorama in cubemap format as a 3D view

وسائط القالب

هذا القالب يفضل التنسيق الرأسي للوسائط.

وسيطوصفنوعحالة
facesfaces

Prefix to use for image files. Do not include namespace or extension. Will append (front).jpg, (back).jpg and so on to get the various faces of the cubemap. Will also assume that adding just .jpg gets the file in equirectangular format (if the file exists).

مثال
Franklin Park photosphere, May 2019
غير معروفمطلوب
montagemontage img

Cubemap image, no file namespace. Use this if you have an entire cubemap in a single file. If using individual file, use the faces parameter instead.

مثال
Skybox example.png
ملفاختياري
face upface up

Image file to use as the top/up (+Y) face. Overrides faces & montage parameter

ملفاختياري
face backface back

Image file to use as the back (-X) face. Overrides faces & montage parameter

ملفاختياري
face downface down

Image file to use as the down (-Y) face. Overrides faces & montage parameter

غير معروفاختياري
face leftface left

Image file to use as the left (+Z) face. Overrides faces & montage parameter

ملفاختياري
face frontface front

Image file to use as the front (+X) face. Overrides faces & montage parameter

ملفاختياري
face rightface right

Image file to use as the right (-Z) face. Overrides faces & montage parameter

ملفاختياري
captioncaption

Caption to include under image

محتوىمقترح
alignalign

Where to put the image in the page

القيم المقترحة
left right center none
غيابي
right
نصمقترح
yawyaw

Initial value for yaw (left<->right) in degrees.

غيابي
-10
مثال
45
رقممقترح
pitchpitch

Initial value for pitch (Up/down direction) in degrees. Note: If using non-default value, be sure to test in chrome on mobile frontend.

غيابي
-10
رقممقترح
horizontal field of viewhfov

Horizontal field of view (in degrees). This controls how zoomed in the image is. Note: be sure to test in chrome on mobile before using a custom value.

غيابي
80
مثال
100
رقممقترح
arrowcontrolsarrowcontrols

Include left, right, up, down arrow controls

غيابي
true
بوليانياختياري
zoomcontrolszoomcontrols

Add +/- to control zoom level

غيابي
true
بوليانياختياري
playcontrolsplaycontrols

Show a play button that triggers one full revolution of the yaw coordinate

غيابي
true
بوليانياختياري
textcontrolstextcontrols

Include text box controls in the caption

مثال
true
بوليانياختياري
panoviewerpanoviewer

Equirectangular version of the parnorama in order to make a link to PanoViewer on toolforge. If not specified will use faces parameter

مثال
Nebel Schienen Panorama.jpg
ملفاختياري
viewbox widthviewbox width

Width of image box to show

غيابي
300
مثال
300
رقممقترح
viewbox heightviewbox height

Height of image box to show

غيابي
225
رقممقترح
minimum horizontal field of viewminhfov

The max amount you can zoom in

غيابي
1
مثال
10
رقماختياري
maximum horizontal field of viewmaxhfov

The most you can zoom in. If too high the image becomes very distorted.

غيابي
150
مثال
110
رقماختياري
resolutionresolution

Resolution of image to render the faces. Must not be more than 4 times the max width of the source image when using montage. Generally twice the value of viewbox width is a good value.

غيابي
600
رقممقترح
backgroundbackground

Background colour which might show through when images are initially loading or if there are small seams between the images

غيابي
#7D7F7C
مثال
white
نصاختياري
overlapoverlap

How much to overlap the images. Generally 2 is a good value. If you see seams between the images try increasing. If the faces don't line up try decreasing.

غيابي
2
مثال
0
رقماختياري
viewbox styleviewbox style

Additional CSS to add just to the view box. In some cases adding filter: blur(0.5px) may be easier on the eyes if the picture has lots of high frequency data.

نصاختياري
horizontal adjusthorizontal adjust

Adjust user perspective this many pixels to the left

غيابي
0
مثال
-10
رقماختياري
vertical adjustvertical adjust

Adjust vertical perspective by this many pixels

غيابي
0
مثال
-10
رقماختياري
rotaterotate

Rotate the viewpoint by this many degrees

مثال
1.1
رقماختياري

Converting images to cubic form

If you have a panorama file in equirectangular projection, you can convert it cubemap format using https://jaxry.github.io/panorama-to-cubemap/ (Very large files may crash the browser). It is recommended to use lanczos for the interopolation, jpeg as the output format, and set the cube rotation so the most interesting part of the image is in the third column of the middle row. An alternative converter is https://gitlab.wikimedia.org/repos/commtech/pano-projector which works better for large files.

If using pano-projector, the following script might be helpful:

Shell script for using pano-projector to extract faces
pano-projector face --face left --mem-limit 3000 --quality  93 --copy-icc "$1" "${1%.jpg}_(left).jpg"
pano-projector face --face right --mem-limit 3000 --quality  93 --copy-icc "$1" "${1%.jpg}_(right).jpg"
pano-projector face --face back --mem-limit 3000 --quality  93 --copy-icc "$1" "${1%.jpg}_(back).jpg"
pano-projector face --face front --mem-limit 3000 --quality  93 --copy-icc "$1" "${1%.jpg}_(front).jpg"
pano-projector face --face top --mem-limit 3000 --quality  93 --copy-icc "$1" "tmp_up.jpg"
jpegtran -perfect -rotate 270 tmp_up.jpg > "${1%.jpg}_(up).jpg"
pano-projector face --face bottom --mem-limit 3000 --quality  93 --copy-icc "$1" "tmp_down.jpg"
jpegtran -perfect -rotate 90 tmp_down.jpg > "${1%.jpg}_(down).jpg"

exiftool -tagsFromFile "$1" -XMP-GPano:ALL= "${1%.jpg}_(left).jpg" "${1%.jpg}_(right).jpg" "${1%.jpg}_(back).jpg" "${1%.jpg}_(front).jpg" "${1%.jpg}_(up).jpg" "${1%.jpg}_(down).jpg"

When uploading files, it is recommended to follow the naming convention based on File:Skybox_example.png. Namely: Use File:Filename.jpg for the original equirectangular version, FILE:Filename (up).jpg for the 2nd column of the first row (The "py" or "+Y" face), FILE:Filename (back).jpg for the 1st column 2nd row (The "nx" or "-X" face), File:Filename (left).jpg for the 2nd column first row ("pz" or "+Z" face), File:Filename (front).jpg for the 3rd column 2nd row ("px" or "+X" face), File:Filename (right).jpg for the 4th column 2nd row ("nz" or "-Z" face), and File:Filename (down).jpg for the 2nd column 3rd row (ny or "-Y" face). If you follow this naming convention, the template will find all the files if you use the parameter |faces=Filename

Its probably best to upload them as separate files, as that allows the different views to be reused as normal photos. Alternatively they can create a montage of all the faces to project the entire panorama into a cubemap format (e.g. Like File:Eesti Lennundusmuuseum. Hävitaja F-4C Phantom II kabiin (cubemap).jpg ). If you want to do that with ImageMagick's montage program. First create a pure white file of the size of one of the faces: convert -size 4249x4249 xc:white white.jpg then run the command: montage white.jpg py.jpg white.jpg white.jpg nx.jpg pz.jpg px.jpg nz.jpg white.jpg ny.jpg white.jpg white.jpg -mode Concatenate -tile 4x3 -quality 91 out.jpg

See also