Problems with XEffects and DirectX 9
Problems with XEffects and DirectX 9
Hallo
I have tried using the xeffects package to add shadowing to my scene and it won't work with DirectX 9. When using OpenGL it works fine. I am currently using Irrlicht 1.4.2. The problem seems to be the creation of the shadowmap texture :
ShadowMapTex = driver->createRenderTargetTexture(mapSize);
I am in a windowed application and when calling
driver->OnResize(Size);
it fails resetting the DirectX device.
What do I need to do to get this working?
Regards
Anton Heymann
I have tried using the xeffects package to add shadowing to my scene and it won't work with DirectX 9. When using OpenGL it works fine. I am currently using Irrlicht 1.4.2. The problem seems to be the creation of the shadowmap texture :
ShadowMapTex = driver->createRenderTargetTexture(mapSize);
I am in a windowed application and when calling
driver->OnResize(Size);
it fails resetting the DirectX device.
What do I need to do to get this working?
Regards
Anton Heymann
I have downloaded the latest SVN trunk for 1.5 and I am now trying to convert my code to use it. Getting lots of problems :
Maybe you can help here. In 1.4.2 'mode' I need to traverse the children of a lightscenenode with billboards attached. I use the following code snippet :
This works fine. In 1.5. trunk I cannot convert (*it) to a IBillboardSceneNode) - how do I access the members of *it?
Thanks
Anton
Maybe you can help here. In 1.4.2 'mode' I need to traverse the children of a lightscenenode with billboards attached. I use the following code snippet :
Code: Select all
core::list<ISceneNode *>::ConstIterator it;
vector3df pos = pCamera->getPosition();
ILightSceneNode *pLight;
IBillboardSceneNode *pNode;
LookAt->setSize(Size * LookAt->getPosition().getDistanceFrom(pos) * A1_SIZE);
Size.set(35,35);
for (Pos = m_Lights.GetHeadPosition(); Pos;)
{
Light = (LIGHTSOURCEPTR) m_Lights.GetNext(Pos);
pLight = Light->pIRRLight;
it = pLight->getChildren().begin();
if (*it)
{
pNode = (IBillboardSceneNode *) (*it);
pNode->setSize(Size * pLight->getPosition().getDistanceFrom(pos) * A1_SIZE);
}
}
Thanks
Anton
I have managed to recompile a version based on current trunk. The SDK version is still set to 1.4.2 (which had me confused for a while). Running my sample app, with the 1.5. version, still made no difference. Using Blindsides effect wrapper, I still get problems when a resize is called :
Reset of device failed.
I am using the following code to start blindside's effectwrapper
In the code, the line
is where the problem is. Any advice on this will REALLY be appreciated.
Thanks
Anton[/url]
Reset of device failed.
I am using the following code to start blindside's effectwrapper
Code: Select all
dimension2d<s32> shadowDimen = dimension2d<s32>(512,512);
E_FILTER_TYPE filterType = EFT_4PCF;
dimension2d<s32> ScreenRTT = dimension2d<s32>(512,512);
effects = new effectHandler(pDevice,shadowDimen,(stringc) (LPCTSTR) MediaFolder,ScreenRTT);
Code: Select all
ShadowMapTex = driver->createRenderTargetTexture(mapSize);
Thanks
Anton[/url]
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
I was pretty confused about the "invalid command" return value which is delivered by reset() in the d3d drivers. But I guess it should work if you just release all RTT HW textures (not dropping them, but only releasing the d3d specific surfaces). Then reset and reallocate the surfaces. At least that's my plan (in order to avoid pointer corruption in materials etc).
If someone could implement this it would make things much faster, I can only finish it end of october or even later.
If someone could implement this it would make things much faster, I can only finish it end of october or even later.
Hybrid
Sorry, can you be more specific. Is there anything I can do with 1.5. trunk as it is to overcome this problem. I really want to use DirectX as the speed does seem to be better than OpenGL and there are problems with lights is OpenGL as well. As I said, there appears to be patches going around, which does fix the problems. I took the OnResize out and of course it now works, but the resolution is very poor.
Thanks
Anton
Sorry, can you be more specific. Is there anything I can do with 1.5. trunk as it is to overcome this problem. I really want to use DirectX as the speed does seem to be better than OpenGL and there are problems with lights is OpenGL as well. As I said, there appears to be patches going around, which does fix the problems. I took the OnResize out and of course it now works, but the resolution is very poor.
Thanks
Anton
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
No, there are no patches. You can simply drop the textures and remove it from texture cache, then reset. Make sure that all materials using the RTT will afterwards use the newly created RTT instead of the old, deleted pointer. But that's a purely application based solution, so a version integrated into the engine needs to do this stuff a little different...
I think I can provide a work around in the wrapper. Yoran has already figured something out, so I'll try and incorporate his ideas in the next release. Basically it just checks if beginScene fails and recreates the rendertargets if thats so.
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
Blindside. Do you mind sharing that information now. I am desperately trying to add shadows into my scene in DX mode.
Hybvrid - how do I delete a texture from the cache (how do I access the texture cache?). I used removeTexture, which the documentation says does delete the texture from the cache as well. Still no luck with the OnResize (reset) in DX mode.
I also called removeAllTextures() before the resize and the reset still failed :
Resetting D3D9 device.
Resetting failed due to invalid call.
Anton
Hybvrid - how do I delete a texture from the cache (how do I access the texture cache?). I used removeTexture, which the documentation says does delete the texture from the cache as well. Still no luck with the OnResize (reset) in DX mode.
I also called removeAllTextures() before the resize and the reset still failed :
Resetting D3D9 device.
Resetting failed due to invalid call.
Anton