XEffects - Reloaded - New Release (V 1.4)

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
grumpymonkey
Posts: 222
Joined: Mon Jan 19, 2009 10:03 pm
Location: Miami, Florida
Contact:

Post by grumpymonkey »

The first example crashed my computer :X..first time I've ever gotten BSOD on my pc

Probably cause my computers shitty.. Anyways great effects, too bad I can't use them though (damn you x64 vista on 2gb ram and Nvidia Gforce 7100!:evil: )
Image
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

I don't understand how I could use XEffect with my other shaders.
I have a reflexion/refraction shader on a mesh, and I'm trying to use XEffect, just with bloom post proc effect at the moment (lighting later...).
The scene does not render while the mesh node with shader is visible. When I use node->setVisible(false); the scene is rendered correctly with bloom.

The line which make Xeffect render fail is:

Code: Select all

myNode->setMaterialType(E_MATERIAL_TYPE(myShader));
How could I use my shader with XEffect?
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

It shouldn't fail for this reason alone, you can use your own shaders alongside XEffects. Perhaps the extra pass for rendering the reflections/refractions is screwing something up?
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

Here is the additional code used with the shader:

Code: Select all

 RTTTex = driver->addRenderTargetTexture(core::dimension2d<u32>(512,512));
		ITexture* NormMap = driver->getTexture("glassNormalMap.png");
		myNode->setMaterialTexture(0, RTTTex);
		myNode->setMaterialTexture(1, NormMap);
s32 GlassMat = gpu->addHighLevelShaderMaterialFromFiles("GlassV.glsl","main",EVST_VS_2_0,"GlassP.glsl","main",EPST_PS_2_0,this);
myNode->setMaterialType(E_MATERIAL_TYPE(GlassMat));
TintColour = SColorf(1.0f,1.0f,1.0f,1.0f);



//later in the same class:

OnSetConstants(irr::video::IMaterialRendererServices *services, irr::s32 userData) {
  

     core::matrix4 WorldMat = driver->getTransform(ETS_WORLD);
     services->setVertexShaderConstant("mWorld", WorldMat.pointer(), 16);

     core::vector3df CamPos = device->getSceneManager()->getActiveCamera()->getPosition();
     services->setVertexShaderConstant("CamPos", &CamPos.X, 4);

     float AlphaAdjust = 1.0f;

     if(ForceAlphaTo0) AlphaAdjust = 0.0f;

     services->setVertexShaderConstant("AlphaAdjust", &AlphaAdjust, 1);

     int TexAddress = 0;
     services->setPixelShaderConstant("RTTexture", (float*)(&TexAddress), 1);
     int TexAddress2 = 1;
     services->setPixelShaderConstant("NormalMap", (float*)(&TexAddress2), 1);

    
     services->setPixelShaderConstant("TintColour", (float*)(&TintColour.r), 4);
}

And here is how the shader is used, juste before calling the "update" methode from XEffect to render the scene:

Code: Select all


    driver->setRenderTarget(RTTTex, true, true,       SColor(255,100,100,200));
     myNode->setVisible(false);
     ForceAlphaTo0 = true;
     
     device->getSceneManager()->drawAll();
     
     
     ForceAlphaTo0 = false;
     driver->setRenderTarget(0, true, true, SColor(255,100,100,200));
     myNode->setVisible(true);

//and update now the whole scene:
effect->update();

stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

it's really funny:

if I do:

Code: Select all

myNode->setMaterialTexture(0, NormMap);
myNode->setMaterialTexture(1, RTTTex);
it's working, however if I do:

Code: Select all

myNode->setMaterialTexture(1, NormMap);
myNode->setMaterialTexture(0, RTTTex);

It's not working :shock:
Well... I'm ok with it if it's working, but it's a little strange, maybe a bug?.
I just switched texture layer ID in the shader constants for now.

Now, I have a couple of questions about XEffect :

-Is it possible to cast shadow from a node, 'receive' shadows froms other nodes, but don't 'receive' shadows from the same node himself? (no selfshadow)
Oh well, my mistake... There is the CAST shadow mode availlable (with RECEIVE and BOTH) I just had to put it in the addShadow call.

-Is there an issue against bad shadows on nodes borders? It seems it's pixelized.

