XEffects - Reloaded - New Release (V 1.4)

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Nova
Competition winner
Posts: 99
Joined: Mon May 09, 2005 10:32 am

Post by Nova »

Hi everyone,

I am trying to integrate XEffects to my project but having some troubles with my custom materials. I've read several pages from this post and came to the understanding that XEffects isn't supposed to mess with my materials but simply add the shadows "on top".

My materials are removed though and simply replaced with a solid white color.
Image
There are only two XEffects/Shader related errors in the console (seen above). The "error X3025" one also shows without XEffects and the scene still renders properly. So I discarded it as irrelevant.

This is a shader example. It's for the main dude (I omitted the variable/struct declaration for brevity):

Code: Select all

VS_OUTPUT vs_main(VS_INPUT In)
{
    VS_OUTPUT Out;

    Out.Pos         = mul( In.Pos, WorldViewProj );
    Out.TCoords     = In.TCoords;
    Out.light        = dot(normalize(mul( In.Normal, WorldViewProj )),normalize( float3(1,1,0)))/ 2 + 0.5;
    Out.light         = 1- Out.light;
    return Out;
}

float4 ps_main( float4 inDiffuse:  COLOR0,
	            float2 inTCoords:  TEXCOORD0,
	            float inLight:	   TEXCOORD1
			) : COLOR0
{
	//return float4(1,0,0,1);
	float4 color = tex2D( Tex0, inTCoords );

	float2 lookup = float2 ( inLight, LevelProgress );
	
	float4 lookupCol = tex2D( Tex1, lookup ) * 3;

	color = lookupCol * color;

	if( Anaglyph == 1 )
	{
		float itensity = dot( color, float4( 0.299, 0.587, 0.184, 0 ) );
		color.rgb = itensity.xxx;
	}

	return color;
}
XEffects is initialized like this:

Code: Select all

XEffectHandler = new EffectHandler( Env::Device, Env::Driver->getScreenSize(), false, true, false );
XEffectHandler->setAmbientColor( video::SColor( 255, 32, 32, 32 ) );
The effect also occurs when I don't have any shadowLights or shadowNodes in my scene.

Graphics Card: ATI Radeon HD 5700
Device: DirectX 9

I already recompiled the engine and there are no further shader errors.
In case its relevant, the graphics engine and xeffects are initialized in a seperate project which is statically linked to my bootstrapper, which also loads the game.dll. Don't think this causes the mess though since everything is handled in the engine lib.

I hope someone can help, I would really like to add those shadows to my game :-)
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Can you place a breakpoint somewhere after XEffects->update() and make sure that the materials are getting set back to their correct values? What does your draw loop look like?

Also, what are you doing for the terrain, is it excluded from light calculations?
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Nova
Competition winner
Posts: 99
Joined: Mon May 09, 2005 10:32 am

Post by Nova »

:oops: Oh boy this is a dumb one.
The objects are loaded from a xml file which also stores the materialId.
With XEffects my custom materials now get new materialIds and therefore the old ones in the xml do not point to the correct material anymore.

For the level I iterate over all custom materials and apply them via the name I gave them in my engine. Thats why they got the correct material Id.

Sorry. Stupid mistake.
smittix
Posts: 3
Joined: Sun Sep 26, 2010 7:46 am
Contact:

Post by smittix »

Does this shadow mapping method currently work with large scale scenes, like terrain covered in foliage?
Elvenfighter
Posts: 1
Joined: Sat Oct 02, 2010 3:30 pm

Post by Elvenfighter »

I'm having a trouble with EffectHandler::update() method.
With ISceneManager I was using this:

Code: Select all

       //this irr::core::rect<s32> viewRect was changing during runtime,
       //because the window, which was attached to irrlicht device also was able
       //to change its size
       //this is done because I want the aspect ratio stay unchanged
    driver->setViewPort(this->viewRect);
       //so next line displayed the rectangle with precalculated offsets
       //in resulting window
    smgr->drawAll();
       //aspect ratio was unharmed and the picture was undistorted
Now I'm using this

Code: Select all

    driver->setViewPort(this->viewRect);
    effect->update();
but the picture stretches all around the window, and distorts. And it is required that aspect ratio stays the same

can you solve this for me?
AW111
Posts: 82
Joined: Fri Jul 16, 2010 4:49 pm

Post by AW111 »

