XEffects - Reloaded - New Release (V 1.4)

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki

Re: XEffects - Reloaded - New Release (V 1.3)

Postby christianclavet » Mon Feb 09, 2015 6:12 pm

Just copy the EffetCB.h that I've posted on this thread. It's corrected to work. Just try all the examples except example 1.
EDIT: Tryed it on an Intel Integrated card (Intel I5-4440) on Linux. The rendering is ok. But I hope, there are way to improve the performance. I got 7FPS with it enabled with 1 distant light. When it's disabled, I got 60FPS with the same scene.
User avatar
christianclavet
 
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA

Re: XEffects - Reloaded - New Release (V 1.3)

Postby mongoose7 » Wed Feb 18, 2015 7:20 am

I had a look at your file. You have removed the warnings generated by calls to the _OBSOLETED_ functions, but you are still passing the samplers as (float *). I can't see how that can work. Previously, with an nVidia card, I found this was possible, but lately (new GPU) it causes problems. I think you should change your code.
mongoose7
 
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: XEffects - Reloaded - New Release (V 1.3)

Postby christianclavet » Wed Feb 18, 2015 2:43 pm

Thanks Mongoose7,

I'm simply used the new recommended function to set the constants, the shaders are untouched. It's using ID (int) now. I get the ID using this:
cpp Code: Select all
services->getPixelShaderConstantID


Here how it's used in EffectCB.h. Using this is faster (I got my terrain shader rendering faster using this), than the other method that was giving warning at compilation. But still, the performance is low.
cpp Code: Select all
virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData)
    {
        IVideoDriver* driver = services->getVideoDriver();
 
        matrix4 worldViewProj = driver->getTransform(video::ETS_PROJECTION);           
        worldViewProj *= driver->getTransform(video::ETS_VIEW);
        worldViewProj *= driver->getTransform(video::ETS_WORLD);
        services->setVertexShaderConstant(services->getVertexShaderConstantID("mWorldViewProj"), worldViewProj.pointer(), 16);
 
        worldViewProj = ProjLink;          
        worldViewProj *= ViewLink;
        worldViewProj *= driver->getTransform(video::ETS_WORLD);
        services->setVertexShaderConstant(services->getVertexShaderConstantID("mWorldViewProj2"), worldViewProj.pointer(), 16);
 
        driver->getTransform(video::ETS_WORLD).getInverse(invWorld);
        vector3df lightPosOS = LightLink;
        invWorld.transformVect(lightPosOS);
        services->setVertexShaderConstant(services->getVertexShaderConstantID("LightPos"), reinterpret_cast<f32*>(&lightPosOS.X), 4);
       
        services->setVertexShaderConstant(services->getVertexShaderConstantID("MaxD"), reinterpret_cast<f32*>(&FarLink), 1);
        services->setVertexShaderConstant(services->getVertexShaderConstantID("MAPRES"), &MapRes, 1);
 
        services->setPixelShaderConstant(services->getPixelShaderConstantID("LightColour"), reinterpret_cast<f32*>(&LightColour.r), 4);
    }

I've tested this on NVidia (GTX780) and Intel (I5-4440). Rendering is ok, but the frame rate is low (Still plently playable on the NVidia, but run as a slideshow on the intel). (My directional light cover a lot of area so it light the view frustum).

cpp Code: Select all
effect->addShadowLight(SShadowLight(4096, vector3df(35, 480, -50), vector3df(0, 0, 0), SColor(255, 255, 255, 255), 20.0f, 5000.0f, 220000.0f * DEGTORAD, true));}
If you see there, it has to cover 220000.0f * DEGTORAD to cover the view frustum. And that's the only light in the scene(sun). but most of objects are set as shadow casting (except trees)

Perhaps that technique can't be used with the Intel integrated cards, it's still ok and doesnt lag with my GTX780 (800Fps -> 120 fps), but this is a high requirement! :D
User avatar
christianclavet
 
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA

Re: XEffects - Reloaded - New Release (V 1.3)

Postby mongoose7 » Wed Feb 18, 2015 10:59 pm

The problem is this code:
cpp Code: Select all
                irr::f32 TexVar = 0;
                services->setPixelShaderConstant(services->getPixelShaderConstantID("ColorMapSampler"), (const f32*)(&TexVar), 1);

It should be, for all instances,
cpp Code: Select all
                irr::s32 TexVar = 0;
                services->setPixelShaderConstant(services->getPixelShaderConstantID("ColorMapSampler"), &TexVar, 1);

I have a GTX 660Ti and I have problems with the float cast.

