XEffects - (Indoor Soft-Shadows + Post-Processing)

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

there are some accuracy problem here. I'm running the demo using Windows XP, with a graphic card nvidia geforce 8800 GTX. the setting for the demo is 4096 pixel shadow map and the filtering at 16PCF.

OpenGL:

Image

Image

DirectX:

Image
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Yeah that happens in OpenGL, it is just the shadow on the backside of the mesh. I personally don't think it looks so bad when the image is moving, or if the geometry is not so square (Look at the dwarfs.). It is best remedied by adjusting the lighting to fit the shadow colour on the opposite side of the light, that is probably what's happening in DX as it's lighting model slightly differes from OpenGL.

You can also improve the accuracy by reducing the depth-offset (This is used to cancel out any depth-buffer caused artifacts that occur.). I'll add an adjustable parameter for this in the next release if you really think it's a problem.

Cheers

EDIT:

Ok, to reduce the depth offset do this.

For DX:
Open up ShadowPass2P.hlsl in the shaders folder and change

Code: Select all

MVar[0] -= 0.01f;
to

Code: Select all

MVar[0] -= 0.004f;
on line 55.

For OpenGL:
Open up ShadowPass2V.glsl in the shaders folder and change

Code: Select all

OUT.MVar.x = (OUT.ShadowMapSamplingPos.z / MaxD) - 0.01;
to

Code: Select all

OUT.MVar.x = (OUT.ShadowMapSamplingPos.z / MaxD) - 0.005;
on line 23.

That should get rid of most of the problems. Be careful because reducing the depth offset can cause artifacts to appear, a safer way to do this would be reducing the far value and increasing the near value of the shadow camera, so that more depth accuracy is obtained over the length of the frustum.

Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
gbox
Posts: 37
Joined: Mon May 01, 2006 3:41 am
Location: jeonju, korea
Contact:

Post by gbox »

i can't find getVenderInfo

>CShaderPre.cpp
1>d:\chuck\enigma4d\trunk\xeffect\cshaderpre.cpp(188) : error C2039: 'getVendorInfo' : is not a member of 'irr::video::IVideoDriver'
1> d:\chuck\enigma4d\trunk\sdk\irrlicht\include\ivideodriver.h(76) : see declaration of 'irr::video::IVideoDriver'
i compile xeffect with irrlicht 1.4.1
http://cafe.naver.com/jcga

professor of Jelabukdo Game Engine Academy
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

It should be in Irrlicht 1.4.1, are your header files up to date? Else you can just comment any lines that use it, it doesn't really have any use atm.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
gbox
Posts: 37
Joined: Mon May 01, 2006 3:41 am
Location: jeonju, korea
Contact:

Post by gbox »

ShadowMap resolution
over than 512 X512

there is error
Error: Tried to set a render target texture which is bigger than the screen.
Error: Tried to set a render target texture which is bigger than the screen.
Error: Tried to set a render target texture which is bigger than the screen.
why?

but your sample .exe file work well(ShadowMap.exe) over 512


my compile version meet error
Error: Tried to set a render target texture which is bigger than the screen.
i complied with svn trunk version
[/quote]
Last edited by gbox on Mon Jul 07, 2008 3:58 pm, edited 1 time in total.
http://cafe.naver.com/jcga

professor of Jelabukdo Game Engine Academy
gbox
Posts: 37
Joined: Mon May 01, 2006 3:41 am
Location: jeonju, korea
Contact:

Post by gbox »

Code: Select all

IrrlichtDevice* device = createDevice(dType,dimension2d<s32>(800,600),32);


Code: Select all

//dimension2d<s32> ScreenRTT = (driver->getVendorInfo().equals_ignore_case("NVIDIA Corporation")) ? driver->getScreenSize() : dimension2d<s32>(512,512);
//dimension2d<s32> ScreenRTT = driver->getScreenSize();
dimension2d<s32> ScreenRTT = dimension2d<s32>(512,512);

i cant make over 512
ex> dimension2d<s32>(1024,1024);
image is low res image :cry:

so i can't make hi res shadow like 1024,2048...
http://cafe.naver.com/jcga

professor of Jelabukdo Game Engine Academy
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

This is an Irrlicht limitation, it doesn't allow an RTT size greater than the screen size in D3D mode. It should work in OpenGL unless you have an old ATI card.

My executable is using a patched Irrlicht DLL, to allow for larger RTT sizes in D3D, you can find a patch for this in the Code Snippets forum.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The ATI FBO patch is now also in SVN trunk. so it's just the d3d patch whih is missing.
gbox
Posts: 37
Joined: Mon May 01, 2006 3:41 am
Location: jeonju, korea
Contact:

