XEffects - Reloaded - New Release (V 1.4)

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Aggie
Posts: 7
Joined: Sun Jul 22, 2012 11:56 pm

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

Post by Aggie »

Hi, I'm having an issue with the FrameBuffer Object that some others have had in the past, but none of their fixes have helped me. (Irrlicht-1.7.2, 64-bit Linux installation so therefore using OpenGL drivers)

"FBO has one or several incomplete image attachments
FBO error
FBO incomplete"

On one machine, XEffects works overall pretty great, that machine has an integrated Intel graphics card.

On another machine, I have nVidia Corporation GF108 [GeForce GT 430], and this machine has the issues.
All examples had some issues save for example 5 (ray tracer).

First I went about replacing EVST_VS_3_0 with EVST_VS_2_0, and EPST_PS_3_0 with EPST_PS_2_0. This fixed examples 3 and 4, but not 1,2, or 6.

Then tried only using screenRTT of 512x512, I also tried replacing all ECF_G32R32F with ECF_A32B32G32R32F, and all ECF_G16R16F with ECF_A16B16G16R16F. This didn't fix anything on examples 1, 2, and 6.

I'm out of ideas. Any help, BlindSide?

EDIT: I guess while I'm at it, I'll also discuss the problems I have with the integrated graphics card:
For example 3 I get the following:
Mesa 8.0.4 implementation error: Failed to compile fragment shader: FS compile failed: no register to spill

Is this truly an issue with mesa-utils/my graphics driver or can I change the SSAO shaders to work with this card?

-Aggie
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

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

Post by hybrid »

IIRC, we had a fix for the incomplete FBO recently. Maybe Nadro remembers the reason, but probably it could be an issue with some Irrlicht settings here. The problem with the integrated card is that not enough registers are available. Code could be optimized to use lesser ressources maybe, though BlidnSide has quite good code usually.
Aggie
Posts: 7
Joined: Sun Jul 22, 2012 11:56 pm

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

Post by Aggie »

Thank you, hybrid. It would be nice if all I need to do is change some Irrlicht settings :)
Aggie
Posts: 7
Joined: Sun Jul 22, 2012 11:56 pm

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

Post by Aggie »

I've managed to fix things by replacing both ECF_A32B32G32R32F and ECF_A16B16G16R16F with ECF_A8R8G8B8 in EffectHandler.cpp

I'm not sure if this is the best fix, but it got things working for me on my GeoForce machine. I'll check back in to say if I can use any other color formats. This is strange because I ran the color testing code from http://irrlicht.sourceforge.net/forum/v ... hp?t=42593, and it said that all the formats were supported.

-Aggie

I went through EffectHandler.cpp, and in getShadowMapTexture(), I experimented with color formats to see which ones would and would not allow example1 to work properly. "Work Properly" meaning that I'll see the shadows correctly and not get the FBO errors. Here's a list.

Formats that work (for example1):
  • ECF_A1R5G5B5
    ECF_A8R8G8B8
    ECF_R8G8B8
Formats that don't work (for example1):
  • ECF_A16B16G16R16F
    ECF_A32B32G32R32F
    ECF_G16R16F
    ECF_G32R32F
    ECF_R16F
    ECF_R32F
    ECF_R5G6B5
Edit:
Updating to the manufacturer's nvidia drivers solved this problem. The open source drivers didn't support the floating point texture formats.
Last edited by Aggie on Fri Apr 12, 2013 7:55 pm, edited 1 time in total.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

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

Post by hendu »

Make sure you have the latest nvidia drivers? Having all float formats not working will drop the quality of your shadows, possibly a lot.
Puck6633
Posts: 27
Joined: Wed Aug 10, 2005 8:35 am

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

Post by Puck6633 »

I'm trying to use XEffects VSM shadows with transparent materials, and I'm encountering a strange issue. It's probably easier to show it than try to explain:

Image

Does anyone know why this would be happening? Looking at the source of XEffects it looks like it's made to handle both alpha and referenced alpha (I'm using the latter) but I'm not sure what I'm doing wrong. The model in question (the tree) is simply a textured quad exported as a .obj file from Blender.

My code looks like this:

Code: Select all

 
#include <unistd.h>
#include <iostream>
#include <vector>
 
#include <irrlicht.h>
#include "XEffects.h"
 
using namespace std;
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
 
class MyEventReceiver : public IEventReceiver {
    IrrlichtDevice* Device;
 
    public:
        MyEventReceiver(IrrlichtDevice* device) : Device(device) {
        }
 
