Postprocessing using only the fixed pipeline rendering.

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Post Reply
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Postprocessing using only the fixed pipeline rendering.

Post by Mel »

http://omegasection.g0dsoft.com/demos/p ... xample.rar

There you are this example compiled a ready to run. Also, it contains a small sample scene to test it. All the media used comes with the distribution of Irrlicht.

This code can be used freely for any kind of project. The only condition i ask in return is that you give some credit :)

Code: Select all

 
/**Simple postprocessing example, Blur / HDR-bloom postprocessing effect
By Santiago A. Navascues using the Irrlicht Engine
*/
 
/**What is "postprocessing"?
The post processing is a routine done after the main processing of the scene,
when the main scene has been already rendered.Normally, we would end here,
but with postprocessing things work different. The first and main diference
between the normal rendering and a postprocessed scene is that the main
rendering isn't done to the back buffer, but to a rendering target texture.
(RTT for short)
 
Then, this texture is used as the input for another rendering, using an
screenaligned quad that will serve us to re-render the scene. This
screen aligned quad has a material that mixes, blurs, decolorize...
In one word, process the input RTT in which our main scene is rendered
This material uses to be written in a shader file. And gives us as output
a "postprocessed" scene, if this scene is rendered to an RTT again, the
postprocessing can be repeated, and the postprocessing routines can then
be chained.
 
To avoid diferences between DirectX and OPEN GL, i will make a simple
postprocessing system that won't rely on any shaders. But all the Postpro-
cessing routines out there use the same basic system, that is, render to a
texture, and use that texture to render a screen aligned quad. The good
thing is that this can go to platforms which doesn't support shaders,
but that support irrlicht completely ;)
 
WARNING!: this code requires NPOT textures!
 
Also, i will make use of some tricks to simplify stuff, but the meat of it
is there
*/
 
/**
What this example covers:
-The Creation of a custom Scene Node, the ScreenQuad
-The usage of the 2D drawing routines to create an effect.
-The creation of simple effects using the materials
-Rendering to a texture
-The Rendering on demand of an ISceneNode
*/
 
#include <iostream>
#include <irrlicht.h>
 
#define _WIDTH_ 1024
#define _HEIGHT_ 768
 
using namespace irr;
using namespace std;
 
//Code taken kindly from the driverChoice.h :)
 
static irr::video::E_DRIVER_TYPE driverChoiceConsole(bool allDrivers=true)
{
    const char* const names[] = {"NullDriver","Software Renderer","Burning's Video","Direct3D 8.1","Direct3D 9.0c","OpenGL 1.x/2.x/3.x"};
    printf("Please select the driver you want:\n");
    irr::u32 i=0;
    for (i=irr::video::EDT_COUNT; i>0; --i)
    {
        if (allDrivers || (irr::IrrlichtDevice::isDriverSupported(irr::video::E_DRIVER_TYPE(i-1))))
            printf(" (%c) %s\n", 'a'+irr::video::EDT_COUNT-i, names[i-1]);
    }
 
    char c;
    std::cin >> c;
    c = irr::video::EDT_COUNT+'a'-c;
 
    for (i=irr::video::EDT_COUNT; i>0; --i)
    {
        if (!(allDrivers || (irr::IrrlichtDevice::isDriverSupported(irr::video::E_DRIVER_TYPE(i-1)))))
            --c;
        if ((char)i==c)
            return irr::video::E_DRIVER_TYPE(i-1);
    }
    return irr::video::EDT_COUNT;
}
 
/**Class CScreenQuadSceneNode:
Our screen aligned quad. When this quad is rendered, it simply covers the
screen with its texture, and uses its material to render the effect
 
Any Scene node out there needs, at least, all the abstract methods of the
ISceneNode interface implemented in order to be useful.
 
These methods are 5, besides the appropriate constructors and destructors:
 
The "on register for rendering" method,
The "render" method,
The "material count request" return method,
The "material request" method,
And the "AABB request" method.
*/
 
