mcjVRKit


 ================================================================================
Introduction
================================================================================
A set of tools For Daz Studio  to render Scenes as equirectangular images 
Those images are known as photospheres or environment spheres
They can be viewed using Virtual Reality viewers like Youtube-360, Facebook-360, google Cardboard 
or used as environments in 3D rendering programs ( like Daz Studio-iRay ).


================================================================================
History
================================================================================

January 22nd 2017 - v3, i added the 2 missing texture files for the remap-and-stitcher plane prop

note that normally you replace those 2 images with the 2 fisheye images you rendered in the previous step



August 27th 2016 9:21 PM - V2 mcjRemapAndStitch can now create the twin-camera and mirror device and the camera+panel device


August 26th 2016 - V1 initial release



================================================================================
Installation
================================================================================

The zip package is found at the bottom of this page

unzip it in your daz content folder, 


typically :

C:\Users\USERNAME\Documents\DAZ 3D\Studio\My Library


once installed, it will appear in your content library, under 


The Daz Scripts will be found in  My Library / Scripts / mcasual 


The props will be found in  My Library / Runtime / Libraries / Props / mcasual


The Camera presets will be found in My Library / Presets / Cameras / mcasual


The material presets will be found in My Library / Presets / Materials/ mcasual


Starting with Windows 7 if you right click on the downloaded zip file

and select the [Extract All ....] pop-up menu item
you simply browse up to your Daz Studio Content Folder
and the files will fall in the proper folder 



================================================================================
Rendering your scene as two fisheye images
================================================================================
Building the mirror based twin fisheye cameras
================================================================================
We will render the whole spherical panorama in only 2 renders
We need 2 very precisely positionned cameras and a bi-convex mirror prop

New in version 2

Starting to version 2, you can load the bi-convex mirror and the two cameras using 1 button
start the mcjReMapAndStitch script found in your Daz Content folder, in the scripts/mcasual folder
click on the "Create Twin-Fisheye Camera" button


In your scene, there sould now be 2 cameras pointing at a lens-shaped object


The mirror is setup for 3Delight renders, 
if you intend to use this kit to render using the iRay engine
click on the "Fisheye Camera is For Iray" button

================================================================================
The old way to create the mirror-based twin fisheye cameras
================================================================================
Load the mcjBiConvexMirror prop which should be in your Poser Content library: Props / mCasual

The lens-shaped object should appear in the center of the daz universe at 0, 0, 0.

Load the two cameras by applying the preset mcjHemiCams which should be found in in your Daz Studio Content  library : Presets / Cameras / mCasual


Since this is a poser prop, the mirrors are more like a piece of chalk.


if you plan on rendering your scene using iRay, apply the Uber - Polished Aluminum shader
which should be in content library, in the Daz Studio Content section under Shader Presets / iRay / Daz Uber

if you plan on rendering your scene using 3Delight, apply the mcjMirrorMaterial preset which should be
Daz Studio Content section under presets/materials/mcasual

================================================================================
Time To Render The Fisheye Images
================================================================================

If you plan on filming from a different location,  you must make sure the relative positions of the cameras and mirror don't change by even just a millimeter! 

You could parent the two cameras to the mirror and use the mirror to move the whole apparatus.


Note about my demonstration setup - By default the biconvex mirror and the cameras are centered at { 0, 0, 0 }. I loaded one of my sky-sphere props, and if it was not already there, i moved the center of the  sphere to { 0, 0, 0 }. This makes sense because the camera used to take the (real world) photo of the photosphere was at the center of that sphere. Since the camera was sitting quite high on a tripod or stick, maybe 6 ft above the ground, i had to move my 3D figure dancers down. Their floor is at { 0, -186, 0 }. If you used a photosphere from google streetview it could be 18 ft below the biconvex mirror.


note about backdrops:  With 3Delight, even if you add an backdrop color or image, it will not be visible in the mirrored image. So you may want to use one of my mcjSkySphere props as a backdrop . Be aware that in the parameters tab of any object you can set the "cast shadows" parameter off, this way you can prevent the mcjSkySphere from blocking your distant lights. Version 2 has a button to load an mcjSkySphere ! The funny thing is, the mcjSphere is designed for exactly the type of image we are about to produce. You can Google for 'sIBL archive' to get some of those images.