I've isolated the "tinting" problem I was having and it's clearly caused by something in XEffects - at certain angles, any meshes added using addMeshSceneNode are tinted with the "ClearColour", so that they appear as various shades of that color like a black-and-white photograph except in shades of the ClearColour. This only occurs when XEffects is enabled, only at certain viewing angles, and only with nodes added using addMeshSceneNode - not with nodes using addTerrainSceneNode, nor my own custom nodes.
I'm hoping someone else has seen this type of effect and knows how to solve it. I can post screenshots if that's necessary.
I don't think I changed anything in XEffects' code except re-adding the foam effect in the shader and changing the color of the water in the same shader.
AW111
Posts: 82
Joined: Fri Jul 16, 2010 4:49 pm

Post by AW111 »

I would like to modify the water shader so that I can use an undulating water surface to simulate waves and yet still have the refraction effects of the current shader. I assume that a specific texture could be defined as the water surface, and the shader would act on any fragment which had that texture? Please bear with me - I don't have much knowledge of shaders at all.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

undulating water surface to simulate waves
I'm not sure I get this, can you explain more clearly? I think it's non-trivial to not have a flat plane as the water surface using this method.

Btw, do you own a Toyota? :wink:
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
AW111
Posts: 82
Joined: Fri Jul 16, 2010 4:49 pm

Post by AW111 »

BlindSide wrote:
undulating water surface to simulate waves
I'm not sure I get this, can you explain more clearly? I think it's non-trivial to not have a flat plane as the water surface using this method.
Btw, do you own a Toyota? :wink:

I just meant using the shader in conjunction with geometry-based water surfaces - normally, an animated mesh is used to simulate waves, waterfalls, etc, and I would need this type of thing. I like XEffects' refraction effect, but I'd need to use it on actual geometry so that it works on specific polygons that have a texture that represents the water surface -- e.g., if I have a river which cascades downwards at several points, the water surface is going to exist at varying Y coords rather than always at the same elevation. I assume I could mark individual triangles as "water" by using a specific texture, and then modify the shader so that it operates on this texture rather than a specific Y coord.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

AW111 wrote:
BlindSide wrote:
undulating water surface to simulate waves
I'm not sure I get this, can you explain more clearly? I think it's non-trivial to not have a flat plane as the water surface using this method.
Btw, do you own a Toyota? :wink:

I just meant using the shader in conjunction with geometry-based water surfaces - normally, an animated mesh is used to simulate waves, waterfalls, etc, and I would need this type of thing. I like XEffects' refraction effect, but I'd need to use it on actual geometry so that it works on specific polygons that have a texture that represents the water surface -- e.g., if I have a river which cascades downwards at several points, the water surface is going to exist at varying Y coords rather than always at the same elevation. I assume I could mark individual triangles as "water" by using a specific texture, and then modify the shader so that it operates on this texture rather than a specific Y coord.
But that defeats the novelty of having a screen-space water effect. You should just use another solution like sio2 or elvman's reflective/refractive water shaders.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Winspy
Posts: 1
Joined: Fri Apr 30, 2010 1:56 pm

Post by Winspy »

I very like water effect!But my water wave is not moving, how to get the wave moving up?
Belajar
Posts: 15
Joined: Mon Nov 15, 2010 3:50 am

Post by Belajar »

i was recompile irrlicht.dll with DirectX SDK june 2010..
but it still not working..

when i tried to compile XEffect.sln , it gives me error like this

Code: Select all

DIRECT3D9 Driver was not compiled into this dll. Try another one.

Which DirectX sdk series that suitable for XEffect..?
Belajar
Posts: 15
Joined: Mon Nov 15, 2010 3:50 am

Post by Belajar »

mmm...or anyone that already build irrlicht.dll in MSCV..
enlightening me please..:D
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Post by ACE247 »

Ok so here's a Recompiled MSVC 2008 Irrlicht 1.7.2 dll
Works fine for me. :)
Irrlicht 1.7.2 Dll
Belajar
Posts: 15
Joined: Mon Nov 15, 2010 3:50 am

Post by Belajar »

ACE247 wrote:Ok so here's a Recompiled MSVC 2008 Irrlicht 1.7.2 dll
Works fine for me. :)
Irrlicht 1.7.2 Dll
mmm..when i tried to compile irrlicht 1.7.2 with the with your dll, it gives me error like this...

Code: Select all

First-chance exception at 0x100c5410 in 07.Collision.exe: 0xC0000005: Access violation reading location 0x0000000c.
Unhandled exception at 0x100c5410 in 07.Collision.exe: 0xC0000005: Access violation reading location 0x0000000c.
The program '[948] 07.Collision.exe: Native' has exited with code 0 (0x0).
Post Reply