class CScreenQuadSceneNode : public scene::ISceneNode{
        core::aabbox3df aabb;                   //An axis aligned bounding box. Actually not needed.
        video::SMaterial material;              //The material used to render the Scene Node
        video::S3DVertex2TCoords vertices[4];   //The vertices of the Scene Node.
                                                //Normally we wouldn't need more
                                                //than one set of UV coordinates.
                                                //But if we are to use the builtin materials, this is necesary
 
public:
        CScreenQuadSceneNode::CScreenQuadSceneNode(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id)
        :ISceneNode(parent,mgr,id)
        {
            f32 shiftX,shiftY;
            core::dimension2d<u32> currentResolution;
 
/**Here we initialize the vertices of the screen Aligned quad*/
 
            currentResolution = mgr->getVideoDriver()->getScreenSize();
 
            aabb.reset(0,0,0);
 
            shiftX = 0.5/currentResolution.Width;   //This small shift is necesary to compensate the texture sampling bias
            shiftY = 0.5/currentResolution.Height;  //It avoids that our effect becomes too blurry.
 
            vertices[0] = video::S3DVertex2TCoords(
                        -1.0f,-1.0f,0.0f,
                        0.0f,0.0f,-1.0f,
                        video::SColor(255,255,255,255),
                        shiftX,1+shiftY,
                        shiftX,1+shiftY);
 
            vertices[1] = video::S3DVertex2TCoords(
                        1.0f,-1.0,0.0f,
                        0.0f,0.0f,-1.0f,
                        video::SColor(255,255,255,255),
                        1.0f+shiftX,1+shiftY,
                        1.0f+shiftX,1+shiftY);
 
            vertices[2] = video::S3DVertex2TCoords(
                        -1.0f,1.0,0.0f,
                        0.0f,0.0f,-1.0f,
                        video::SColor(255,255,255,255),
                        shiftX,shiftY,
                        shiftX,shiftY);
 
            vertices[3] = video::S3DVertex2TCoords(
                        1.0f,1.0f,0.0f,
                        0.0f,0.0f,-1.0f,
                        video::SColor(255,255,255,255),
                        1.0f+shiftX,shiftY,
                        1.0f+shiftX,shiftY);
 
/**Now we proceed to initialize the appropriate settings for the material we are going to use
We can alter these later, but for the time being, initializing then here will do no harm*/
 
            material.Lighting = false;                          //No need for lighting.
            material.MaterialType = video::EMT_LIGHTMAP_ADD;    //This will add both first and second textures :)
            material.BackfaceCulling=false;                     //not needed, but simplifies things
            setAutomaticCulling(scene::EAC_OFF);                //We don't need this scene
                                                                //node to be culled because we render it in screen space.
        }
 
        CScreenQuadSceneNode::~CScreenQuadSceneNode()
        {
        }
 
        const core::aabbox3df& CScreenQuadSceneNode::getBoundingBox() const
        {
            return aabb;
        }
 
        void CScreenQuadSceneNode::OnRegisterSceneNode()
        {
            //This method is empty because it is best for us to render this scene node manually.
            //So, it is never really rendered on its own, if we don't tell it to do so.
        }
 
        void CScreenQuadSceneNode::render()
        {
            video::IVideoDriver* drv = getSceneManager()->getVideoDriver();
            core::matrix4 proj;
             u16 indices[] = {0,1,2,3,1,2};
             //A triangle list
 
            drv->setMaterial(material);
 
            drv->setTransform(video::ETS_PROJECTION, core::IdentityMatrix);
            drv->setTransform(video::ETS_VIEW, core::IdentityMatrix);
            drv->setTransform(video::ETS_WORLD, core::IdentityMatrix);
 
            drv->drawIndexedTriangleList(&vertices[0],4,&indices[0],2);
 
        }
 
        u32 CScreenQuadSceneNode::getMaterialCount()
        {
            return 1;   //There is only one material
        }
 
        video::SMaterial& CScreenQuadSceneNode::getMaterial(irr::u32 i)
        {
            return material;//We always return the same material, so there is no need for more.
        }
 
};
 
/**Once we are done setting up the new Scene Node, it is time to start the engine*/
 