-How could I render lines ? using draw3DLine from the driver is not working, nothing is displayed.
I think I can't render lines with draw3DLine from the driver because it's drawing it with OpenGl instantantanly, then XEffect render the whole scene to a quad and display the quad hiding lines. Using a node can resolve this problem as it's rendered to the quad by XEffect, so as I wanted to draw a grid, I used the forum grid scene node and it's working, but it's not really cool if you want to draw single lines.

Thank you very much.

Stef.
Last edited by stefbuet on Sat Mar 06, 2010 11:05 pm, edited 1 time in total.
thespecial1
Posts: 135
Joined: Thu Oct 30, 2008 11:56 am
Location: UK
Contact:

Post by thespecial1 »

hey thrrrrrrrrrrrrrrr

I have similar problems to gingerheadman but with funny issues at run time

in openGL example 1 crashes on function getShadowMapTexture with an Access Violation at this line using irrlicht 6.1 or 7.1

Code: Select all

shadowMapTexture = driver->addRenderTargetTexture(dimension2du(resolution, resolution),
			shadowMapName, use32BitDepth ? ECF_G32R32F : ECF_G16R16F);
console output shows

Code: Select all

Microsoft Windows XP Professional Service Pack 3 (Build 2600)
Using renderer: OpenGL 2.0.1
Quadro NVS 285/PCI/SSE2: NVIDIA Corporation
OpenGL driver version is 1.2 or better.
GLSL version: 1.1
Could not open file of texture: wall.bmp
Loaded mesh: media/ShadRoom.b3d
Loaded texture: D:/download/XEffectsR1.3/XEffects/Source/Debug/media/wall.jpg
Loaded texture: D:/download/XEffectsR1.3/XEffects/Source/Debug/media/axe.jpg
Loaded texture: D:/download/XEffectsR1.3/XEffects/Source/Debug/media/dwarf.jpg
Could not open file of texture: dwarf2.jpg
Loaded mesh: media/dwarf.x
Loaded texture: D:/download/XEffectsR1.3/XEffects/Source/Debug/media/xeffects.pn
g
Loaded texture: D:/download/XEffectsR1.3/XEffects/Source/Debug/media/fireball.bm
p
Resizing window (800 600)
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.
and in direct3d I get no crash but a nice orange screen and vertex shader compilation errors

Code: Select all

Welcome to the X-Platform Effect Wrapper Demo
Please select the driver type:
1 - OpenGL
2 - Direct3D9
2
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.1
Microsoft Windows XP Professional Service Pack 3 (Build 2600)
Using renderer: Direct3D 9.0
NVIDIA Quadro NVS 285 nv4_disp.dll 6.14.10.8176
HLSL vertex shader compilation failed:
error X3506: unrecognized compiler target 'vs_3_0'

HLSL vertex shader compilation failed:
error X3506: unrecognized compiler target 'vs_3_0'

HLSL vertex shader compilation failed:
error X3506: unrecognized compiler target 'vs_3_0'

HLSL vertex shader compilation failed:
error X3506: unrecognized compiler target 'vs_3_0'

HLSL vertex shader compilation failed:
error X3506: unrecognized compiler target 'vs_3_0'

HLSL vertex shader compilation failed:
error X3506: unrecognized compiler target 'vs_3_0'

HLSL vertex shader compilation failed:
error X3506: unrecognized compiler target 'vs_3_0'

HLSL vertex shader compilation failed:
error X3506: unrecognized compiler target 'vs_3_0'

HLSL vertex shader compilation failed:
error X3506: unrecognized compiler target 'vs_3_0'

Could not open file of texture: wall.bmp
Loaded mesh: media/ShadRoom.b3d
Loaded texture: D:/download/XEffectsR1.3/XEffects/Source/Debug/media/wall.jpg
Loaded texture: D:/download/XEffectsR1.3/XEffects/Source/Debug/media/axe.jpg
Loaded texture: D:/download/XEffectsR1.3/XEffects/Source/Debug/media/dwarf.jpg
Could not open file of texture: dwarf2.jpg
Loaded mesh: media/dwarf.x
Loaded texture: D:/download/XEffectsR1.3/XEffects/Source/Debug/media/xeffects.pn
g
HLSL vertex shader compilation failed:
error X3506: unrecognized compiler target 'vs_3_0'

