Irrlicht with cubemap support

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Irrlicht with cubemap support

Post 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
Last edited by elvman on Mon Oct 03, 2011 12:45 pm, edited 6 times in total.
Ouzel – 2D game engine
Realistic water node
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Irrlicht with cubemap support

Post 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.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Re: Irrlicht with cubemap support

Post by 3DModelerMan »

Yeah, cubemaps are one of the things Irrlicht really needs.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Re: Irrlicht with cubemap support

Post by elvman »

Fixed problems with OpenGL and merged with the newest SVN version of Irrlicht.
Ouzel – 2D game engine
Realistic water node
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Re: Irrlicht with cubemap support

Post by Virion »

sounds cool. looking forward to this :D
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Irrlicht with cubemap support

Post 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.
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Re: Irrlicht with cubemap support

Post 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?
Ouzel – 2D game engine
Realistic water node
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Re: Irrlicht with cubemap support

Post 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.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Re: Irrlicht with cubemap support

Post 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.
Ouzel – 2D game engine
Realistic water node
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Irrlicht with cubemap support

Post 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.
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Re: Irrlicht with cubemap support

Post 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.
Ouzel – 2D game engine
Realistic water node
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Irrlicht with cubemap support

Post 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.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Re: Irrlicht with cubemap support

Post 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!
Ouzel – 2D game engine
Realistic water node
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Irrlicht with cubemap support

Post 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.
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Re: Irrlicht with cubemap support

Post 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.
Last edited by elvman on Mon Oct 03, 2011 9:47 pm, edited 1 time in total.
Ouzel – 2D game engine
Realistic water node
Post Reply