int main()
{
    char c;
    int effectType;
 
    video::E_DRIVER_TYPE driverType = driverChoiceConsole(true);
 
/**Not that we couldn't chain the effects though...*/
 
    cout<<"Which postproduction effect do you want?"<<endl
    <<"a) motion Blur"<<endl
    <<"b) Bloom/HDR"<<endl;
 
    cin>>c;
 
    c=toupper(c);
 
    switch(c){
        case 'A':
            effectType=0;
        break;
        case 'B':
            effectType=1;
        break;
        default:
            effectType=1;
        break;
    }
 
    SIrrlichtCreationParameters prm;
 
    prm.DriverType = driverType;
    prm.Bits = 32;
    prm.WindowSize = core::dimension2du(_WIDTH_,_HEIGHT_);
    //prm.Fullscreen = true;
 
    IrrlichtDevice* dev = createDeviceEx(prm);
 
    if(dev){
 
    scene::ISceneManager* smgr = dev->getSceneManager();
    video::IVideoDriver* drv = dev->getVideoDriver();
 
    if(drv->queryFeature(video::EVDF_RENDER_TO_TARGET)){
    if(drv->queryFeature(video::EVDF_RENDER_TO_TARGET)){
    if(drv->queryFeature(video::EVDF_TEXTURE_NPOT)){
 
    drv->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT,true);
    drv->setFog(video::SColor(255,226,177,141),video::EFT_FOG_LINEAR,100,1000,0.01);
 
/**Important stuff, Rendering textures setup.*/
    video::ITexture* mainTarget = drv->addRenderTargetTexture(prm.WindowSize,"mainTarget");
    video::ITexture* rtt0;
    video::ITexture* temp;
 
//These colors are needed to modify the colors of the RTT in order for them to mix adequately
//Using a shader, the mix is done within the shader code, but we are using just the
//fixed pipeline this time, so, we need some extra stuff. Normally, postprocessing is not
//this extended.
 
    video::SColor colors[] =
    {
        video::SColor(255,96,96,96),
        video::SColor(255,96,96,96),
        video::SColor(255,96,96,96),
        video::SColor(255,96,96,96)
    };
 
    video::SColor colors1[] =
    {
        video::SColor(255,224,224,224),
        video::SColor(255,224,224,224),
        video::SColor(255,224,224,224),
        video::SColor(255,224,224,224),
    };
 
    video::SColor colors2[] =
    {
        video::SColor(255,32,32,32),
        video::SColor(255,32,32,32),
        video::SColor(255,32,32,32),
        video::SColor(255,32,32,32)
    };
 
    switch(effectType){
        case 0://motion blur
            rtt0 = drv->addRenderTargetTexture(prm.WindowSize,"rtt0");
            temp = drv->addRenderTargetTexture(prm.WindowSize,"temp");//Mantiene temporalmente un resultado.
        break;
        case 1://HDR-bloom effect, we only need one texture for this :)
            rtt0 = drv->addRenderTargetTexture(core::dimension2du(32,32),"rtt0");
        break;
    }
    CScreenQuadSceneNode* screenQuad = new CScreenQuadSceneNode(smgr->getRootSceneNode(),smgr,10);
    screenQuad->getMaterial(0).setTexture(0,mainTarget);
    screenQuad->getMaterial(0).setTexture(1,rtt0);
 
    smgr->addCameraSceneNodeFPS();
    smgr->loadScene("postPro.irr");
 
    int lastFPS = -1;
 
    while(dev->run()){
        drv->beginScene();
        switch(effectType){
            case 0:
/**motionBlur.
We have the previous rendered frame stored, so, we render a new frame, and blend it
with the previous, the effect will look like things have a motion trail, and after
the scene is rendered, we draw it again to the first texture in order to repeat the
process*/
                drv->setRenderTarget(rtt0,true,true);
                    drv->draw2DImage(temp,core::rect<s32>(0,0,_WIDTH_,_HEIGHT_),core::rect<s32>(0,0,_WIDTH_,_HEIGHT_),
                    0,colors1);//Scale the colors of the previous render
                drv->setRenderTarget(mainTarget,true,true,video::SColor(255,128,160,160));
                    smgr->drawAll();//Draw the main scene
                drv->setRenderTarget(temp,true,true);
                    drv->draw2DImage(mainTarget,core::rect<s32>(0,0,_WIDTH_,_HEIGHT_),core::rect<s32>(0,0,_WIDTH_,_HEIGHT_),
                    0,colors2);//Scale the colors of the main Scene
                drv->setRenderTarget(mainTarget,true,true);
                    drv->draw2DImage(temp,core::rect<s32>(0,0,_WIDTH_,_HEIGHT_),core::rect<s32>(0,0,_WIDTH_,_HEIGHT_));
                    //Return TEMP to the mainTarget
                drv->setRenderTarget(temp,true,true);
                    screenQuad->render();//Draw the screenquad into temp
                drv->setRenderTarget(video::ERT_FRAME_BUFFER,true,true);
                    drv->draw2DImage(temp,core::position2di(0,0));//Draw the resulting image
 
            break;
            case 1:
/**Bloom.
We render the scene to the main RTT, and then, we scale and darken the RTT in order
to apply it to the screen quad, we are using inmediate values because of simplicity*/
                drv->setRenderTarget(mainTarget,true,true,video::SColor(255,128,160,160));
                    smgr->drawAll();
                drv->setRenderTarget(rtt0,true,true,video::SColor(0,0,0,0));
                    drv->draw2DImage(mainTarget,core::rect<s32>(0,0,32,32),core::rect<s32>(0,0,_WIDTH_,_HEIGHT_),
                    0,colors
                    );
                drv->setRenderTarget(video::ERT_FRAME_BUFFER,true,true);
                    screenQuad->render();
            break;
        }
        drv->endScene();
 
        int fps = drv->getFPS();
        if (lastFPS != fps)
        {
            core::stringw str = L"Postproduction Example - Irrlicht Engine [";
            str += drv->getName();
            str += "] FPS:";
            str += fps;
            dev->setWindowCaption(str.c_str());
            lastFPS = fps;
        }
 
    }
 
 
 
    }else{
 
        cout<<"This driver doesn't support Non power of two textures!."<<endl<<"This sample works only with support for Non power of two rendering textures"<<endl;
    }
 
    }else{
        cout<<"This driver doesn't support the render to textures!!."<<endl<<"Rendering to textures is required"<<endl;
    }
 
    }else{
        cout<<"This driver doesn't support Multitextures!!!."<<endl<<"Multitexturing is required"<<endl;
    }
    }
    return 0;
}
 
