XEffects - Reloaded - New Release (V 1.4)
It's most likely a driver bug, does it happen in both OpenGL and D3D?
If it only happens in one of them then that's most likely the case.
If it only happens in one of them then that's most likely the case.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
It happens both in d3d9 and ogl... but it might be a problem with my graphic card
if someone could try this and tell me if he has the problem i do: http://www.edisk.sk/stahni/70733/Releas ... .34MB.html
thanks in advance
if someone could try this and tell me if he has the problem i do: http://www.edisk.sk/stahni/70733/Releas ... .34MB.html
thanks in advance
Yeah it's happening for me, can you post the source code of the entire application or a smaller working testcase so I can find the problem?
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Here it is:
Code: Select all
#include <irrlicht.h>
#include <iostream>
#include <XEffects.h>
#include <CShaderPre.cpp>
#include <EffectHandler.cpp>
using namespace std;
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
const float pi = 22.0/7.0; //pretty useful, you know?
int daytime= 60*6; //this is 360 minutes after midnight
const int gameMinsPerMin= 60*24;
int main()
{
//E_DRIVER_TYPE driverType = EDT_OPENGL;//default is opengl - any problems?
IrrlichtDevice *device =
createDevice(EDT_OPENGL, dimension2d<u32>(1024, 768), 16, true, true, true, 0);//fullscreen, shadows, some kind of sync, unknown value
if (!device)
return 1;
device->setWindowCaption(L"3DGame");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
driver->setTextureCreationFlag(ETCF_ALWAYS_32_BIT, true);
//-----COOL FONT--------------------------------------------------------
stringw text= L"Arrows to move\nAlt+F4 to exit\n\nGame mins per min: ";
text += gameMinsPerMin;
guienv->addStaticText(text.c_str(),
rect<s32>(10,10,120,50), true);
//-----CAMERA-------------------------------------------------------------
ICameraSceneNode* camera =smgr->addCameraSceneNodeFPS(0, //parent
60, //rotatespeed
0.04,//movespeed
-1, //id
0, //keymap array
0, //keyMapSize
true, //noVerticalMovement
3.0f, //jumpSpeed
false); //invertMouse
camera->setPosition(vector3df(0,160,0));
camera->setFarValue(100000);
device->getCursorControl()->setVisible(false);
//-----LEVEL LOADING------------------------------------------------------
if(smgr->loadScene("./data/levels/test2/Scene.irr")==false) device->drop();
EffectHandler* effect = new EffectHandler(device, driver->getScreenSize(), false, false);
effect->setAmbientColor(SColor(255, 32, 32, 32));
effect->setClearColour(SColor(255, 50, 50, 100));
IMetaTriangleSelector * meta = smgr->createMetaTriangleSelector();
array<ISceneNode *> nodes;
smgr->getSceneNodesFromType(ESNT_ANY, nodes); // Find all nodes
for (u32 i=0; i < nodes.size(); ++i)
{
ISceneNode * node = nodes[i];
node->setMaterialFlag(EMF_BACK_FACE_CULLING, false);
//---DYNAMIC SHADOWS---------
node->getMaterial(0).Lighting = false;
E_FILTER_TYPE filterType = (E_FILTER_TYPE)clamp<u32>((u32)1 - '1', 0, 4);
effect->addShadowToNode(node, filterType, ESM_BOTH);
ITriangleSelector * selector = 0;
switch(node->getType())
{
case ESNT_CUBE:
case ESNT_ANIMATED_MESH:
selector = smgr->createTriangleSelector(((IAnimatedMeshSceneNode*)node)->getMesh(), node);
break;
case ESNT_MESH:
selector = smgr->createTriangleSelector(((IMeshSceneNode*)node)->getMesh(), node);
break;
case ESNT_SPHERE: // Derived from IMeshSceneNode
selector = smgr->createTriangleSelector(((IMeshSceneNode*)node)->getMesh(), node);
break;
case ESNT_TERRAIN:
selector = smgr->createTerrainTriangleSelector((scene::ITerrainSceneNode*)node);
break;
case ESNT_OCT_TREE:
selector = smgr->createOctTreeTriangleSelector(((scene::IMeshSceneNode*)node)->getMesh(), node);
break;
default:
break;
}
if(selector)
{
meta->addTriangleSelector(selector);
selector->drop();
}
}
ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(meta, camera, vector3df(5,5,5), vector3df(0,-10,0), vector3df(0,5,0));
meta->drop();
camera->addAnimator(anim);
anim->drop();
//-----SUN---------------------------------...staring into the shining sun
/*ISceneNode* sun = 0;
sun = smgr->addLightSceneNode(0, vector3df(0,0,0),SColorf(.9f, .7f, .7f, .9f), 1000000.0f);//akoze slnko
ISceneNodeAnimator* sunAnim = 0;
sunAnim = smgr->createFlyCircleAnimator (vector3df(0,0,0), //center
500, //radius = 100.f,
(((((((2*pi)/24))/1000)/60)/60)*gameMinsPerMin), //speed = 0.001f,
vector3df(1.f, 0.f, 0.f), //direction = vector3df(0.f, 1.f, 0.f),
0, //startPosition = 0.f,
0); //radiusEllipsoid = 0.f
sun->addAnimator(sunAnim);
sunAnim->drop();
sun = smgr->addBillboardSceneNode(sun, dimension2d<f32>(25, 25));
sun->setMaterialFlag(EMF_LIGHTING, false);
sun->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
sun->setMaterialTexture(0, driver->getTexture("./data/textures/sun.bmp"));*/
effect->addShadowLight(SShadowLight(4096, vector3df(100, 100, 100), vector3df(0, 0, 0), //real sun
SColor(0, 200, 150, 150), 0.0f, 1000.0f, 89.9f * DEGTORAD));
//-----MAIN LOOP---------------------------------------------------------
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));
guienv->drawAll();
effect->update();
driver->endScene();
}
device->drop();
return 0;
}
Ok the problem is very simple. You are adding a shadow to the camera scene node and this is screwing everything up.
In your loop you need to check it with:
Cheers
In your loop you need to check it with:
Code: Select all
if(node->getType() == ESNT_CAMERA)
continue;
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
Hi, Blindside.
Not looked much the SDK yet, excuse me if the feature already exist.
Is there a way to change (once created) the shadow node parameter set on a model?
Parameter I would like to change:
- Refresh interval (calculation of the shadow)
- Lightmap resolution
I would like to have multiple lights in a scene and would like to "try" to control the light setup based on the distance. Being able to change theses parameter on the shadow nodes will solve a lot of troubles, and I will surely gain a lot of performance. (Because I'm mostly lazy! )
Not looked much the SDK yet, excuse me if the feature already exist.
Is there a way to change (once created) the shadow node parameter set on a model?
Parameter I would like to change:
- Refresh interval (calculation of the shadow)
- Lightmap resolution
I would like to have multiple lights in a scene and would like to "try" to control the light setup based on the distance. Being able to change theses parameter on the shadow nodes will solve a lot of troubles, and I will surely gain a lot of performance. (Because I'm mostly lazy! )
You can change the shadowmap resultion with
effect->getShadowLight(light).setShadowMapResolution(irr:u32)
im not sure if this is what you want?
If you'r using some better IDE then it is really very easy to learn what you can do with the light once created by writing effect->getShadowLight(light). and all possibilities will pop up
How about destroying the shadowlight? is there no way?
effect->getShadowLight(light).setShadowMapResolution(irr:u32)
im not sure if this is what you want?
If you'r using some better IDE then it is really very easy to learn what you can do with the light once created by writing effect->getShadowLight(light). and all possibilities will pop up
How about destroying the shadowlight? is there no way?
Yes I think there is no way at the moment. I was going to add it in the previous release but I realised the design of XEffects didn't make it easy to retrieve and manipulate shadow lights. Instead you will have to wait until shadows are integrated in Irrlicht for easy manipulation of shadows using the famliar ILightSceneNode and SLightData interfaces.ent1ty wrote:How about destroying the shadowlight? is there no way?
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Thanks but that's ok I can certainly make them optional..BlindSide wrote:@xDan and 3DModellerman: Most effects aren't supported on SM 2.0 cards. The most you'll get is standard shadow mapping without any filtering. If using this in an application I recommend that you have these effects optional and only enable them when the graphics card can run them. xDan if you pay for shipping I can send you my old AGP Geforce 6200 which can run all the effects but its a bit slow and old.
Hopefully in Irrlicht 1.7ent1ty wrote:Too bad I could save 5 fps in night and another 5 when flashlight turned off. Is there any chance of adding this soon?
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact: