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
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.
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.
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 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?
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.
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.
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.
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.
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.
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.