XEffects - Reloaded - New Release (V 1.4)

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Insomniacp
Posts: 288
Joined: Wed Apr 16, 2008 1:45 am
Contact:

Post by Insomniacp »

the zombie is b3d, I downloaded it from a site... http://www.psionic3d.co.uk/?s=zombie&x=0&y=0 It is down at the bottom.

if I do non ref then I get the transparency issue again.

It seems that when I remove the shaders from the leaves it work fine, so I guess its something in the shader code for them?

leaves.frag

Code: Select all

uniform sampler2D Texture;

varying vec4 Color;

void main()
{
	gl_FragColor = texture2D( Texture, gl_TexCoord[0].xy ) * Color;
}
leaves.vert

Code: Select all

varying vec4 Color;

void main()
{
	Color = gl_Color;
	gl_TexCoord[0] = gl_MultiTexCoord0;
	gl_Position = ftransform();
}
shader creation with irrlicht

Code: Select all

    leafMaterialType = (video::E_MATERIAL_TYPE) driver->getGPUProgrammingServices()->addHighLevelShaderMaterialFromFiles(
        "shaders/trees/leaves.vert",
        "main",
        EVST_VS_2_0,
        "shaders/trees/leaves.frag",
        "main",
        EPST_PS_2_0,
        0,
        EMT_TRANSPARENT_ALPHA_CHANNEL_REF,
        0);
I don't know if it is anything I can change in those that will fix the issue. I would prefer to have the shader on the leaves since they look better but if I remove the shader and just put EMT_TRANSPARENT_ALPHA_CHANNEL_REF then it works fine so something in the shader is making the lighting look bad and I don't know much about shaders. The game is in opengl, maybe that is the issue?


EDIT
I looked at the fire in example one and it does have the same issue, it is excluded but it lights up the wall behind it
Image

I set the ambient color to black to show that the wall is not black behind the excluded fire.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

No it doesn't have the same issue, your issue was the square shaped brightness around the leaves due to the transparent part not getting affectd by light. You can see in the particles that only the visible particle area is bright and also the fire is TRANSPARENT_ADD so it's supposed to light up it's background a little bit.

Btw the technique I'm implementing for the Irrlicht shadow maps doesn't draw a full screen overlay for lighting so it won't suffer from these issues.

Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Insomniacp
Posts: 288
Joined: Wed Apr 16, 2008 1:45 am
Contact:

Post by Insomniacp »

So I decided I can just do EMT_TRANSPARENT_ALPHA_CHANNEL_REF and then just use XEffects for lighting, This works great with ESM_CAST it shows the leaves as shadows how it should be but when I do both i get the issue with the shadows on the whole image not just the leaves in it. So any thoughts on why that happens?
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Well the first post clearly reads:
UPDATE: V 1.2 includes added support for EMT_TRANSPARENT_ALPHA_REF materials for shadow mode ESM_CAST only. Check the first example.
I'm sure that's related somehow. :P
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Insomniacp
Posts: 288
Joined: Wed Apr 16, 2008 1:45 am
Contact:

Post by Insomniacp »

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

Post by stefbuet »

Hi,
Is there a way to let not visible a node when we call node->setVisible(false) ?
Because actually when I use setVisible(false), I can still see the mesh :
even if :
-I call : effect->excludeNodeFromLightingCalculations(node);
-I call, or not : effect->addShadowToNode(node);

When using excludeNodeFromLightingCalculations method, my mesh is transparent, but there is no shadow where it should be. I mean no shadow on other meshs behind the transparent node.

When using addShadowToNode or not (but not the previous method) then the mesh is transparent but I can see its shadow (on the mesh)

Also is it normal that when activating shadows on a child node which is translated from its parent I can see shadow at the child node position instead of its (child+parent) position ?

