XEffects - (Indoor Soft-Shadows + Post-Processing)
Thanks Halan, the only obvious change I can see (regarding the material types) is the switch for 1 or 2 layers.
I already fixed the material type in that struct into an array, and made a whole new system for defining recievers/casters etc.
I'll improve support for transparent materials (Your version still uses EMT_SOLID as the base material so it wont work on transparent objects), and then make a new release.
PS: Its a bit messy to quote the whole thing, could you use pastebin or upload a file next time?
Cheers
I already fixed the material type in that struct into an array, and made a whole new system for defining recievers/casters etc.
I'll improve support for transparent materials (Your version still uses EMT_SOLID as the base material so it wont work on transparent objects), and then make a new release.
PS: Its a bit messy to quote the whole thing, could you use pastebin or upload a file next time?
Cheers
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
You have to position the camera correctly and set the far value appropriately. If you don't know why, I recommend you google Shadow Maps and read a decent faq.
On another note: Please PM me for inquiries people, theres no use clogging up the announcements forum.
On another note: Please PM me for inquiries people, theres no use clogging up the announcements forum.
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
I get identical results for both OpenGL and Direct3D, what video card are you running and also what operating system?
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
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
Finally got time to test XEffects. The problem is that I didn't manage it to work. Here is the code:
And here is what I get:
On the left you can see the shadow texture, and on the right: the final rendering.
Plus I have some suggestions:
* You should add a way to pass custom scene manager to effectHandler, because not always Irrlicht users (like me) use default scene manager. It took me about an hour to figure this out (light camera was rendering nothing).
* You should replace std::cout with device->getLogger()->log
* You should allow to select a custom shaders folder. For example, I have a seperate system folder with all the exes and dlls, media, shaders etc. is located at the same level as system, so I had to add "../" to effectHandler.
*You have a this code in effectHandler.cpp:
You should reset the previous mip map creation state
* And I suggest renaming AddShadowToSceneNode to ReceiveShadows or something like that.
Code: Select all
gEffect = new effectHandler(gIrrlichtDevice,mSceneManager,dimension2d<s32>(512,512));
gEffect->getLightCamera()->addAnimator(mSceneManager->createFlyCircleAnimator(vector3df(0,20,12),30,0.001f));
gEffect->getLightCamera()->setPosition(vector3df(3,8,3));
gEffect->getLightCamera()->setNearValue(1);
gEffect->setMaxShadowDistanceFromLight(200);
mSceneManager->addLightSceneNode(gEffect->getLightCamera());
gEffect->setShadowDarkness(1.0f);
gEffect->setClearColour(SColor(255,250,255,255));
mTerrain = sceneManager->addTerrainSceneNode("../media/heightmap.bmp", 0, -1, position);
mTerrain->setMaterialTexture(0, gVideoDriver->getTexture("../media/newplank.png"));
mTerrain->setMaterialType(EMT_LIGHTMAP);
gEffect->addShadowToNode(mTerrain,EFT_8PCF);
IAnimatedMeshSceneNode* table = sceneManager->addAnimatedMeshSceneNode(sceneManager->getMesh("../meshes/table.x"));
table->setAutomaticCulling(EAC_FRUSTUM_BOX);
table->setMaterialType(EMT_SOLID);
gEffect->addNodeToDepthPass(table);
On the left you can see the shadow texture, and on the right: the final rendering.
Plus I have some suggestions:
* You should add a way to pass custom scene manager to effectHandler, because not always Irrlicht users (like me) use default scene manager. It took me about an hour to figure this out (light camera was rendering nothing).
* You should replace std::cout with device->getLogger()->log
* You should allow to select a custom shaders folder. For example, I have a seperate system folder with all the exes and dlls, media, shaders etc. is located at the same level as system, so I had to add "../" to effectHandler.
*You have a this code in effectHandler.cpp:
Code: Select all
driver->setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, false);
ShadowMapTex = driver->createRenderTargetTexture(mapSize);
driver->setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, true);
* And I suggest renaming AddShadowToSceneNode to ReceiveShadows or something like that.
Thank you for the suggestions
I can't see any obvious problem except you are doing "DETAIL_MAP" material but without a detail texture! This will result in a black colour because the first texture is multiplied by 0 (It is not signed-add like it should be, I might change that.) Set a second texture, or use EMT_SOLID (You must set the material before adding the shadow). Also try disabling the lighting on the terrain and check the results, but I doubt that would make too much of a difference.The problem is that I didn't manage it to work.
Actually I have recently changed the wrapper to render the scene nodes independently using node->render(). (And I might change it again to driver->drawMeshBuffer()), so what scene manager it belongs to will become irrelevant. (You also will not need to do "excludeNodeFromDepthPass" etc...). This will be included with the next release.* You should add a way to pass custom scene manager to effectHandler, because not always Irrlicht users (like me) use default scene manager. It took me about an hour to figure this out (light camera was rendering nothing).
Haha, I was actually trying to do this from the start but I only knew of the unexposed static method from inside Irrlicht and didn't know you can access it from the user-app.* You should replace std::cout with device->getLogger()->log
Yes that was a silly oversight. I might just convert all of the shaders to strings so the user doesn't have to bother with distributing them etc.* You should allow to select a custom shaders folder. For example, I have a seperate system folder with all the exes and dlls, media, shaders etc. is located at the same level as system, so I had to add "../" to effectHandler.
Will do.You should reset the previous mip map creation state
I have already changed this system a while ago, but lack of motivation to update documentation etc so that people will not get confused has put me off releasing it. Right now it offers some enums like ESM_CAST, ESM_RECIEVE, ESM_BOTH and when you add a shadow to a node you can do ->addShadowToSceneNode(node,filtertype, ESM_RECIEVE, or cast, etc);* And I suggest renaming AddShadowToSceneNode to ReceiveShadows or something like that.
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
Update. Implemented the stuff I promised to elvman (Or most of it at the very least.). The API usage is very very different (There is no need for excludeNodeFromDepthPass, and addNodeToDepthPass is not even related to shadow maps anymore! )
New features are:
- 16 bit depth support for both DX and OGL.
- New shadow modes for easy configuration of casting/recieving shadows.
- effect->update() now replaces smgr->drawAll(), so remember to not use smgr->drawAll() and instead use effect->update() in its place.
- New post processing support with double buffering, read docs for more info. (Require atleast PS 2.0).
- Demo features bloom effect.
- Screen depth pass for recording screen space depth information to a depth buffer for use in post processing effects such as DOF or SSAO.
- Probably alot of other stuff which I am forgetting to mention.
Have fun.
New features are:
- 16 bit depth support for both DX and OGL.
- New shadow modes for easy configuration of casting/recieving shadows.
- effect->update() now replaces smgr->drawAll(), so remember to not use smgr->drawAll() and instead use effect->update() in its place.
- New post processing support with double buffering, read docs for more info. (Require atleast PS 2.0).
- Demo features bloom effect.
- Screen depth pass for recording screen space depth information to a depth buffer for use in post processing effects such as DOF or SSAO.
- Probably alot of other stuff which I am forgetting to mention.
Have fun.
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
This shader pack looks really nice:) New features are very good. Thanks BlindSide for Your good work:)
OpenGL mode don't work on my Radeon 2600 PRO. In DirectX all it's ok, but in OpenGL I have many errors in GLSL shader structure.
RTT use in Bloom Effect may cause problem on Graphic Cards without non power of 2 textures if You use getScreenSize(), I think that better options is use predefined resolution for RTT eg, 1024x1024 for 1024x768 screen size etc.
OpenGL mode don't work on my Radeon 2600 PRO. In DirectX all it's ok, but in OpenGL I have many errors in GLSL shader structure.
Code: Select all
rt[0] = driver->createRenderTargetTexture(driver->getScreenSize());
rt[1] = driver->createRenderTargetTexture(driver->getScreenSize());
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Awesome Blindside, I will definitely use this in my project!
But I have some problems like Nadro with opengl, here is the output of my console:
My video card is a Radeon X1900GT 256 MB
But I have some problems like Nadro with opengl, here is the output of my console:
Code: Select all
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.4
Microsoft Windows XP Professional Service Pack 2 (Build 2600)
Using renderer: OpenGL 2.0.6287
Radeon X1900 GT x86/SSE2: ATI Technologies Inc.
OpenGL driver version is 1.2 or better.
GLSL version: 1.2
Loaded texture: wall.bmp
Loaded mesh: ShadRoom.b3d
Loaded texture: axe.jpg
Loaded texture: dwarf.jpg
Could not open file of texture: dwarf2.jpg
Could not open file of texture: dwarf2.jpg
Could not open file of texture: dwarf2.jpg
Loaded mesh: dwarf.x
Loaded texture: red.bmp
GLSL shader failed to compile
ERROR: 0:18: '+' : wrong operand types no operation '+' exists that takes a le
ft-hand operand of type '4-component vector of float' and a right operand of typ
e '2-component vector of float' (or there is no acceptable conversion)
ERROR: 0:18: 'texture2D' : no matching overloaded function found
ERROR: 2 compilation errors. No code generated.
GLSL shader failed to compile
ERROR: 0:18: '+' : wrong operand types no operation '+' exists that takes a le
ft-hand operand of type '4-component vector of float' and a right operand of typ
e '2-component vector of float' (or there is no acceptable conversion)
ERROR: 0:18: 'texture2D' : no matching overloaded function found
ERROR: 2 compilation errors. No code generated.
GLSL shader failed to compile
ERROR: 0:11: 'texture2D' : no matching overloaded function found
ERROR: 0:11: '=' : cannot convert from 'const float' to '4-component vector of
float'
ERROR: 0:12: 'texture2D' : no matching overloaded function found
ERROR: 0:12: '=' : cannot convert from 'const float' to '4-component vector of
float'
ERROR: 0:16: 'float4' : no matching overloaded function found
ERROR: 0:18: 'float4' : no matching overloaded function found
ERROR: 6 compilation errors. No code generated.
This is what I get for not testing the code on an ATI first I'll post a fixed bloom shader soon.
I'll add userdefinable screen rtt, fix bloom shader on the ATI in OGL, then post the updated version soon.
Hmmm yes I was worrying about this also. I think most cards do support npot rtt, except maybe some ATI cards right? The best solution I think is to make the screen rtt res user-definable, then its up to them to worry about what hardware to support and whether to scale to the nearest power of two etc.RTT use in Bloom Effect may cause problem on Graphic Cards without non power of 2 textures if You use getScreenSize(), I think that better options is use predefined resolution for RTT eg, 1024x1024 for 1024x768 screen size etc.
I'll add userdefinable screen rtt, fix bloom shader on the ATI in OGL, then post the updated version 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