Two screens of this in action

Motion Blur
Image

Bloom (it is not very noticeable, though...)
Image
Last edited by Mel on Sat Feb 23, 2013 11:31 pm, edited 2 times in total.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Post by Mel »

I must say also that sometimes, the rendering target textures go black totally, as if no render was done, and that it has to do with the camera position, because moving the camera from a point to another makes the screen go black, and sometimes the screen returns to normal without any reason. but the effect itself works, so, i tend to think it is something tied with the way the textures are handled.

Also, although the code is the same for Open GL and Direct X, the Open GL version of the motion blur renders incorrectly, as if the texture was applied correctly and reversed at the same time. But on the other hand, the bloom effect renders okay with both drivers, so i don't know what to point at as the posible cause of that :?

Edit: The camera goes black when the white animated light comes near to it, in DirectX, while using the bloom effect.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
CuteAlien
Admin
Posts: 9682
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

I have also no idea what causes the troubles, but kudos for your work. Very cool!
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Post by Mel »

Bump: I found the solution. The problem was that the transform of the screenQuad was done only in Perspective and View, it also needs to transform the World matrix, or else, it seems it would have a conflict with the light scene node rendering. The compiled example, also, has been updated to show the changes i made :)

Now the issue with the screen going black is solved, the other problem, Open GL showing the scene duplicated is still there though... and that's something i really don't know how to handle :?

This is the motion blur, when the program runs on Open GL
Image

And this is the example when the code runs on Direct X
Image

The bloom, on the other side, looks nice on both drivers, and that's what i find odd. If the Open GL driver reflects one of the textures, why doesn't do the same with Bloom? May it be because i copy the rendered scene to a temporary texture, and then, i copy it back?... The bloom effect doesn't do that, so, i would point at that.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Grz-
Posts: 62
Joined: Wed Dec 26, 2007 1:06 pm

Post by Grz- »

EDIT: Code below (not the .zip) edited to get an even better glow look by adding previous frame+actual frame before the blur is applied altough now the second glow color intensity need to be reduced sometimes to avoid complete white screen, it also improve the look/quality of the glow without shaders.

