Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

An update to Anim8or, v1.00b, is available with a few bug fixes. Get your copy HERE. See the "ReadMe" file for details.

Author Topic: equirectangular images to cubie faces  (Read 3972 times)

cooldude234

  • Sr. Member
  • ****
  • Posts: 901
  • You know what I realized, I dont have an avatar :\
    • View Profile
equirectangular images to cubie faces
« on: February 14, 2013, 04:37:48 am »

I thought I would ask around here considering this is 3D graphics forum and a lot of people here know quite a bit of free software.
So here's my dilemma, I'm trying to render (in Carrara) a full 360 degree scene on all axis so I can use it as a skybox in my engine. However I can only render a equirectangular image, in other words a spheremap/skydome. I really don't want to use skydomes because of the distortion you get at the polar ends of the sphere (see image for illustration). So I set my sights to seek down some conversion software, but the software I found gave the exact same distortion. ):<
Any thoughts?
Logged

Raxx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1450
    • View Profile
Re: equirectangular images to cubie faces
« Reply #1 on: February 14, 2013, 04:48:57 am »

I don't know anything about Carrara, but in Anim8or you can render perfect cube maps. If Carrara has at least the same type of camera control, it should be no different in process.

I explained it here: http://www.anim8or.com/smf/index.php?topic=4175.msg30860#msg30860
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 901
  • You know what I realized, I dont have an avatar :\
    • View Profile
Re: equirectangular images to cubie faces
« Reply #2 on: February 14, 2013, 10:42:16 am »

Yea I tried that approach but in Carrara the cameras viewing angle is measured in millimeters (mm) and I wasn't giving an answer on which mm is the right one.
Logged

Raxx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1450
    • View Profile
Re: equirectangular images to cubie faces
« Reply #3 on: February 14, 2013, 01:19:48 pm »

Quote
if you set FL to 21.677mm then export your camera as a Ccllada File
you will see
Code:
<perspective>
                  <xfov>45</xfov>
                  <yfov>45</yfov>


this is in fact a FOV of 90 degrees

filmback width = 2 * focal length * tan( ( horizontal fov in degrees * pi / 180 ) / 2 )

so the filmback width is exactly 2 * 21.677mm = 43.354mm

filmback height = 24.3866mm for 1280x720 images
filmback height = 32.5155mm for 640x480 images

http://forumarchive.daz3d.com/viewtopic.php?t=175284

Even if you can't figure it out using the given equations, you can fiddle with the mm and export to collada to see what FOV it actually is, and then use the Anim8or method.
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 901
  • You know what I realized, I dont have an avatar :\
    • View Profile
Re: equirectangular images to cubie faces
« Reply #4 on: February 15, 2013, 12:09:38 am »

so it came down to the fov needed in mm was 22 mm.
However, that still doesn't work, the seams (although close) don't match up still.
Logged

Raxx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1450
    • View Profile
Re: equirectangular images to cubie faces
« Reply #5 on: February 15, 2013, 05:31:32 pm »

It seems that the camera's pivot, or hot point, is off-center from where the projection is read. So when you rotate the camera, it all becomes offset. Also, the FOV may need adjusting, not sure.

Kind of a pain. Might be worth it to just convert your equirectangular image to cubic map using a 3rd party tool, and photoshop anything that looks out of place.
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 901
  • You know what I realized, I dont have an avatar :\
    • View Profile
Re: equirectangular images to cubie faces
« Reply #6 on: February 15, 2013, 10:20:44 pm »

I tried doing that and it still gave the distortions.
And photoshop can do that?

EDIT: miss-read that, I thought you mean photoshop could convert those images.
I don't want to "photoshop" the images because that looses  the quality retained from it and makes it look out of place, and when I need a BUNCH of these then the work load just increases and the quality decreases. I would use anim8or for this job but it doesn't support advanced shaders (I can't easily texture things to look like wood), doesn't support very good skeletons and bone movement and the renders would take 2342304823948 times longer. Anyone know of any good FREE software out there that could do this job?
« Last Edit: February 16, 2013, 04:14:47 am by cooldude234 »
Logged

Raxx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1450
    • View Profile
Re: equirectangular images to cubie faces
« Reply #7 on: February 16, 2013, 05:33:00 pm »

Ok, so I gave it a go in Carrara using a scene I found online. I had no trouble at all with making a cubic map that was 100% seamless. I tested it in Anim8or and Marmoset Toolbag and it works fine.

1. Make a conical camera, place it wherever. Do not scale it whatsoever.
2. Give it a focal/zoom length of exactly 21.677 mm. It'll show 22 after you set it, but it keeps it at 21.677
3. Go to the render portion of Carrara, and in the right-hand panel, in Output, set it to a square resolution (I set mine to 500x500--should work for whatever resolution you use).
4. Render each of the six directions. (shift-rotate on the axis to snap to 45 degree increments)
5. Piece together however you need them for your engine. Top and bottom may have to be rotated to match the horizontal images.

Note that if you use a sun/solar flare effect rendered in Carrara, it'll result in a seam caused by the lack of that overlay in the adjacent images, as seen in the attachments. If you're using it for a game engine, it'd be better if the sun was dynamic anyway, so just leave it out and you should be ok.
« Last Edit: February 16, 2013, 08:04:16 pm by Raxx »
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 901
  • You know what I realized, I dont have an avatar :\
    • View Profile
Re: equirectangular images to cubie faces
« Reply #8 on: February 16, 2013, 07:48:44 pm »

1. Make a conical camera, place it wherever. Do not scale it whatsoever.
2. Give it a FOV of exactly 21.677. It'll show 22 after you set it, but it keeps it at 21.677
Note that if you use a sun/solar flare effect rendered in Carrara, it'll result in a seam caused by the lack of that overlay in the adjacent images, as seen in the attachments. If you're using it for a game engine, it'd be better if the sun was dynamic anyway, so just leave it out and you should be ok.

No one said any of those things to me, so thanks :)
And the FOV is measured in mm you know that right? (everyone kept giving me degrees).
Also it would be easy to add a lens flare as a flat polygon rendered on top of everything else with no depth testing done on it. Thanks again, I'll try this immediately.
Logged

Raxx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1450
    • View Profile
Re: equirectangular images to cubie faces
« Reply #9 on: February 16, 2013, 08:03:41 pm »

Well in step #2 I meant give it a focal length of exactly 21.677 mm. I put FOV in there out of habit. I'll fix that in the steps so that anyone else won't get confused.
Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 901
  • You know what I realized, I dont have an avatar :\
    • View Profile
Re: equirectangular images to cubie faces
« Reply #10 on: February 16, 2013, 08:44:15 pm »

Well thanks, it works perfectly (I just have to fix my .obj skybox now to perfect it's projection ;P )
Thanks again, you gave the best answer out of the 100's I went through :P
Logged