Use of 22000*DEG_TO_RAD is a bit weird. All trig functions will map this back to [-PI, PI). (I don't use XEffects.)
mongoose7
 
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: XEffects - Reloaded - New Release (V 1.3)

Postby christianclavet » Wed Feb 18, 2015 11:20 pm

Thanks Mongoose7! I'll try this. I will also put a quality switch on the texture resolution, because currently the RTT is getting rendered in a 4K texture (4096x4096). On theses integrated card, it can surely kill the performance. I will try to set it to 512 or 256 (Not even sure the shadow will be visible at this rez, but at least, the FPS will go up on that kind of hardware). XEffect is really made for spotlights. Directional lights are there, but only minimally.

Use of 22000*DEG_TO_RAD is a bit weird. All trig functions will map this back to [-PI, PI). (I don't use XEffects.)

That the information I got to set the light angle. For spotlights, you enter the angle that is covered, but for a directional light, the parameter is used to get the light size. At 90, the light was a tiny light dot on the ground. :) Tweaked the value until I saw it cover the entire view with light. That one thing that should be changed. It look like everything was made for spotlights, then started added support for directional light, but stopped there. Feel like this part is incomplete.

The "default" value is something like this: 90*DEG_TO_RAD that is ok for a spotlight.
EDIT: The resolution of the shadow map was taking the most FPS, after setting the resolution to 1024 instead of 4096, I got a "semi-playable" frame rate on the Intel chip. Was a 3FPS and now it got around 30FPS.
Last edited by christianclavet on Sun Feb 22, 2015 4:41 am, edited 1 time in total.
User avatar
christianclavet
 
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA

Re: XEffects - Reloaded - New Release (V 1.3)

Postby mongoose7 » Thu Feb 19, 2015 2:16 am

OK. Yes, I think you are right, I don't think the shaders support directional lights. Have you tried putting your directional lights a long way from the scene? At a large distance, a spotlight looks like a directional light.

Looking at your code again, I see that you are passing the sampler as a float. Maybe this works on Nvidia. The original problem with XEffects was that TexVar was an integer that was cast to look like a float and this was where I had a problem.
mongoose7
 
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: XEffects - Reloaded - New Release (V 1.3)

Postby Harch » Sun May 10, 2015 8:02 pm

Which version is most actual? Where to download it? It works with irrlicht 1.8.1?
Harch
 
Posts: 66
Joined: Wed Oct 08, 2014 9:01 pm

Re: XEffects - Reloaded - New Release (V 1.3)

Postby Harch » Wed May 13, 2015 7:58 pm

Hello! In OpenGL driver I get a screenshot as here: viewtopic.php?f=6&t=30631&start=735#p291489

I checked EffectCB.h, but it has TexVar type u32, so I can not understand what bug. Irrlicht SVN 1.9, the latest version (Trunk).
xEffects 1.3 (from the first post).

Help please!
Harch
 
Posts: 66
Joined: Wed Oct 08, 2014 9:01 pm

Re: XEffects - Reloaded - New Release (V 1.3)

Postby Harch » Wed May 13, 2015 8:09 pm

I changed u32 to s32 and got it: Image

What's wrong?
Harch
 
Posts: 66
Joined: Wed Oct 08, 2014 9:01 pm

Re: XEffects - Reloaded - New Release (V 1.3)

Postby Harch » Sat May 16, 2015 5:00 pm

Help please! :(
Harch
 
Posts: 66
Joined: Wed Oct 08, 2014 9:01 pm

Re: XEffects - Reloaded - New Release (V 1.3)

Postby Harch » Sat May 16, 2015 5:23 pm

All the examples working correctly, but the first example gives the picture above.
Last edited by Harch on Sat May 16, 2015 7:27 pm, edited 1 time in total.
Harch
 
Posts: 66
Joined: Wed Oct 08, 2014 9:01 pm

Re: XEffects - Reloaded - New Release (V 1.3)

Postby hendu » Sat May 16, 2015 5:24 pm

I don't do xeffects, just pointing out I cannot see your picture. Perhaps others can't either.
hendu
 
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: XEffects - Reloaded - New Release (V 1.3)

Postby Harch » Sat May 16, 2015 5:30 pm

Screenshot (picture):
Image

The shadows are missing :(
Harch
 
Posts: 66
Joined: Wed Oct 08, 2014 9:01 pm

Re: XEffects - Reloaded - New Release (V 1.3)

Postby Harch » Sat May 16, 2015 7:00 pm

I realized that the shadows are disabled when using:
cpp Code: Select all
 
cube->getMaterial(0).MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
 

Somebody faced with?
Harch
 
Posts: 66
Joined: Wed Oct 08, 2014 9:01 pm

Re: XEffects - Reloaded - New Release (V 1.3)

Postby mongoose7 » Sat May 16, 2015 10:41 pm

If you look in EffectHandler.cpp you will see that ALPHA_CHANNEL_REF is explicitly supported. Are you sure this is the cause? You know your scene is overbright? For testing, only use one light.
mongoose7
 
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

PreviousNext

Return to Project Announcements

Who is online

Users browsing this forum: No registered users and 1 guest