        bool OnEvent(const SEvent& event) {
            if (event.EventType == irr::EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown) {
                switch (event.KeyInput.Key) {
                    default:
                    break;
                }
            }
 
            return false;
        }
};
 
struct Options {
    u32 width, height;
    u8 depth;
    bool fullscreen;
} gameOptions;
 
void readConfig() {
    //Default values
    gameOptions = {1024, 768, 32, false};
 
    IrrXMLReader* xml = createIrrXMLReader("config.xml");
 
    if (!xml) cout << "Error reading config file!" << endl;
 
    // parse the file until end reached
    while(xml && xml->read()) {
        std::string nodeName = std::string(xml->getNodeName());
        switch(xml->getNodeType()) {
            case EXN_ELEMENT:
                if (!strcmp(xml->getNodeName(), "var")) {
                    if (xml->getAttributeCount() < 2 || strcmp(xml->getAttributeName(0), "id") || strcmp(xml->getAttributeName(1), "val")) cout << "Malformed var tag, skipping." << endl;
                    std::string varname = std::string(xml->getAttributeValue("id"));
                    if (varname == "driver.width") gameOptions.width = xml->getAttributeValueAsInt("val");
                    if (varname == "driver.height") gameOptions.height = xml->getAttributeValueAsInt("val");
                    if (varname == "driver.depth") gameOptions.depth = xml->getAttributeValueAsInt("val");
                    if (varname == "driver.fullscreen") gameOptions.fullscreen = (xml->getAttributeValueAsInt("val") ? true : false);
                }
                else {
                    cout << "Unknown element '" << nodeName << "' in config file, skipping." << endl;
                }
                break;
            default:
                cout << "Bad element in config file, skipping." << endl;
            break;
        }
    }
    // delete the xml parser after usage
    delete xml;
}
 
int main(int argc, char** argv) {
    readConfig();
 
    IrrlichtDevice* device = createDevice(EDT_OPENGL, dimension2d<u32>(gameOptions.width, gameOptions.height), gameOptions.depth, gameOptions.fullscreen, true, false, 0);
    IVideoDriver* driver = device->getVideoDriver();
    ISceneManager* smgr = device->getSceneManager();
    IGUIEnvironment* guienv = device->getGUIEnvironment();
    IGPUProgrammingServices* gpu = driver->getGPUProgrammingServices();
 
    device->setWindowCaption(L"Horror Game");
 
    // Create a basic fps camera.
    ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS(0, 100.0f, 0.01f);
    cam->setPosition(vector3df(10.0f, 10.0f, -10.0f));
    cam->setTarget(vector3df(5.0f, 5.0f, 5.0f));
    cam->setFarValue(50.0f);
    cam->setNearValue(0.1f);
 
    // Initialise the EffectHandler, pass it the working Irrlicht device and the screen buffer resolution.
    // Shadow map resolution setting has been moved to SShadowLight for more flexibility.
    // (The screen buffer resolution need not be the same as the screen resolution.)
    // The third to last parameter enables VSM filtering, which we will enable.
    // The second to last parameter enables soft round spot light masks on our shadow lights.
    // The last parameter enables 32-bit depth buffers which is recommended for VSM shadows.
    EffectHandler* effect = new EffectHandler(device, driver->getScreenSize(), true, true, true);
 
    // Load a basic room mesh.
    IMeshSceneNode* room = smgr->addMeshSceneNode(smgr->getMesh("media/testarea.obj")->getMesh(0));
    //room->setScale(vector3df(3.0f, 2.0f, 3.0f));
    //room->setPosition(vector3df(4.5f, 0.5f, 4.0f));
    //room->setMaterialTexture(0, driver->getTexture("media/wall.jpg"));
 
    // We disable lighting on the mesh.
    room->getMaterial(0).Lighting = false;
 
    // Add the room to the shadow node list.
    effect->addShadowToNode(room);
 
    IMeshSceneNode* tree = smgr->addMeshSceneNode(smgr->getMesh("media/tree.obj")->getMesh(0));
    tree->setMaterialFlag(EMF_LIGHTING, false);
    tree->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
    effect->addShadowToNode(tree);
 
    // Set a global ambient color. A very dark gray.
    effect->setAmbientColor(SColor(255, 16, 16, 16));
 
    // Load the dragon mesh.
    // Dragon model courtesy of TurboSquid.com.
    //IMesh* dragonMesh = smgr->getMesh("media/dragon.obj")->getMesh(0);
 
    // Add a dragon mesh scene node.
    //IMeshSceneNode* dragon = smgr->addMeshSceneNode(dragonMesh);
    //dragon->setScale(vector3df(1.5f, 1.5f, 1.5f));
    //dragon->setPosition(vector3df(5.0f, 9.0f, 3.0f));
 
    // Disable lighting on the dragon.
    //dragon->setMaterialFlag(EMF_LIGHTING, false);
 
    // Apply a shadow to the dragon. It is not recommended to use anything other than EFT_NONE
    // in conjunction with VSM shadows.
    //effect->addShadowToNode(dragon);
 
    // Set the background clear color to black.
    effect->setClearColour(SColor(0x0));
 
    // Add two shadow lights.
    // The first parameter specifies the shadow map resolution for the shadow light.
    // The shadow map is always square, so you need only pass 1 dimension, preferably
    // a power of two between 512 and 2048, maybe larger depending on your quality
    // requirements and target hardware. We will just pass the value the user picked.
    // The second parameter is the light position, the third parameter is the (look at)
    // target, the next is the light color, and the next two are very important
    // values, the nearValue and farValue, be sure to set them appropriate to the current
    // scene. The last parameter is the FOV (Field of view), since the light is similar to
    // a spot light, the field of view will determine its area of influence. Anything that
    // is outside of a lights frustum (Too close, too far, or outside of it's field of view)
    // will be unlit by this particular light, similar to how a spot light works.
    // We will add one red light and one yellow light.
    effect->addShadowLight(SShadowLight(1024, vector3df(-15, 30, -15), vector3df(5, 0, 5),
        SColor(255, 255, 255, 255), 0.1f, 50.0f, smgr->getActiveCamera()->getFOV()*0.8));
 
    s32 oldFPS = 0;
    while (device->run()) {
        driver->beginScene(true, true, SColor(0x0));
 
        effect->getShadowLight(0).setPosition(smgr->getActiveCamera()->getAbsolutePosition().getInterpolated(smgr->getActiveCamera()->getTarget(), 0.9));
        effect->getShadowLight(0).setTarget(smgr->getActiveCamera()->getTarget());
        effect->update();
 
        driver->endScene();
 
        if(oldFPS != driver->getFPS()) {
            core::stringw windowCaption = L"Horror Game FPS: ";
            windowCaption += driver->getFPS();
            device->setWindowCaption(windowCaption.c_str());
            oldFPS = driver->getFPS();
        }
        usleep(1000);
    }
 
    device->drop();
    return 0;
}
 
