Page 1 of 6

Irrlicht with cubemap support

Posted: Wed Sep 28, 2011 5:59 pm
by elvman
Finally I ported IrrSpintz cubemap code (with some changes). I will improve the code soon, but you should test it and post some bug reports here.
To load cubemap, you must call driver->addTextureCube (passing 6 images to it), which will return a pointer to the ITextureCube (derived from ITexture). You can use it as a simple 2D texture (use it in setActiveTexture).
IrrlichtWithCubemaps.zip
IrrlichtWithCubemaps.patch
CubemapTest.zip

Image

Motivation: I created this feature with a hope, that it will be integrated in Irrlicht core and I will be able to finish my realistic water scene node (with cubemaps it will look more realistic).

Future plans:
  • 1D textures
  • 3D texture support
  • Render target cube textures
PS. I will try to provide this modification with the latest Irrlicht SVN version

Re: Irrlicht with cubemap support

Posted: Wed Sep 28, 2011 9:19 pm
by hybrid
Yeah, this would be quite interesting. I'll move this thread to open discussions, as it's more of an engine add-on instead of a separate project. Please use latest SVN and provide SVN patches. You can also upload patches to the patch tracker if this helps.

Re: Irrlicht with cubemap support

Posted: Wed Sep 28, 2011 11:07 pm
by 3DModelerMan
Yeah, cubemaps are one of the things Irrlicht really needs.

Re: Irrlicht with cubemap support

Posted: Thu Sep 29, 2011 11:14 am
by elvman
Fixed problems with OpenGL and merged with the newest SVN version of Irrlicht.

Re: Irrlicht with cubemap support

Posted: Thu Sep 29, 2011 1:13 pm
by Virion
sounds cool. looking forward to this :D

Re: Irrlicht with cubemap support

Posted: Thu Sep 29, 2011 9:39 pm
by hybrid
Looks nice so far. Could you please check if the loads of memcpy statements (and other code there) for pixel copying can be replaced with a single code to the color conversion method that Irrlicht provides?! This would remove many switches and this huge code replication there.

Re: Irrlicht with cubemap support

Posted: Thu Sep 29, 2011 11:20 pm
by elvman
hybrid wrote:Looks nice so far. Could you please check if the loads of memcpy statements (and other code there) for pixel copying can be replaced with a single code to the color conversion method that Irrlicht provides?! This would remove many switches and this huge code replication there.
Yes, already did that for OpenGL (uploaded new version about hour ago), now have to do the same for Direct3D9. There are still some problems with Direct3D9, which I will fix tomorrow.

Are there any chances, that this patch will go into core?

Re: Irrlicht with cubemap support

Posted: Fri Sep 30, 2011 12:53 am
by 3DModelerMan
Yeah. This patch should go into the core. If we go with this one, then the future texture system changes (1D and 3D textures) would end up getting added later too right? Also, another texturing feature I think would be nice is to have a texture creation flag for compressed textures.

Re: Irrlicht with cubemap support

Posted: Fri Sep 30, 2011 8:54 am
by elvman
Yes, 1D and 3D textures will be added in a week. Haven't used compressed textures, so have to check out how easy it is to implement them in Irrlicht.

Re: Irrlicht with cubemap support

Posted: Fri Sep 30, 2011 10:30 am
by hybrid
Please keep the patches separated (if you approach 3d textures or anything), as it will make things easier for me. I need to check how the API changes and how these textures integrate into the whole engine, but chances are rather good.

Re: Irrlicht with cubemap support

Posted: Fri Sep 30, 2011 2:48 pm
by elvman
Fixed some problems with Direct3D9 (now it doesn't crash), but still it doesn't work as desired.
Removed Texture1D and Texture3D files from patch.

Re: Irrlicht with cubemap support

Posted: Sat Oct 01, 2011 11:58 am
by Nadro
I hope it will be integrated with Irrlicht core as soon as possible, because cube maps and 3d textures are very useful for Direct3D9 or OpenGL 2.1 or less. The best option is of course support for texture arrays, but it require Direct3D10 or OpenGL 3.0.

Re: Irrlicht with cubemap support

Posted: Sun Oct 02, 2011 9:39 am
by elvman
Upload the new version of the patch. Can somebody please look at it, I spent 20 hours fixing the code, but still the sapmlerCUBE does not work in HLSL. I can not find bugs in my own code, so it would be nice if somebody could help me.

Thanks!

Re: Irrlicht with cubemap support

Posted: Sun Oct 02, 2011 1:57 pm
by hybrid
Oh, btw. Could you please also create a little demo app which shows the cubemap being used? This would help to assess the code as well as make sure that there are no problems after integration.

Re: Irrlicht with cubemap support

Posted: Sun Oct 02, 2011 11:09 pm
by elvman
Created a test project, which works both on Irrlicht and Direct3D9 (don't know why it didn't work in my other sample project). So I guess we can consider this patch working.
CubemapTest.zip

Edit: Now I understand why it didn't work. It was because I didn't use one of the textures before it anywhere in the shader, so it wasn't compiled in it and the cube texture moved one level upwards.