EDIT: JUST RAN INTO A PROBLEM WITH THE BATCH FILE - I DIDN'T CHECK FOR NON-NUMERIC, INVALID NUMERIC (ZERO, NEGATIVE, FLOAT), OR NUMERIC VALUES THAT ARE TOO BIG/SMALL. I'VE EDITED THE BATCH FILE IN THIS POST TO HARD-CODE THE RENDER SIZE INSTEAD.
For anybody who's tried my 'Make Your Own Environment Maps And Light Probes' procedure' you'll be pleased to know that I've done a couple of Windows scripts to automate the most tedious bits. I've only tried them on Windows 7 so far (I'm afraid that if you use a MAC I can't help as I don't have access to one). They're not perfect yet, but they do work for me. So if you're already familiar with scripts and batch files, and the two below make sense to you, then feel free to use/modify them. But do so at your own risk! (Edit: Passing the render size as a parameter to the batch file was a bad idea! I accidentally used a non-numeric parameterseriously needs some better checking!
First, a Terragen Classic script to create the six cubemap images. Simply cut and paste the following and save it as 'makeCubemap.tgs'
initanim "C:\temp\n", 1
Zoom 1.0
CamOri 0,0,0
frend
initanim "C:\temp\s", 2
CamOri 180,0,0
frend
initanim "C:\temp\e", 3
CamOri 90,0,0
frend
initanim "C:\temp\w", 4
CamOri 270,0,0
frend
initanim "C:\temp\u", 5
CamOri 0,90,0
frend
initanim "C:\temp\d", 6
CamOri 0,-90,0
frend
Once you've got everything set up in Terragen Classic Terragen Classic simply run this script (from the main menu bar 'Terragen > Execute Script' and select the file). It'll create six files - n0001.bmp, s0002.bmp, e0003.bmp, w0004.bmp, u0005.bmp and d0006.bmp in c:\temp\ - that's north, south, east, west, up and down. Check http://www.planetside.co.uk/terragen/dev/tgscript.html for full (but very brief!) details of the Terragen Script commands.
Second, a Windows batch file incorporating ImageMagick commands to convert these six cubemap images into a vertical cross, and to extend the faces slightly into the unused areas. (I found that just extending by a single pixel was sufficient to avoid spurious lines appearing at the HDRShop panoramic transformation stage). Simply cut-and-paste the text below and save it as 'makeVC.bat'
You need ImageMagick installed on your system obviously for this to work.
(EDIT: PASSING THE RENDER SIZE AS A PARAMETER AS I ORIGINALLY DID REQUIRES FAR, FAR BETTER PARAMETER VALIDATION! I'VE DECIDED THAT HARD-CODING THE RENDER SIZE IS MUCH BETTER. ALSO I FORGOT TO MAKE THE NEW ENVIRONMENT VARIABLES LOCAL TO THE BATCH FILE. I'VE AMENDED THE BATCH FILE BELOW - CHANGES IN BOLD.)
:: ImageMagick script to make a vertical cross image
:: Input: Six square cubemap images n, s, e, w, u, d (BMP)
:: Output: A vertical cross image (VCedged.png) with its edges extended by one pixel into the blank areas.
::
:: Up
:: West North East
:: Down
:: South
::
:: A 1 pixel column from the left and right of the Up, Down, and South faces is extended into the adjacent unused space.
:: A 1 pixel row from the top and bottom of the West and East faces is extended into the adjacent unused space
:: (This should be sufficient to prevent lines appearing along these edges when doing a panoramic transformation in HDRShop)
echo off
:: (Original passing render size as a parameter removed)
:: Ensure variables are local to this batch file
setlocal
:: Set render size and dependent numeric parameters
set /a renderSize = 960
:: width/height of the resultant image are for info only (echoed to screen) and are not actually used.
set /a vcWidth = 3 * renderSize
set /a vcHeight = 4 * renderSize
echo Cubemap source images are %renderSize%x%renderSize% pixels, vertical cross will be %vcWidth%x%vcHeight%.
:: Position and offset values for adding the edge rows/colums
set /a rs1 = renderSize
set /a rs1m1 = rs1 - 1
set /a rs2 = renderSize * 2
set /a rs2p1 = rs2 + 1
set /a rs2m1 = rs2 - 1
:: Filenames
set srcImg=~VC.png
set dstImg=VCedged.bmp
:: Create a black square image for use in the 'montage' command for the unused areas of the vertical cross image
convert X.png -resize %renderSize%x%renderSize%! ~Y.png
:: Combine the six cubemap images (north, south, east, west, up and down) into a vertical cross image
echo Rotating the 'South' image through 180 degrees...
convert "s0002.bmp" -rotate "180" ~sRot180.bmp
echo Combining the six images into a single vertical cross image...
montage ~Y.png "u0005.bmp" ~Y.png "w0004.bmp" "n0001.bmp" "e0003.bmp" ~Y.png "d0006.bmp" ~Y.png ~Y.png ~sRot180.bmp ~Y.png -mode Concatenate -tile 3x4 "%srcImg%"
:: Extend the edges into the blank areas to prevent edge lines on lat/long and angular mapped transformations - call 'AddEdges' subroutine
echo Extending the edges of the vertical cross into the blank areas of the image...
:: left edge of 'Up' face
echo ...left edge of 'Up' face
convert "%srcImg%" -crop 1x%rs1%+%rs1%+0 "~edge.png"
composite -geometry +%rs1m1%+0 ~edge.png %srcImg% ~vcEdged.png
:: right edge of 'Up' face
echo ...right edge of 'Up' face
convert %srcImg% +repage -crop 1x%rs1%+%rs2m1%+0 ~edge.png
composite -geometry +%rs2%+0 ~edge.png ~vcEdged.png ~vcEdged.png
:: left edge of 'Down' and 'South' faces
echo ...left edge of 'Down' and 'South' faces
convert %srcImg% +repage -crop 1x%rs2%+%rs1%+%rs2% ~edge.png
composite -geometry +%rs1m1%+%rs2% ~edge.png ~vcEdged.png ~vcEdged.png
:: right edge of 'Down' and 'South' faces
echo ...right edge of 'Down' and 'South' faces
convert %srcImg% +repage -crop 1x%rs2%+%rs2m1%+%rs2% ~edge.png
composite -geometry +%rs2%+%rs2% ~edge.png ~vcEdged.png ~vcEdged.png
:: top edge of 'West' face
echo ...top edge of 'West' face
convert %srcImg% +repage -crop %rs1%x1+0+%rs1% ~edge.png
convert ~edge.png -resize %rs1m1%x1! ~edge.png
composite -geometry +0+%rs1m1% ~edge.png ~vcEdged.png ~vcEdged.png
:: top edge of 'East' face
echo ...top edge of 'East' face
convert %srcImg% +repage -crop %rs1%x1+%rs2%+%rs1% ~edge.png
convert ~edge.png -resize %rs1m1%x1! ~edge.png
composite -geometry +%rs2p1%+%rs1m1% ~edge.png ~vcEdged.png ~vcEdged.png
:: bottom edge of 'West' face
echo ...bottom edge of 'West' face
convert %srcImg% +repage -crop %rs1%x1+0+%rs2m1% ~edge.png
convert ~edge.png -resize %rs1m1%x1! ~edge.png
composite -geometry +0+%rs2% ~edge.png ~vcEdged.png ~vcEdged.png
:: bottom edge of 'East' face
echo ...bottom edge of 'East' face
convert %srcImg% +repage -crop %rs1%x1+%rs2%+%rs2m1% ~edge.png
convert ~edge.png -resize %rs1m1%x1! ~edge.png
composite -geometry +%rs2p1%+%rs2% ~edge.png ~vcEdged.png %dstImg%
echo All done. The edged vertical cross cubemap has been created - "%dstImg%"
:AllDone
:: Restore the environment variables
endlocal
You need seven input files - the six cubemap images created by the previous Terragen script, plus a plain black square PNG image (X.png - any size should be fine).
EDIT: The render size is hard-coded into the batch file now, so provided your renders are 960x960 you just run it. If your renders are a different size you need to edit the 'renderSize' value in the batch file first.
It takes several seconds to run and outputs a few progress messages aon the way. The output file is 'VCedged.bmp'. There will be several temporary intermediate files beginning with a tilde (~) and you'll have to delete these manually.
The resulting 'VCedged.bmp' file is the input to the final HDRShop v1.0 stage of my procedure.
Good luck!
Information about my current 3D modelling projects, mostly Blender, Poser, and DAZ Studio related. You'll also find me at ShareCG, DAZ3D, Renderosity, DeviantArt, HiveWire3D and various other 3D modeling related sites - user 3dcheapskate on all. (3DCheapskate is the freebie 3D model creating alter-ego of Pete Williams. The 3D bit is obvious, but Cheapskate? Simple, I've a very limited budget and have to really watch the pennies for non-essential hobby-related stuff - so I make my own stuff!)
Wednesday, 27 November 2013
Friday, 1 November 2013
Freebie - Buddhist Armour
Once again I've been busy testing, packaging and uploading and forgot to post here! So basically, just in case you haven't spotted it already, the sak yant tattoo set I've been on about recently has been completed and uploaded.
ShareCG: http://www.sharecg.com/v/72731/view/11/Poser/Buddhist-Armour
Renderosity: http://www.renderosity.com/mod/freestuff/details.php?item_id=72648
(However, I ran into problems with the DAZ Script and layered images so the released version of that is still a BETA, and doesn't support layered images or non-standard materials.)
There were a couple of mistakes and some figures I missed, so I did a second upload:
ShareCG: http://www.sharecg.com/v/72772/browse/11/Poser/Buddhist-Armour-Fixes-And-More-Figure-Mappings
Renderosity: http://www.renderosity.com/mod/freestuff/details.php?item_id=72660
And I was asked how I go about mapping the tattoos to all the different figures, so I did a short PDF guide:
ShareCG: http://www.sharecg.com/v/72795/view/3/PDF-Tutorial/One-Way-To-Map-Tattoos-Using-Blender
ShareCG: http://www.sharecg.com/v/72731/view/11/Poser/Buddhist-Armour
Renderosity: http://www.renderosity.com/mod/freestuff/details.php?item_id=72648
(However, I ran into problems with the DAZ Script and layered images so the released version of that is still a BETA, and doesn't support layered images or non-standard materials.)
There were a couple of mistakes and some figures I missed, so I did a second upload:
ShareCG: http://www.sharecg.com/v/72772/browse/11/Poser/Buddhist-Armour-Fixes-And-More-Figure-Mappings
Renderosity: http://www.renderosity.com/mod/freestuff/details.php?item_id=72660
And I was asked how I go about mapping the tattoos to all the different figures, so I did a short PDF guide:
ShareCG: http://www.sharecg.com/v/72795/view/3/PDF-Tutorial/One-Way-To-Map-Tattoos-Using-Blender
Subscribe to:
Posts (Atom)