JimmyRobo
Posts: 5
Joined: Sat Nov 17, 2012 3:28 pm

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

Post by JimmyRobo »

The problem here is that the Shader responsible for drawing the lit alpha ref quad (SHADOW_PASS_2P in the Receive pass) doesn't seem to actually support alpha properly. I had to modify it to make it work (though perhaps not in the most appropriate way). Because the shadowmap texture is passed through to the shader as the first texture, I pass the actual alpha ref texture as a 2nd texture and modified the shader to check each pixel of the alpha ref texture to see if it should be alpha on or off.

There might be a better solution than this, however. I am rather new at shader programming.
userdima
Posts: 22
Joined: Wed Jun 04, 2008 8:30 pm

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

Post by userdima »

I'm sorry if such question was already asked in this thread, but I have a problem with XEffects on my Mac. I have Mac OS X 10.7, my data:

Code: Select all

 
Irrlicht Engine version 1.8.0
Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64
Using renderer: OpenGL 2.1
Intel HD Graphics 4000 OpenGL Engine: Intel Inc.
 
All the postprocessing effects work as they should, but shadows don't come up. I just see the plain lighted textured surfaces. Console shows no errors, and I see the same behavior in all examples. Is it a known problem or maybe I'm doing something wrong?

EDIT: Seems that shadows are calculated well, and the problem is in LightModulate shader, it sees two identical textures in the shader, although it gets the correct ones in the EffectHandler code. How could that be so?

EDIT2: If someone has the same problem, here is the solution: you just need to change float interface to int on lines 90-110 in EffectCB.h. I'm not sure why that helped, but it works now. So, the new ScreenQuad callback code:

Code: Select all

 
irr::s32 TexVar = 0;
services->setPixelShaderConstant(services->getPixelShaderConstantID("ColorMapSampler"), &TexVar, 1);
 
TexVar = 1;
services->setPixelShaderConstant(services->getPixelShaderConstantID("DepthMapSampler"), &TexVar, 1);
 
