Texture splatting: edit in realtime (and what about fog?)

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Texture splatting: edit in realtime (and what about fog?

Post by suliman »

Its a shame such functionality doesnt exist. Not only would it be easier to edit. Its also easier to save/load and hide it from users (picture files will tell alot about the upcoming missions in a campaign for example which destroys some of the magic). I could just save one single binary file for each map/scenario.
To be clear: i dont need/want a texture at all. I just wanna splatt my textures using normal data instead of texture data (to tell the shader where to put what on the terrain).

But this seems to be impossible right?
E
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Texture splatting: edit in realtime (and what about fog?

Post by suliman »

Also i try to change this line in irrlicht-1.7.2\include\IrrCompileConfig.h:

Code: Select all

//! Maximum number of texture an SMaterial can have, up to 8 are supported by Irrlicht.
#define _IRR_MATERIAL_MAX_TEXTURES_ 4
to allow 8 textures on one material. But this crashes when i change it with
Unhandled exception at 0x100b6585 in TerrainSplating_DX.exe: 0xC0000005: Access violation reading location 0x00000018.

I guess i have to rebuild dll and libs and all, but i dont now really how to do that... Do i need complete rebuild? I cannot just change that line right? Also if i did get that to work i could have 7 instead of 3 textures on my terrain or am I wrong?
Thanks again
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Texture splatting: edit in realtime (and what about fog?

Post by mongoose7 »

You have to rebuild everything.

Can you use uniforms? If the "texture" just said "this is a path" and the uniform said "all paths are wet", wouldn't this do? Also, if you split the mesh up into smaller parts, you can set uniforms for one mesh independently from the other meshes.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Texture splatting: edit in realtime (and what about fog?

Post by hybrid »

mongoose7 wrote:There appears to be no function to create a texture from a memory buffer (even though OpenGL supports it).
Of course there is. Just create an IImage from the memory area, and pass this on to the texture creation.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Texture splatting: edit in realtime (and what about fog?

Post by mongoose7 »

Am I supposed to be looking at ITexture (const io::path &name)?
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Texture splatting: edit in realtime (and what about fog?

Post by suliman »

is there any project i can build that would rebuild lib and dll without me needing to fix all that by myself? I mean open a project, change the code i wanna change and build?

Also, if i use 8 textures on one material, how would i control the splatting? Do i need deeper color depth on my "control-texture?" (in my case the sample.jpg). This texture currently only has ARGB with 8 bits per channel as far as i understand.

Thanks for your input
Erik
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Texture splatting: edit in realtime (and what about fog?

Post by hybrid »

mongoose7 wrote:Am I supposed to be looking at ITexture (const io::path &name)?
I supppose you mean for the image from memory creation? The method is this one:

Code: Select all

 
virtual IImage* createImageFromData(ECOLOR_FORMAT format,
                        const core::dimension2d<u32>& size, void *data,
                        bool ownForeignMemory=false,
                        bool deleteMemory = true) =0;
 
Next you add the texture from the IImage and drop the iimage again.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Texture splatting: edit in realtime (and what about fog?

Post by mongoose7 »

Indulge me here, please. What is the function to convert an image to a texture? You wrote
Just create an IImage from the memory area, and pass this on to the texture creation
but the only texture creation function I could see was

Code: Select all

ITexture (const io::path &name)
which appears to take a filename as an argument. So, there appears to be something missing and I wonder if you you please fill in that gap. :)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Texture splatting: edit in realtime (and what about fog?

Post by hybrid »

You cannot use ITexture directly. You need to go through the video driver, which has addTexture(IImage,...)
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Texture splatting: edit in realtime (and what about fog?

Post by suliman »

regarding my questions anyone?

1. Is there any project that im supposed to rebuild to rebuild lib+dll directly?

2. If i change to 8 texture support for a material, how do i control the splatting of all 8 (actually 7)? Currently the image format is limited to ARGB and 8 bits per channel. Do i change to another image format to control all 7 textures when platting?

Thanks
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Texture splatting: edit in realtime (and what about fog?

Post by mongoose7 »

Go into the source/Irrlicht directory. There you will find a number of VS projects. Choose the highest one for your compiler, eg Irrlicht9.0.vcproj (VS 2008). You should be able to double click on it. If the version is older than your compiler, VS will offer to upgrade it. If you want to use DirectX, you will have to install the SDK, otherwise go into the IrrCompileConfig.h file in the include directory and comment out DirectX and DirectX joystick support - follow the instructions in the file.

You will have to do the work in your own shader. Therefore, there is no problem in passing two (or more) textures, giving you nine in all. Maybe you should just make a start with four, get something working, and then work out where to go to next. Should be easier when you have all that experience behind you.
Post Reply