Help with creating spheremap of Irrlicht scene
-
- Posts: 219
- Joined: Fri Feb 19, 2010 4:03 pm
- Location: Estonia
Help with creating spheremap of Irrlicht scene
Hi,
I have looked around on forum but could not find how to do this.
Irrlicht demo is using the following spheremap:
Could someone please tell me or post link to code/example how this is done? I need to create a similar spheremap of my scene.
Many thanks in advance,
/regards
I have looked around on forum but could not find how to do this.
Irrlicht demo is using the following spheremap:
Could someone please tell me or post link to code/example how this is done? I need to create a similar spheremap of my scene.
Many thanks in advance,
/regards
to live, is natural; to die, is not!
-
- Posts: 219
- Joined: Fri Feb 19, 2010 4:03 pm
- Location: Estonia
-
- Posts: 219
- Joined: Fri Feb 19, 2010 4:03 pm
- Location: Estonia
Thanks hybrid, do you mean I set the camera's FOV to 360 degrees? Or, as it takes radians, to 6.2831855 before rtt? Also, forgive me for being so dumb I cannot find how would I convert a rectangular image to a spherical one in Photoshop. Is there some filter for this? Or perhaps you could kindly point to some link/example/tutorial ?hybrid wrote:Well, you need a 360 degree view of course. Conversion to a sphere map can be done using gimp or photoshop. I guess it also depends on the image processing app how the original image needs to be arranged.
to live, is natural; to die, is not!
-
- Posts: 219
- Joined: Fri Feb 19, 2010 4:03 pm
- Location: Estonia
To be more precise, here's what I'm trying to do:
I have a large cube in the scene, which is like standing on one of its corners, and rotating slowly. I want the six sides of the cube to reflect the correct environment as the cube rotates.
I initially assumed that if I make a spheremap of the scene, like the one shown above from Irrlicht demo, and apply it to the cube, it would reflect the environment correctly. Is that correct?
Or should I make six textures (cubemap), one for each side of the cube, then apply to the cube, but then if they are applied as regular diffuse textures they would rotate together with the cube, but thats not what we want. Perhaps I should set each one of them as spehermap so they stay in place while the cube rotates, but this is not making any sense to me.
Despertaley needing some help :S
I have a large cube in the scene, which is like standing on one of its corners, and rotating slowly. I want the six sides of the cube to reflect the correct environment as the cube rotates.
I initially assumed that if I make a spheremap of the scene, like the one shown above from Irrlicht demo, and apply it to the cube, it would reflect the environment correctly. Is that correct?
Or should I make six textures (cubemap), one for each side of the cube, then apply to the cube, but then if they are applied as regular diffuse textures they would rotate together with the cube, but thats not what we want. Perhaps I should set each one of them as spehermap so they stay in place while the cube rotates, but this is not making any sense to me.
Despertaley needing some help :S
to live, is natural; to die, is not!
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
The spheremap is created outside the actual rendering app. You would indeed create some kind of a cube map first from the app, using simple screenshots and turning the camera. Then you need a tool to stitch together those shots and create a spheremap from it. Don't know how to do this exactly. Finally, you can load the spheremap as simple texture and use spheremap material. The effect is not as good as one might expect, though, there are better effects for this situation.
-
- Posts: 219
- Joined: Fri Feb 19, 2010 4:03 pm
- Location: Estonia
take a look at this example with GLSL shader:
http://tfc.duke.free.fr/
and search for Reflective environment mapping demo example in the list, there is a zip file free to download;
http://tfc.duke.free.fr/
and search for Reflective environment mapping demo example in the list, there is a zip file free to download;
further to hybrid's comment a sphere map like that can create by first creating a panorama, as hybrid mentions, of stitched scene imagery, 4 taken @ 90deg intervals with 90 deg fov for example. the sphere map is then created in photoshop (or similar) using the Distortion filter "polar coordinates". In 3ds max You can render one directly using a "fish eye" camera pointing straight up but there's a lot of "wastage" and distortion at the horizon.
a further note on using sphere maps as cheap reflections, they work well if you after a generic reflection and you are not to concerned if they tally with the scene, they actually work best when quite blurred and indistinct. If you want them to be more accurate sphere maps can be tricky. You probably need a lot of trial and error to align the seam up correctly.
a further note on using sphere maps as cheap reflections, they work well if you after a generic reflection and you are not to concerned if they tally with the scene, they actually work best when quite blurred and indistinct. If you want them to be more accurate sphere maps can be tricky. You probably need a lot of trial and error to align the seam up correctly.
-
- Posts: 219
- Joined: Fri Feb 19, 2010 4:03 pm
- Location: Estonia
@nespa : thank you very much, your demo is really cool and exactly what I was looking for. I downloaded the source but could not find any hlsl shader, only openGL vertex and fragment programs.
I'd be very thankful if you could provide me or point me to an hlsl version of this shader.
EDIT: ah, sorry, I now see you already mentioned it was GLSL... unfortunately I cannot use this, though this is exactly the kind of effect I need. Do you happen to have a HLSL version of it?
@Klunk: thanks for the tips, I managed to finally make the spheremap as suggested by You and hybrid, arranging the 6 images in photoshop in a vertical cross, then loading with hdrShop and applying filters. The problem I'm having now is, it appears perfectly applied to the cube as a solid material, but as soon as I change material-type to EMT_SPHEREMAP it just disappears. Digging into why this is happening. Tested with lighting on-off, playing with all other material properties but so far no luck.
I'd be very thankful if you could provide me or point me to an hlsl version of this shader.
EDIT: ah, sorry, I now see you already mentioned it was GLSL... unfortunately I cannot use this, though this is exactly the kind of effect I need. Do you happen to have a HLSL version of it?
@Klunk: thanks for the tips, I managed to finally make the spheremap as suggested by You and hybrid, arranging the 6 images in photoshop in a vertical cross, then loading with hdrShop and applying filters. The problem I'm having now is, it appears perfectly applied to the cube as a solid material, but as soon as I change material-type to EMT_SPHEREMAP it just disappears. Digging into why this is happening. Tested with lighting on-off, playing with all other material properties but so far no luck.
to live, is natural; to die, is not!
I've also got some code to do this:
http://www.youtube.com/watch?v=DN6aXR8f14o
You can grab it here:
http://svn.bitplane.net/misc/trunk/irr/ ... 0renderer/
It's quite old and might not work with new Irrlicht versions, not very well documented either, but should do what you need.
http://www.youtube.com/watch?v=DN6aXR8f14o
You can grab it here:
http://svn.bitplane.net/misc/trunk/irr/ ... 0renderer/
It's quite old and might not work with new Irrlicht versions, not very well documented either, but should do what you need.
a good example with HLSL here:
http://irrlicht.sourceforge.net/phpBB2/ ... t=cube+map
and here a cool example in HLSL:
http://xna-uk.net/blogs/randomchaos/arc ... ction.aspx
http://irrlicht.sourceforge.net/phpBB2/ ... t=cube+map
and here a cool example in HLSL:
http://xna-uk.net/blogs/randomchaos/arc ... ction.aspx