Set the render size to a square image ratio, example 2000 * 2000


From the point of view of our two cameras, the mirror should fill almost entirely the field of view

You must not move the cameras and you must not change camera parameters. Else the fisheye images won't be usable.

Render the two fisheye images with names like scene000_Top and Scene000_Bottom.

If you intend to make videos, render your fisheye images as a sequence of images, not a "movie"


 ================================================================================
The ReMap-and-stitch process
Converting the two fisheye images into an equirectangular image 
================================================================================
Once you have your 2 fish-eye renders, they need to be completely re-shaped and assembled to form one equirectangular image. I wanted this to be a solution that works for both Macs and PCs, so we'll do this right "here" in Daz Studio.

New in version 2

Starting to version 2, you can load the mcjFishToEqui400 and the special camera using one button!

start the mcjReMapAndStitch script found in your Daz Content folder, in the scripts/mcasual folder
click on the "Create Re-Map Camera And Prop" button.


================================================================================
The old way to create the re-map and stitch camera and prop
================================================================================
Load the Poser-compatible prop named mcjFishToEqui400 which should be in your Content library in the Poser content section under Props/mCasual

Load the camera named mcjRemapAndStitchCameraPreset which should be in your content library, in the Daz Studio Content section under Presets\Cameras\mcasual

The result should be a camera pointing directly at the mcjFishToEqui400 prop which looks like a simple primitive plane but is in fact very special.

We need to make sure the lighting or the absence of lighting in the scene doesn't affect our render
so we will make the prop self-illuminating

to do this manually, select the mcjFishToEqui400Top and mcjFishToEqui400Bot default material/surface

set 
- Diffuse color white, 
- Diffuse strength at 0%
- Specular strength at 0% 
- Ambient color at white



You can also do this by selecting the two half-planes and running my script named mcjSelfIlluminate 

This script should be in your content library, in the Daz Studio Content section under scripts/mCasual


================================================================================
Time To Render The Equirectangular Image
================================================================================
Apply the fisheye render image of the sky to the top panel ( named mcjFishToEqui400Top )
Apply the fisheye render image of the ground to the bottom panel ( named mcjFishToEqui400Bot )
The mcjFishToEqui400 prop now looks exactly like what we want, except it's not on disk ! 

If the two panels don't look self-illuminating at all, you may need to go in Daz Studio's menus : Edit / Preferences / Interface and turn "Per Pixel Shading" off.

Your render settings must have a 2-to-1 ratio, for example, for an image like what comes out of a RICOH Theta  camera, i use 6000 x 3000 pixels images;

Use the "Basic OpenGL" render engine or better yet the 3Delight render engine.

Render it !

================================================================================
Making the equirectangular image Facebook-360 compatible
================================================================================

roundandround2.avi



If you take an equirectangular image like we produced just now, and mark the file as being a photosphere, FaceBook will display it on your timeline in a VR/360 viewer !

Exiftool is a free utility to add 'metatags" to your photos, photographers use it to insert or modify various information , copyright notices and signatures.

We will use it to make our equirectangular image look like it was coming from a RICOH Theta camera. This camera uses two fisheye lens, much like what we did here with mirrors!

Get the exiftool from here http://www.sno.phy.queensu.ca/~phil/exiftool/

I installed my exiftool.exe in C:\Users\Jacques\Downloads\exiftool-10.23

Download my mcjEquiForFaceBook.bat file which i packaged in the zip file mcjEquiForFaceBook.bat.zip

It's possible that your internet security or browser will freak out and refuse to download this file. There's good reasons actually because a .bat file could be used by malevolent hackers to do much damage to your PC. 

Here is the content of mcjEquiForFaceBook.bat 