In fact, with any node, when its visibility is set to false, we can see its self shadow at its init position (translation are not handled) :( even if the node is not visible.
I'll try to make/destroy nodes, keeping only the mesh, to simulate setVisible behavior...

Thanks
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

insomniac your shader is bound to be wrong because you multiply the alpha by the col meaning that the alpha value will gently caress up the correct syntax would be

Code: Select all

uniform sampler2D Texture; 

varying vec4 Color; 

void main() 
{ 
   vec4 texlookup = texture2D( Texture, gl_TexCoord[0].xy );
   gl_FragColor = vec4(texlookup.rgb*Color.rgb, texlookup.a); 
}
and secondly why are you even using a varying to pass on vertex col

Code: Select all

void main() 
{ 
   gl_FrontColor = gl_Color; 
   gl_TexCoord[0] = gl_MultiTexCoord0; 
   gl_Position = ftransform(); 
} 

Code: Select all

uniform sampler2D Texture; 

varying vec4 Color; 

void main() 
{ 
   vec4 texlookup = texture2D( Texture, gl_TexCoord[0].xy );
   gl_FragColor = vec4(texlookup.rgb*gl_Color.rgb, texlookup.a); 
}
Insomniacp
Posts: 288
Joined: Wed Apr 16, 2008 1:45 am
Contact:

Post by Insomniacp »

uhhh, those aren't my shaders. Those were included in either the grass scene node or tree node projects that i downloaded and implemented so I can't answer your question as I did not make them. Thanks for the correction though.
3D Ace
Posts: 66
Joined: Sun Oct 04, 2009 8:47 am
Location: Swakopmund, Namibia
Contact:

Post by 3D Ace »

I'm not too good with shaders and could use some help. I find the water from the screenwater shader a little too transparent for my purposes, how can i change its transperency?
Everything is possible, IF you know how.
Checkout my website for my upcoming game.(Currently on hold!)
http://www.projectbattle360.webege.com
Image
3D Ace
Posts: 66
Joined: Sun Oct 04, 2009 8:47 am
Location: Swakopmund, Namibia
Contact:

Post by 3D Ace »

Ok Ignore that previous post. I learned some shader programming and wrote my own water scene node. :D
Everything is possible, IF you know how.
Checkout my website for my upcoming game.(Currently on hold!)
http://www.projectbattle360.webege.com
Image
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

very nice... now you could eliminate back/front rendering bugs (when objects above water are refracted as if they are underwater
Barratator
Posts: 30
Joined: Fri Jan 08, 2010 3:30 pm

Post by Barratator »

Wow! Nice lib :-)

But...how can i add the Phong-Effect to a SceneNode?
I can't find the function addEffectToNode in the current version :(


Thanks!


Bastian
3D Ace
Posts: 66
Joined: Sun Oct 04, 2009 8:47 am
Location: Swakopmund, Namibia
Contact:

Post by 3D Ace »

Hey i was trying to cast shadows on a Terrain Scenenode, however nomatter what i did the terrain always ended up totally black. Im certain the code is right. Does Xeffects actually support casting shadows on terrain scenenodes?
Everything is possible, IF you know how.
Checkout my website for my upcoming game.(Currently on hold!)
http://www.projectbattle360.webege.com
Image
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

It should cast shadows on practically any scene node that can render to a depth buffer, that includes terrain. The issue is that the terrain scene node might be culled from the main camera's point of view and so some parts can be missing from the shadow camera's vision, this will create lack of shadows rather than black shadows though.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
3D Ace
Posts: 66
Joined: Sun Oct 04, 2009 8:47 am
Location: Swakopmund, Namibia
Contact:

Post by 3D Ace »

I got my new gpu today.(ATi 5970) and wierdly the terrain shadows now work perfectly. No idea why, but it works. :?
EDIT: I previously had a Nvidia 8800GT.
Everything is possible, IF you know how.
Checkout my website for my upcoming game.(Currently on hold!)
http://www.projectbattle360.webege.com
Image
Post Reply