HLSL vertex shader compilation failed:
error X3506: unrecognized compiler target 'vs_3_0'

HLSL vertex shader compilation failed:
error X3506: unrecognized compiler target 'vs_3_0'

HLSL vertex shader compilation failed:
error X3506: unrecognized compiler target 'vs_3_0'

Loaded texture: D:/download/XEffectsR1.3/XEffects/Source/Debug/media/fireball.bm
p
Resizing window (800 600)
Resetting D3D9 device.
Could not open file of texture: XEFFECTS_SM_512
XEffects: Please ignore previous warning, it is harmless.


any suggestions on what is wrong with the above, would be appreciated, also why example1 doesnt crash if I drop the resolution from 800x600 to 512x512, weird

many thanks
Rob


PS just in case it is my GPU, here are the supported features from irrlicht

Code: Select all

Irrlicht Engine version 1.7.1
Microsoft Windows XP Professional Service Pack 3 (Build 2600)
Using renderer: OpenGL 2.0.1
Quadro NVS 285/PCI/SSE2: NVIDIA Corporation
OpenGL driver version is 1.2 or better.
GLSL version: 1.1

Checking available NVIDIA Corporation GPU features..
Is driver able to render to a surface?                          True
Is hardeware transform and lighting supported?                  True
Are multiple textures per material possible?                    True
Is driver able to render with a bilinear filter applied?        True
Can the driver handle mip maps?                                 True
Can the driver update mip maps automatically?                   True
Are stencilbuffers switched on/supported?                       True
Is Vertex Shader 1.1 supported?                                 True
Is Vertex Shader 2.0 supported?                                 True
Is Vertex Shader 3.0 supported?                                 False
Is Pixel Shader 1.1 supported?                                  True
Is Pixel Shader 1.2 supported?                                  True
Is Pixel Shader 1.3 supported?                                  False
Is Pixel Shader 1.4 supported?                                  False
Is Pixel Shader 2.0 supported?                                  True
Is Pixel Shader 3.0 supported?                                  False
Are ARB vertex programs v1.0 supported?                         True
Are ARB fragment programs v1.0 supported?                       True
Is GLSL supported?                                              True
Is HLSL supported?                                              False
Are non-square textures supported?                              True
Are non-power-of-two textures supported?                        True
Are framebuffer objects supported?                              True
Are vertex buffer objects supported?                            True
Supports Alpha To Coverage?                                     True
Supports Color masks (disabling color planes in output)?        True
Supports multiple render targets at once?                       True
Supports separate blend settings for multiple render targets?   False
Supports separate color masks for multiple render targets?      False
Supports separate blend functions for multiple render targets?  False
Supports geometry shaders?                                      False
DGENXP
Posts: 124
Joined: Tue Dec 27, 2005 2:49 am
Contact:

Post by DGENXP »

I have tried and tried to get this working with my project but to no prevail

i can get the Post Processor features working but not the shadows themselves it seems that my version of irrlicht does not think PS or VS 3.0 does not exist

everytime i load my project the Console Window says this

HLSL vertex shader compilation failed
error X3506 unrecognized compiler target 'vs_3_0'

then when i try and set a shadow an error like this shows

Error setting the float array for HLSL variable

and my console just fills up with this error

and no shadow is cast and effect is very dim...

I Do have PS and VS support as i am using dual 9600 Ge-Force Cards so any help for this would be greatly appreciated

Note - I am using Irrlicht 1.4 as any one thats newer Crashes my project - i have tried earlier versions of your XEffects Project but with the exact same issues - is there some special version of irrlicht i need to use or something else please help would be great

Code: Select all

	effect->addShadowLight(SShadowLight(vector3df(PC->getPosition().X,PC->getPosition().Y,PC->getPosition().Z-10), vector3df(5, 0, 5), SColor(0, 255, 0, 0), 20.0f, 60.0f, 60.0f * DEGTORAD));
	effect->addEffectToNode(PC,EET_PHONG); 
	effect->addShadowToNode(PC,EFT_8PCF);
My Shadow code which brings this error
Someone once said A Jack of all trades is a master of none.