FOR %%A IN (%*) DO (
exiftool -ProjectionType="equirectangular" -UsePanoramaViewer="True" -"PoseHeadingDegrees<$exif:GPSImgDirection" -"CroppedAreaImageWidthPixels<$ImageWidth" -"CroppedAreaImageHeightPixels<$ImageHeight" -"FullPanoWidthPixels<$ImageWidth" -"FullPanoHeightPixels<$ImageHeight" -CroppedAreaLeftPixels="0" -CroppedAreaTopPixels="0" %%A

You could use a text editor like notepad, copy and paste this text, and save the document as a plain-text file under the name mcjEquiForFaceBook.bat

Place mcjEquiForFaceBook.bat in the same folder as exiftool.exe

Place the equirectangular image in the same folder.

In Windows Explorer, pick the image file using your left mouse button, move it on top of mcjEquiForFaceBook.bat release your left mouse button. This is called drag-and-dropping a file.

if all goes well, a second later you will have an image containing the requisite markers that will make FaceBook accept your image as a VR-360 image.

================================================================================
Mass ReMap and Stitch ( for Youtube-360 Videos )
================================================================================
 To Create VR-360 videos for Youtube, we first need to render the animation as two sequences of fisheye image.

This is easy so you
 don't need help for that. BUT ideally, the Top fisheye image filenames should start with the word "Top" and the Bottom fisheye image filenames should start with the word Bottom.

Then you have to render the sequence of remapped-and-stitched  equirectangular images.

Doing this manually would mean 

- apply the Top fisheye image TopImage000.jpg to the top panel
- apply Bottom fisheye image BottomImage001.jpg to the bottom panel
- render
repeat 1800 more times

I wrote a short Daz Studio script that will do all this tedious work for you !

Make sure your current view/render camera is the mcjRemapAndStitchCamera

Go in the render settings panel and set the render engine to either 3Delight or OpenGL 

Start the mcjRemapAndStitch script, if you installed the mcjvrkit properly it will be in your content library in the Daz Studio  Format section, in the scripts/mcasual folder.

Click the "Top Fisheye Image(s)" button. Browse up to the first rendered image for the sequence of Top fisheye renders. Example i browse up to c:\users\renders\alcatraz\Top000.jpg

Click the "Bottom Fisheye Image(s)" button. Browse up to the first rendered image for the sequence of Bottom fisheye renders. Example i browse up to c:\users\renders\alcatraz\Bottom000.jpg

Click on the "Render" button

If you do have the requisite mcjFishToEqui400Top and mcjFishToEqui400Bot props in your scene, the script apply the fisheye image pairs to them and render each frame in the same folder as the fisheye images.





================================================================================
Converting the Equirectangular Photosphere renders 
into a Youtube-360 video
================================================================================
I used virtualdub to convert my renders into an .avi video
i used WinFF ( ffmpeg ) to convert the avi into an mp4
then i used the tool supplied by youtube to "metatag" the mp4

here i repost the instructions found in Youtube's Help section

Your video file needs to include certain metadata for 360° playback to be enabled. 

Follow these instructions to install an app that will add the necessary metadata into a new file for you.

Create a 360-enabled file with an app

  1. Download the 360 Video Metadata app for Mac or Windows.
  2. Un-zip the file, then open the 360 Video Metadata app. If you're on a Mac, you may need to right-click the app and then click Open.
  3. Select the video file.
  4. Select the checkbox for Spherical and click Save as. Do not select the "3D Top-bottom" checkbox. For more information, refer to upload instructions for virtual reality videos.
  5. Enter a name for the file that will be created.
  6. Save the file. A new file will be created automatically in the same location as the original file.
  7. Upload the new file to YouTube.
  8. Wait for the 360° effect to process. This may take up to an hour.

You can also add the metadata using a Python script.



License

// =====================================================================
// by mCasual/Jacques
// You can use this script freely for personal or commercial use. 
// You may not sell, resell, sub-license or rent this script in any way. 
// you may credit this script to mCasual/Jacques 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
// OTHER DEALINGS IN THE SOFTWARE.
// ===================================================================== 




ċ
mcjEquiForFaceBook.bat.zip
(0k)
mCasual Jacques,
Aug 26, 2016, 8:11 PM
ċ
mcjVRKit.zip
(5089k)
mCasual Jacques,
Jan 22, 2017, 4:48 PM
Comments