Graphics.CubemapGenerator - lordmundi/wikidoctest GitHub Wiki
Cubemap Generator
This tool generates 6 images meant to be the sides of a cubemap (each 90 degrees orthogonal to the others).
The basic idea is to set up a 90 degree FOV with a 1.0 aspect ratio (90 degrees FOV both horizontal and vertical) and then pan and tilt the camera in 90 degree increments to generate the various views. After the images are generated, the imagemagick "montage" command can be used to stitch them together.
Disclaimer
I have no idea if this is a valid cubemap or not. I just did this as an experiment. — frankie September 29, 2015, at 10:20 AM
Download:
- cubemap_generator.tcl (09/29/2015) - Initial Version
Installation:
-
Download tcl script and place into your $USERDATA/gui directory.
-
Add the cubemap_generator.tcl script to your display context GUI block
-
Depending on your EDGE version, it's possible you may need an updated dsp_poster2 plugin to avoid lighting issues and blooms in the saved images. If so, contact Frank Graffagnino about getting an updated plugin.
-
Edit your user.cfg and adjust the perspective portion of your viewport to have a 90 degree vertical FOV for a zoom of 1.0 (first parameter of perspective setting) and set the aspect ratio to 1.0 (second parameter of perspective setting) and also make the viewport itself square (third and fourth parameters of the xywh setting). For example:
view.MAIN CM_Cam perspective( 90.0, 1.0, 4.0, 1000000000000.0 ); xywh( 0, 0, 800, 800 ); attribs(CAMINFO);
Usage
- The script defaults to dropping 4096 x 4096 images for each tile (quite large). If you want to adjust this, edit the cubemap_generator.tcl script and change these resolutions near line 322. Make sure the image resolution remains square.
- Get the forward view the way you want and enable any lighting features you want (shadows, environment reflections, etc.)
- Launch the GUI using "Options→Cubemap Generator"
- Set the string in the first field to be the suffix of what the image filenames will use. It will override images if they already exist.
- Optionally, set the output directory.
- Click start.
Stitching together the cubemap
If you want to stitch the images together similar to the example image above, you can use the following image magick commands. Note that the first command just generates a blank image the resolution we need, so you only need to do this once.
convert -size 4096x4096 canvas:white blank.png
montage -tile 4x3 -geometry 4096x4096+0+0 blank.png cube_11_0.png blank.png blank.png \
cube_11_3.png cube_11_1.png cube_11_4.png cube_11_5.png \
blank.png cube_11_2.png blank.png blank.png full.png
Contact Frank Graffagnino if any updates are made or if you have requested changes.