Posted: Mon Nov 30, 2009 11:44 pm
This is exciting news Blindside ! I cant wait to see it.
Official forum of the Irrlicht Engine
https://irrlicht.sourceforge.io/forum/
Code: Select all
rory@macrohard:~/Programming/XEffects/Bin$ ./Example1
Welcome to the X-Platform Effect Wrapper Demo
Please select the driver type:
1 - OpenGL
2 - Direct3D9
1
Please select the ShadowMap resolution:
1 - 512x512
2 - 1024x1024
3 - 2048x2048
4 - 4096x4096
1
Please select the ShadowMap filtering:
1 - none
2 - 4 PCF
3 - 8 PCF
4 - 12 PCF
5 - 16 PCF
1
Irrlicht Engine version 1.6
Linux 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:05:01 UTC 2009 x86_64
Creating X window...
Visual chosen: : 39
Using renderer: OpenGL 2.1.2
GeForce 7050 PV / nForce 630a/PCI/SSE2: NVIDIA Corporation
OpenGL driver version is 1.2 or better.
GLSL version: 1.2
<580 lines of various loading messages>
Could not open file of texture: XEFFECTS_SM_512
XEffects: Please ignore previous warning, it is harmless.
FBO has one or several incomplete image attachments
FBO error
FBO incomplete
Could not open file of texture: XEFFECTS_SM_512
XEffects: Please ignore previous warning, it is harmless.
Segmentation fault
rory@macrohard:~/Programming/XEffects/Bin$
Code: Select all
for(u32 i = 0;i < ShadowNodeArraySize;++i)
{
if(ShadowNodeArray[i].shadowMode == ESM_RECEIVE || ShadowNodeArray[i].shadowMode == ESM_EXCLUDE)
continue;
const u32 CurrentMaterialCount = ShadowNodeArray[i].node->getMaterialCount();
core::array<irr::s32> BufferMaterialList(CurrentMaterialCount);
BufferMaterialList.set_used(0);
for(u32 m = 0;m < CurrentMaterialCount;++m)
{
BufferMaterialList.push_back(ShadowNodeArray[i].node->getMaterial(m).MaterialType);
ShadowNodeArray[i].node->getMaterial(m).MaterialType = (E_MATERIAL_TYPE)
(BufferMaterialList[m] == video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF ? DepthT : Depth);
}
ShadowNodeArray[i].node->OnAnimate(device->getTimer()->getTime());
ShadowNodeArray[i].node->render();
const u32 BufferMaterialListSize = BufferMaterialList.size();
for(u32 m = 0;m < BufferMaterialListSize;++m)
ShadowNodeArray[i].node->getMaterial(m).MaterialType = (E_MATERIAL_TYPE)BufferMaterialList[m];
}
Code: Select all
for(u32 i=0; i<meshArray.size(); ++i)
{
pVideo->setTransform(ETS_WORLD,meshArray[i]->getAbsoluteTransformation());
pVideo->setMaterial(depthMat);
for(u32 j=0; j<meshArray[i]->getMaterialCount(); ++j)
pVideo->drawMeshBuffer(meshArray[i]->getMesh()->getMeshBuffer(j));
}
XEffects doesn't support point lights, Example 2 is just showing it can be done to an extent, but I don't recommend actually doing it that way. I'm guessing this is some sort of space game if you can get that close to the sun, otherwise if it is terrain-based you should definitely use a directional light for your shadows. Sun != point, Sun == directional because of it's enormous size in comparison to the earth.Insomniacp wrote:I set the far value for a point light to a large number so it would act more like a sun but it then does not work well on shadows close by for some reason. Is there a way to change this so it works well in both instances, far away and near by with a large far value? A work around I was thinking of doing was making a point light near by the character to make the close by shadows look like they should then just have a spot light at 180 degrees up high to light up the rest of the map and give some shadows to it. Though I prefer having as few lights as possible since they do make an impact on the fps. Let me know if I am doing anything wrong, I copied most code from the point light example. Just changed the far value and made the light stationary for now.
EDIT:
Another thing I was wondering was why it increased my primitive count by 400,000. That may be normal I am just not quite sure why that happens. Without xeffects it is at 40,000 normally.
Ah but that will only work for Mesh/AnimatedMesh scene nodes.Possible code for depth pass:
I'm not sure what you mean by this, when I have time I will look at your code to see the difference.Instead of calculating all in render targets, calculating only the shadow and I make one pass, so you can use any material, whether sphere mapping, normal mapping or whatever.
Is trueAh but that will only work for Mesh/AnimatedMesh scene nodes.
Just as this is achieved more quality. To my way get all the shadows are the same color, can be a problem if you want to get realistic shadows. It would be an alternative....an additive lighting effect...
I was watching a tutorial as creating points light with shadow maps.XEffects doesn't support point lights...