Hi, guys!
I've tried to use this effect pack, and ran into some serious problems:
1) It doesn't work with Direct 3d on my machine at all (black screen, or lots of artifacts, or e.t.c.).
2) When working I've experienced that I can not make it work with pre-lightmapped surfaces (using OpenGL, as it doesn't work with D3d in my case)!
As OpenGL is even better for my project anyway, let's focus on the origins of the second problem.
I'm using a custom 3dWS level loader, which loads pre-built lightmaps, generated by the 3d World Studio software.
My loader loads lightmaps with EMT_LIGHTMAP_M4 flag, to make the last brighter (or the maps appears too dark). Obviously this doesn't work with this effect pack as it should, so I've got something like my map with EMT_SOLID all the way (shadows applied, thou), which looks like this:
Ok, I've got shadows, that's pretty cool, by where is my lightmap?
I've changed to darker "EMT_LIGHTMAP" (without M4) to see if it'll work.
But whilst using Irrlicht 1.3.1 (the code of the effects is easily downgradeable for that version of IrrLicht) I've got this as a result:
Lots of ugly squares in the place where a lightmap used to be.
And this, whilst using IrrLicht 1.4.1 (had to port over my entire code, which isn't easy):
Much better than the squares, but still this isn't the lightmap!
This is something else.
The real lightmap for the area looks like this (shadow effect code is disabled for this screenshot):
And here are some important marks:
As you can see, there should be a pre-generated tree shadow, and a major (again, pre-rendered) light source nearby. None of which appeared on the upper screenshots.
I've started digging into the code in order to find the source of the problem, and I've found this:
Code: Select all
if(shadowNodeArray[i].materialTypes[0] == EMT_DETAIL_MAP || shadowNodeArray[i].materialTypes[0] == EMT_LIGHTMAP)
{
switch(shadowNodeArray[i].filterType)
{
case EFT_NONE:
shadowNodeArray[i].node->setMaterialType((E_MATERIAL_TYPE)Detail);
break;
and this:
Code: Select all
sPP->addShaderDefine("SAMPLE_AMOUNT",1);
Detail = gpu->addHighLevelShaderMaterial(
sPP->ppShaderFF(SDFNV).c_str(), "vertexMain", video::EVST_VS_2_0,
sPP->ppShaderFF(SDFNP).c_str(), "pixelMain", video::EPST_PS_2_0,
mc1, video::EMT_DETAIL_MAP);
which effectively means, that, my material's type was effectively changed from EMT_LIGHTMAP into EMT_DETAIL_MAP-based type, which is incorrect by the definition of it (just how is the engine supposed to know, that there is a lightmap, then?).
So, I did some more digging and found out that this wasn't the true source of the problem.
I've changed the upper code to:
Code: Select all
sPP->addShaderDefine("SAMPLE_AMOUNT",1);
Detail = gpu->addHighLevelShaderMaterial(
sPP->ppShaderFF(SDFNV).c_str(), "vertexMain", video::EVST_VS_2_0,
sPP->ppShaderFF(SDFNP).c_str(), "pixelMain", video::EPST_PS_2_0,
mc1, video::EMT_LIGHTMAP);
And...
Guess what!
The result was the same as on picture 3!
Still no correct lightmap, just some random dark places instead.
I've read this topic, and saw a guy, who had similar problem.
The post was written by elvman and appears on page 7 of this topic.
So, can IrrLicht really mix material types, or not?
Because, in fact, I wanted to add parallax mapping and those nice shadows on top of it, so that question is the main here
Can anyone tell me how to get those shadows work with real lightmaps?
It would be very appreciated!
Thanks in advance!
Awesome work on the effects, b.t.w.