Thank you for this.

I improved the glow effect to be near the level of the glow used in Tron 2.0 game using this article:

http://http.developer.nvidia.com/GPUGem ... _ch21.html

Image

It use a small blur shader (taken from here) but it also work without (altough kinda ugly), also there is another lower resolution rtt used to give more 'depth' and 'reduce' the glow flickering, by messing with the rtt resolution/color/blur size (look at horgblur.frag/vergblur.frag) it can produce pretty nice result.

Working version with sourcecode can be found here

Here is a small video of the sample:

http://www.youtube.com/watch?v=r0dwSsRueAA

glow setup:

Code: Select all

    // glow
    video::ITexture* mainTarget = 0, *rtt0 = 0, *rtt1 = 0;
    CScreenQuadSceneNode *screenQuad = 0, *screenQuad2 = 0, *screenQuad3 = 0;
    s32 matHorBlur, matVerBlur;
// theses values can be changed to modify the look of the glow/reduce artifacts
    int rtt0Size = 256;
    int rtt1Size = 256;
        if(driver->queryFeature(video::EVDF_RENDER_TO_TARGET))
        {
            if(driver->queryFeature(video::EVDF_MULTITEXTURE))
            {
                if(driver->queryFeature(video::EVDF_TEXTURE_NPOT))
                {
                    matHorBlur = loadShaders("data/fx/horgblur.vert", "data/fx/horgblur.frag");
                    matVerBlur = loadShaders("data/fx/vertgblur.vert", "data/fx/vertgblur.frag");

                    mainTarget = driver->addRenderTargetTexture(deviceParameter.WindowSize,"mainTarget");
                    rtt0 = driver->addRenderTargetTexture(core::dimension2du(rtt0Size,rtt0Size),"rtt0");
                    rtt1 = driver->addRenderTargetTexture(core::dimension2du(rtt1Size,rtt1Size),"rtt1");

                    screenQuad = new CScreenQuadSceneNode(smgr->getRootSceneNode(),smgr,40);
                    screenQuad->getMaterial(0).setTexture(0,mainTarget);
                    screenQuad->getMaterial(0).setTexture(1,rtt0);
                    screenQuad->getMaterial(0).setFlag(video::EMF_TRILINEAR_FILTER, false);
                    screenQuad->getMaterial(0).setFlag(video::EMF_ANISOTROPIC_FILTER, false);
                    screenQuad->getMaterial(0).setFlag(video::EMF_FOG_ENABLE, false);
                    screenQuad->getMaterial(0).setFlag(video::EMF_LIGHTING, false);

                    screenQuad2 = new CScreenQuadSceneNode(smgr->getRootSceneNode(),smgr,42);
                    screenQuad2->getMaterial(0).setTexture(0,rtt0);
                    screenQuad2->getMaterial(0).setFlag(video::EMF_TRILINEAR_FILTER, false);
                    screenQuad2->getMaterial(0).setFlag(video::EMF_ANISOTROPIC_FILTER, false);
                    screenQuad2->getMaterial(0).setFlag(video::EMF_FOG_ENABLE, false);
                    screenQuad2->getMaterial(0).setFlag(video::EMF_LIGHTING, false);

                    screenQuad3 = new CScreenQuadSceneNode(smgr->getRootSceneNode(),smgr,43);
                    screenQuad3->getMaterial(0).setTexture(0,rtt0);
                    screenQuad3->getMaterial(0).setTexture(1,rtt1);
                    screenQuad3->getMaterial(0).setFlag(video::EMF_TRILINEAR_FILTER, false);
                    screenQuad3->getMaterial(0).setFlag(video::EMF_ANISOTROPIC_FILTER, false);
                    screenQuad3->getMaterial(0).setFlag(video::EMF_FOG_ENABLE, false);
                    screenQuad3->getMaterial(0).setFlag(video::EMF_LIGHTING, false);
                }
            }
        }

    // fake glow color intensity
    video::SColor colors[] =
    {
        video::SColor(255,200,200,200),
        video::SColor(255,200,200,200),
        video::SColor(255,200,200,200),
        video::SColor(255,200,200,200)
    };

    // second glow color intensity (reducing theses values avoid complete white screen)
    video::SColor colors2[] =
    {
        video::SColor(255,140,140,140),
        video::SColor(255,140,140,140),
        video::SColor(255,140,140,140),
        video::SColor(255,140,140,140)
    };