TexVar = 2;
services->setPixelShaderConstant(services->getPixelShaderConstantID("DepthMapSampler"), &TexVar, 1);
 
TexVar = 3;
services->setPixelShaderConstant(services->getPixelShaderConstantID("UserMapSampler"), &TexVar, 1);
 
Sorry for my english, I'm from belarus!
JunkerKun
Posts: 97
Joined: Mon Jan 28, 2013 12:52 am

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

Post by JunkerKun »

So, does this work on Irrlicht 1.8? I've tried to use it but it just didn't work. On OpenGL render it didn't even set an ambient lighting and on Direct3D9 there is no shadow mapping, only ambient lighting. Now it is either I am too dumb to do it right, or something wrong with the current version of Xeffects.
So, should I just go and kill myself with a 2x4 wooden plank or is it really just a problem with Xeffects?
JunkerKun
Posts: 97
Joined: Mon Jan 28, 2013 12:52 am

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

Post by JunkerKun »

Sorry for doublepost, but I have another problem. I've managed to run Xeffects on 1.7.3 and currently using it. BUT I can't use fog with shadows. When I try to set fog with Scene Manager, it just turns shadows off. Is there any solution to this problem?
mehwoot
Posts: 7
Joined: Tue Jul 17, 2007 7:54 am

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

Post by mehwoot »

Is there any way to get casting shadows working on transparent materials? It seems like when a shadow is cast on a mesh with material type EMT_TRANSPARENT_ALPHA_CHANNEL_REF, you get a problem where anything behind the material in a place that is transparent gets any shadow effect cast on the transparent material at that point, rather than simply looking straight through.
Image

Edit: Reading back a bit, it says ESM_CAST is only support for Transparent textures, not ESM_BOTH. Anyone have any ideas how to support it?
AceS6
Posts: 2
Joined: Sat Mar 02, 2013 11:39 am

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

Post by AceS6 »

Hi,

I'm having a problem trying to use dynamic shadows with xEffects. I am using the default map and character from the irrlicht folder. The shadows are working but my fps is really low :? . Even though i use only one light ! :shock:
Here are some screenShot:
Image
As you can see fps drops when the camera is looking at the shadows.
Image


I don't think my specs are too bad :
cpu : amd dual core 2ghz
gpu : ati hd 4570
4gb ram

I'm playing at resolution 1366x768 but even if i try in 800*600, fps stay low( about 20-30 ).

Thank you :D
AceS6
Posts: 2
Joined: Sat Mar 02, 2013 11:39 am

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

Post by AceS6 »

JunkerKun wrote:So, does this work on Irrlicht 1.8? I've tried to use it but it just didn't work. On OpenGL render it didn't even set an ambient lighting and on Direct3D9 there is no shadow mapping, only ambient lighting. Now it is either I am too dumb to do it right, or something wrong with the current version of Xeffects.
So, should I just go and kill myself with a 2x4 wooden plank or is it really just a problem with Xeffects?
I'm using irrlicht 1.8 with xeffect and it's working. :wink:
ison
Posts: 42
Joined: Sun Mar 24, 2013 9:09 pm

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

Post by ison »

Hello, really awesome project :)

However I seem to have some problems with irrlicht 1.8.
Lighting doesn't work for me. Everything is 100% lit even if I don't have any light sources added with XEffects, default lighting for materials is disabled.

Bloom shader also doesn't work properly. It seems that blur shader does something strage:
https://dl.dropbox.com/u/12301540/bloom.png

this is how I use it:

Code: Select all

 
    postProcess->addPostProcessingEffectFromFile(core::stringc("../../shaders/BrightPass") + shaderExt);
    postProcess->addPostProcessingEffectFromFile(core::stringc("../../shaders/BlurHP") + shaderExt);
    postProcess->addPostProcessingEffectFromFile(core::stringc("../../shaders/BlurVP") + shaderExt);
    postProcess->addPostProcessingEffectFromFile(core::stringc("../../shaders/BloomP") + shaderExt);
JunkerKun
Posts: 97
Joined: Mon Jan 28, 2013 12:52 am

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

Post by JunkerKun »

Xeffects doesn't seem to work with OpenGL on 1.8. At least for me it works only on Direct3D9.

Oh, and while I'm here. Can someone explain how games does shadows? I mean, when you use XEffects, there is a rectangle of a light and everything else is in shadow. How can I make it so there is only a character's shadow? Or is it just how the shadow mapping works?
Post Reply