Post by gbox »

thanks for answer!

but opengl make wrong scene too(i have gforce 8600gt)

i will try patch!!
http://cafe.naver.com/jcga

professor of Jelabukdo Game Engine Academy
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

So in OpenGL on your 8600GT the console outputs:

Code: Select all

Error: Tried to set a render target texture which is bigger than the screen. 
That definately shouldn't be happening, I'm sure that message can only be displayed in D3D.

Or is this another problem we are talking about now?

BTW: I like the models made in your game academy, very nice. Reminds me of Tekken 8)
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
gbox
Posts: 37
Joined: Mon May 01, 2006 3:41 am
Location: jeonju, korea
Contact:

Post by gbox »

BlindSide wrote:So in OpenGL on your 8600GT the console outputs:

Code: Select all

Error: Tried to set a render target texture which is bigger than the screen. 
That definately shouldn't be happening, I'm sure that message can only be displayed in D3D.

Or is this another problem we are talking about now?

BTW: I like the models made in your game academy, very nice. Reminds me of Tekken 8)
opengl do not outputs
'Error: Tried to set a render target texture which is bigger than the screen.'
message

but result is wrong

[img]
http://www.jga.or.kr/SBoard/PDS/BOARD/d ... gl2048.jpg
[/img]

too bright
depth is not work right


here is my source and binary

http://jga.or.kr/sboard/download.asp? ... ta&idx=89
http://cafe.naver.com/jcga

professor of Jelabukdo Game Engine Academy
gbox
Posts: 37
Joined: Mon May 01, 2006 3:41 am
Location: jeonju, korea
Contact:

finnaly i success

Post by gbox »

i Success DX9 , shadowmap 4096 size :D

this is screen shot~
http://www.jga.or.kr/SBoard/PDS/BOARD/d ... dx4096.jpg

patched irrlicht engine
http://jga.or.kr/sboard/download.asp?bo ... ata&idx=92

sample code (correct memory rick bug)
http://jga.or.kr/sboard/download.asp?bo ... ata&idx=93

but screen shot so bright? why?

i will more try now :evil:

thanks BlindSide
http://cafe.naver.com/jcga

professor of Jelabukdo Game Engine Academy
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

That's because of the bloom effect. Just remove the bloom effect if you don't want it.

Just comment these lines:

Code: Select all

effect->addPostProcessingEffectFromFile(core::stringc("shaders/BlurHP") + shaderExt);
effect->addPostProcessingEffectFromFile(core::stringc("shaders/BlurVP") + shaderExt);
effect->addPostProcessingEffectFromFile(core::stringc("shaders/BloomP") + shaderExt);
It does look brighter than normal though, I wonder why that is...
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
wuallen
Posts: 67
Joined: Thu Jan 25, 2007 3:07 am
Location: Shanghai

Post by wuallen »

[quote="Virion"]there are some accuracy problem here. I'm running the demo using Windows XP, with a graphic card nvidia geforce 8800 GTX. the setting for the demo is 4096 pixel shadow map and the filtering at 16PCF.

quote]


Hi Virion, I look the picture, I feel that the cube and dwarf are not just right on the ground, there is a small gap between the ground and the cube or dwarf. It looks they fly in the air. May be this is the cause.
doqkhanh
Posts: 158
Joined: Sat Mar 01, 2008 3:14 am
Location: Tokyo, Japan
Contact:

Post by doqkhanh »

Code: Select all

3>d:\engine\demod4\vhfos\viet heroes - fight or surrender\cshaderpre.cpp(187) : error C2039: 'getVendorInfo' : is not a member of 'irr::video::IVideoDriver'
3>        d:\engine\irrlicht-1.4\include\ivideodriver.h(76) : see declaration of 'irr::video::IVideoDriver'
3>Generating Code...
I don't know why, but my compiler has same error

at
DefineMap[driver->getVendorInfo()] = "";
gbox wrote:i can't find getVenderInfo

>CShaderPre.cpp
1>d:\chuck\enigma4d\trunk\xeffect\cshaderpre.cpp(188) : error C2039: 'getVendorInfo' : is not a member of 'irr::video::IVideoDriver'
1> d:\chuck\enigma4d\trunk\sdk\irrlicht\include\ivideodriver.h(76) : see declaration of 'irr::video::IVideoDriver'
i compile xeffect with irrlicht 1.4.1
Post Reply