Irrlicht with cubemap support

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.

Irrlicht with cubemap support

Postby elvman » Wed Sep 28, 2011 5:59 pm

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

Re: Irrlicht with cubemap support

Postby hybrid » Wed Sep 28, 2011 9:19 pm

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.
hybrid
Admin
 
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany

Re: Irrlicht with cubemap support

Postby 3DModelerMan » Wed Sep 28, 2011 11:07 pm

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

My first full game:
http://www.kongregate.com/games/3DModelerMan/replicator#tipjar
User avatar
3DModelerMan
 
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Re: Irrlicht with cubemap support

Postby elvman » Thu Sep 29, 2011 11:14 am

Fixed problems with OpenGL and merged with the newest SVN version of Irrlicht.
Ouzel – 2D game engine
Realistic water node
elvman
 
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia

Re: Irrlicht with cubemap support

Postby Virion » Thu Sep 29, 2011 1:13 pm

sounds cool. looking forward to this :D
User avatar
Virion
Competition winner
 
Posts: 2141
Joined: Mon Dec 18, 2006 5:04 am

Re: Irrlicht with cubemap support

Postby hybrid » Thu Sep 29, 2011 9:39 pm

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.
hybrid
Admin
 
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany

Re: Irrlicht with cubemap support

Postby elvman » Thu Sep 29, 2011 11:20 pm

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

Re: Irrlicht with cubemap support

Postby 3DModelerMan » Fri Sep 30, 2011 12:53 am

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/3DModelerMan/replicator#tipjar
User avatar
3DModelerMan
 
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Re: Irrlicht with cubemap support

Postby elvman » Fri Sep 30, 2011 8:54 am

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

Re: Irrlicht with cubemap support

Postby hybrid » Fri Sep 30, 2011 10:30 am

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.
hybrid
Admin
 
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany

Re: Irrlicht with cubemap support

Postby elvman » Fri Sep 30, 2011 2:48 pm

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

Re: Irrlicht with cubemap support

Postby Nadro » Sat Oct 01, 2011 11:58 am

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.
Nadro
 
Posts: 1647
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Irrlicht with cubemap support

Postby elvman » Sun Oct 02, 2011 9:39 am

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

Re: Irrlicht with cubemap support

Postby hybrid » Sun Oct 02, 2011 1:57 pm

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.
hybrid
Admin
 
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany

Re: Irrlicht with cubemap support

Postby elvman » Sun Oct 02, 2011 11:09 pm

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

Next

Return to Open Discussion and Dev Announcements

Who is online

Users browsing this forum: No registered users and 1 guest