glow render:

Code: Select all

            driver->setRenderTarget(mainTarget,true,true,video::SColor(255,128,160,160));
            smgr->drawAll();

            driver->setRenderTarget(rtt0,true,true,video::SColor(0,0,0,0));
            driver->draw2DImage(mainTarget,core::rect<s32>(0,0,rtt0Size,rtt0Size),core::rect<s32>(0,0,screenWidth,screenHeight),0,colors);
            screenQuad3->render();
            screenQuad2->getMaterial(0).MaterialType = (video::E_MATERIAL_TYPE)matHorBlur;
            screenQuad2->render();
            screenQuad2->getMaterial(0).MaterialType = (video::E_MATERIAL_TYPE)matVerBlur;
            screenQuad2->render();

            driver->setRenderTarget(rtt1,true,true,video::SColor(0,0,0,0));
            driver->draw2DImage(rtt0,core::rect<s32>(0,0,rtt1Size,rtt1Size),core::rect<s32>(0,0,rtt0Size,rtt0Size),0,colors2);

            driver->setRenderTarget(video::ERT_FRAME_BUFFER,true,true);
            screenQuad->render();
Last edited by Grz- on Sun Apr 17, 2011 7:25 pm, edited 4 times in total.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Post by Mel »

Yes, but the point in this test was to create the effects without shaders, and to ilustrate the creation of postprocessing routines.

You can perform the blurring of the scene using a smaller rendertarget and mix it using slightly shifted texture coordinates on the screenquad so the resulting image isn't that blocky.

Also, if you aply a hack which was posted some time ago in the forums, you can have antialiased postproduction (at least, under direct X), i can't find it atm, though...
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
kinkreet
Posts: 64
Joined: Thu Oct 31, 2013 7:53 pm
Location: Barcelona, Spain

Re: Postprocessing using only the fixed pipeline rendering.

Post by kinkreet »

Awesome effects :D

but i have a problem :/

I don't understand why, but the Color parameter of setRenderTarget doesn't work O__O", I deleted the color parameter and the result its the same render. I'm using OpenGL driver and Irrlicht 1.8 in Ubuntu with a GTX 460

drv->setRenderTarget(mainTarget,true,true,video::SColor(255,128,160,160));
smgr->drawAll();
drv->setRenderTarget(rtt0,true,true,video::SColor(0,0,0,0));

can anyone help me please?
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Postprocessing using only the fixed pipeline rendering.

Post by mongoose7 »

It's the clear colour - the colour you get if you don't render anything. If your scene covers the viewport, you won't see it.
kinkreet
Posts: 64
Joined: Thu Oct 31, 2013 7:53 pm
Location: Barcelona, Spain

Re: Postprocessing using only the fixed pipeline rendering.

Post by kinkreet »

Ok, that means the bloom effect works xD and then the problem is other.

The resultant render is darkest and the bloom is low resolution.

The resolution of the bloom could be modified with:

rtt0 = drv->addRenderTargetTexture(core::dimension2du(32,32),"rtt0");
....
drv->draw2DImage(mainTarget,core::rect<s32>(0,0,32,32),core::rect<s32>(0,0,_WIDTH_,_HEIGHT_),0,colors);

And the colors[] variable could be modified to see all more clear, but it isn't looks like the example.
Sorry for my English, for my ignorance >____< and thanks for all :)

With bloom:
Image

Without bloom:
Image
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Postprocessing using only the fixed pipeline rendering.

Post by The_Glitch »

If only I could get mels screenquad to work with shader pipline branch.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Postprocessing using only the fixed pipeline rendering.

Post by Mel »

Well, that is kind of a contradiction because this program was created with one thing in mind: Not to use a shader pipeline at all. Only the basic renderstate texture blends. If you are going to use a shader pipeline, it is better to create a much simpler screenquad than mine (in this sample, anyway) because that way you can have fine control of every aspect of the blending, and the postproduction.

Maybe a postproduction example should be added to the engine?
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Post Reply