Join the Community at the RB3D Forums:

http://www.rpbuilder.org/forum
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

You can try changing all references to VS_3_0 to VS_2_0 in EffectHandler.cpp (But keep PS_3_0 the same).
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
thespecial1
Posts: 135
Joined: Thu Oct 30, 2008 11:56 am
Location: UK
Contact:

Post by thespecial1 »

BlindSide wrote:You can try changing all references to VS_3_0 to VS_2_0 in EffectHandler.cpp (But keep PS_3_0 the same).
easy mate
dont quite get your answer as your code in effecthandler.cpp seems to switch between the two dependant upon GPU features ala

Code: Select all

video::E_VERTEX_SHADER_TYPE VertexLevel = driver->queryFeature(video::EVDF_VERTEX_SHADER_3_0) ? EVST_VS_3_0 : EVST_VS_2_0;
	video::E_PIXEL_SHADER_TYPE PixelLevel = driver->queryFeature(video::EVDF_PIXEL_SHADER_3_0) ? EPST_PS_3_0 : EPST_PS_2_0;
I have vertex/pixel shader 2 and your code picks the correct one "2" but example 1 still crashes with "Access Violation" on

Code: Select all

shadowMapTexture = driver->addRenderTargetTexture(dimension2du(resolution, resolution),
			shadowMapName, use32BitDepth ? ECF_G32R32F : ECF_G16R16F);
with the same HLSL compile errors at the start (complaining about pixel shader 3) see above

please help, the previous version of XEffects ran inside of my project and on the same GPU

thanks
Rob
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

I switched from irr 1.6 to 1.7.1
Surprise! When I use XEffect all my textures are flipped!
This reminds me of a bug I submited about the draw2DImage function, with a kind of matrix which wasn't initialized good...
It's exactly the same problems, draw2DImage function draw my images flipped :( (only if I use XEffect)

Do you have this problem with irr 1.7?
If not, I'll try do put a standalone cpp file in bug report threads...
If I use smgr->drawAll instead of Xeffect->update, images are displayed correctly.

The probleme is appering when using post proc effect like bloom.
I'm using OPEN GL driver.

This probleme is not under SOFTWARE driver.

The line of XEffect which's inverting every textures is :

Line 449 - EffectHandler.cpp

Code: Select all

driver->setRenderTarget(i >= PostProcessingRoutinesSize - 1 ?
				outputTarget : ScreenQuad.rt[int(Alter)], true, true, ClearColour);
Fixed this problem :

Add at the end of update function in EffectHandler.h this line:

Code: Select all

driver->setMaterial(irr::video::SMaterial());
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

Just a brief question, can one mesh, terrain, whatever be lit by both ILightSceneNode from irrlicht and a shadowlight from xeffects at the same time?
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

I'm getting the same problems with the pixel and vertex shader 3.0 version. I've tried changing both of them, but I get a blank orange screen and the console says "Error setting HLSL float array" or something of the like. I know my graphics card supports vs and ps 3.0, and I remember it working before. I'm using 1.7.1 if that helps. How long will it be before the new shadow system in irrlicht? If it isn't too long I'll just wait for that instead.
Murloc992
Posts: 272
Joined: Mon Apr 13, 2009 2:45 pm
Location: Utena,Lithuania

Post by Murloc992 »

Anyone got luck compiling/launching this goodie on linux? :|

For me it compiles with a load of warnings and results a SIGSEV fragmentation fault.. Most of the warnings are from XEffects files.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

There seem to be a whole lot of technical problems cropping up lately. Did NVidia introduce something nasty in their graphics drivers? I'll get back to you guys after some testing. Don't mind the warnings, probably some non-explicit type cast stuff.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Murloc992
Posts: 272
Joined: Mon Apr 13, 2009 2:45 pm
Location: Utena,Lithuania

Post by Murloc992 »

BlindSide wrote:There seem to be a whole lot of technical problems cropping up lately. Did NVidia introduce something nasty in their graphics drivers? I'll get back to you guys after some testing. Don't mind the warnings, probably some non-explicit type cast stuff.
Now I had a look at the console output. It contains mostly FBO incomplete/error. :|

P.S. my video card is NVidia GF 7600 GS.
Post Reply