Hex terrain editor [updated]

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Hi, Elvman.

Do you know if you could apply theses technique to MESHES and not only terrains?

I've been demoed the Editor UBISOFT use right now to create levels for FAR CRY 2 using their own engine (Dunia Engine). And they utilize a similar technique to texture everything (Characters, Objects, Terrain)

This permit to use very low textures (256x256), tiled them over the mesh, then brush them over to change the look of it (Like a mountain).

They showed me a good looking character, then zoomed on it... We could see the pores!! For environnement, that was also good, They used a brick texture, then put some other damaged look where they needed it. They also used it on vehicles to "paint" some rust. Using that method allow the engine to use very small textures and still get very good details. They call the "splatting" a mask picture.

I think you have just written the code that could allow to do the same. :D

Can you confirm that this can be done? If it can be done, then I would really like a feature like this could be added someday in IRRlicht.
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

Irrlicht has that material under detail mapping, its a very simple trick.
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

Nice Job! Well done.
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
monkeycracks
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:

Post by monkeycracks »

Great work, can't wait until the save feature is complete.
GrigoriosSokratis
Posts: 34
Joined: Wed Apr 25, 2007 3:48 am

Post by GrigoriosSokratis »

Hi, first I want to say you did a great work.

Now, I have a question. I'm working with a 4096x4096 ground 3ds mesh, and I want to apply some splatting to it. So, what I did, is to use your shaders manually, but I don't know how to implement it in the source code, that is, how can I set the respective textures in the code.

So this is roughly how my code looks like (but it doesn't work, it just shows the diffgrass textures, indexed as 0, without any effects at all):
c8* vsFileName = 0; // filename for the vertex shader
c8* psFileName = 0; // filename for the pixel shader

psFileName = "Terrain_ps.hlsl";
vsFileName = "Terrain_vs.hlsl";

IGPUProgrammingServices* gpu = driver->getGPUProgrammingServices();

s32 newMaterialType1 = 0;

if (gpu)
{
MyShaderCallBack* mc = new MyShaderCallBack();
newMaterialType1 = gpu->addHighLevelShaderMaterialFromFiles(vsFileName, "Main", EVST_VS_1_1, psFileName, "Main", EPST_PS_1_1, mc, EMT_SOLID_2_LAYER);
mc->drop();
}

meshy = smgr->getMesh("Terrain_3.3ds")->getMesh(0);
nody = smgr->addMeshSceneNode(meshy);

nody->setMaterialTexture( 0, driver->getTexture("diffgrass1.bmp") );
nody->setMaterialTexture( 1, driver->getTexture("diffgrass2.bmp") );
nody->setMaterialTexture( 2, driver->getTexture("test_coverage.bmp") );
nody->setMaterialTexture( 3, driver->getTexture("test_lightmap.bmp") );

nody->setMaterialType((E_MATERIAL_TYPE)newMaterialType1);
I will really appreciate any help provided in order to make the splatting effect work in my mesh.

Thank you in advance.
Last edited by GrigoriosSokratis on Tue Jan 15, 2008 3:51 pm, edited 1 time in total.
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

c8* vsFileName = 0; // filename for the vertex shader
c8* psFileName = 0; // filename for the pixel shader

psFileName = "Terrain_ps.hlsl";
vsFileName = "Terrain_vs.hlsl";
Why in the world do you initialize to 0 then set them to something else without making any checks of any kind first? Might as well initialize them properly...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

It's just a pointer assignment, so no real peformance loss. And the second string might move somewhere else, or being constructed somehow in the future. It's always good to have pointers initialized to some default.
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

gah! the "might move somewhere else" IS the bad part. WHY would you want to split the creation and initialization of objects? Those should be done at the same time as much as possible and be linked together to avoid having uninitialized objects laying around. Furthermore, little cost is bigger than no cost and the pratice in itself is something that should be avoided. Hence, there is no advantages, only down sides to his method.

If he did a check that the file existed first, then yes, it'd be a completelly different matter, but that's not what he does...
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Post by elvman »

I will release the source of the editor, but it would be nice if somebody continued the work on the editor (because of work and school, I don' t have time to do it myself).
GrigoriosSokratis
Posts: 34
Joined: Wed Apr 25, 2007 3:48 am

Post by GrigoriosSokratis »

Hi elvman, thank you I will really appreciate if you do that since it's really important to me, to get this splatting effect working in my project.
GrigoriosSokratis
Posts: 34
Joined: Wed Apr 25, 2007 3:48 am

Post by GrigoriosSokratis »

Hi Elvman, until you release the source code, in the meanwhile is there any possibility of you pasting here the part that loads the texture files, or just telling me how to do it in order to get them splatted or just correcting my code in the following parts?
newMaterialType1 = gpu->addHighLevelShaderMaterialFromFiles(vsFileName, "Main", EVST_VS_1_1, psFileName, "Main", EPST_PS_1_1, mc, EMT_SOLID_2_LAYER);
nody->setMaterialTexture( 0, driver->getTexture("diffgrass1.bmp") );
nody->setMaterialTexture( 1, driver->getTexture("diffgrass2.bmp") );
nody->setMaterialTexture( 2, driver->getTexture("test_coverage.bmp") );
nody->setMaterialTexture( 3, driver->getTexture("test_lightmap.bmp") );
Any help will be appreciated again thank you for your efforts.
GrigoriosSokratis
Posts: 34
Joined: Wed Apr 25, 2007 3:48 am

Post by GrigoriosSokratis »

Any help please? like for example what kind of material should I use, I've tried everything but nothing works out unfortunately.

Thank you
sp00n
Posts: 114
Joined: Wed Sep 13, 2006 9:39 am

Post by sp00n »

elvman wrote:I will leave it up to users' choice whether to use Shaders 1.1 (2 splatting layers) or Shaders 2.0 (6 splatting layers).
GrigoriosSokratis may be reason is you're using shaders 1.1 (you're using in your code 4 layers for material, no 2)
but may be i'm wrong 'cause only start to learn shaders:)
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

omaremad wrote:Irrlicht has that material under detail mapping, its a very simple trick.
i need to know how that is done.

thanks for mentioning it.

i'm currently studying the opengl redbook with a buddy of mine, it sounds like it falls under texture blending, which means i need to know exactly the enums used to implement it.
Image
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

The only thing we'll need is a plugins for IRRedit to use that as a node. And some code to create the node based on the XML file.

Nice work for the lightmapping calculation done there!
Post Reply