looks like you removed one of the bits of the flare, and it looks better without it, so I'm removing it from the main release.
code & screenshot of the bug would be helpful, yes.
I (finally) finished the next update. Sorry it took longer than expected, life intervened.
Changes:
* Lens flare only shows when the sun is visible. The method used is a little slow, but usually fast enough. *important*: this judges visibility by pixel brightness, so your sun MUST be > 90% white, and occluding objects should be mainly < 90% white.
* Most shaders play nice with the z-depth now.
* All shaders to use standard opengl variables (gl_TexCoord[0]) instead of custom ones (mTC) - this may make them more efficient (?) and will need custom effects to be changed to fit.
* Some effects now use built-in material types without custom shaders, which should make them faster (only 1 shader instead of 2)
* I've removed all "using namespace" requirements; they are now optional, so it should fit in better with projects
* I changed all shortcut variable types to the full version (i.e. vector3df -> vector3d<f32>), which should avoid problems with different setups/versions of irrlicht
* I've added a quality setting, so for example PP_BLURFINE doesn't exist any more, use PP_BLUR and setQuality( PPQ_HIGH ). All blurs support at least 2 quality levels, most 3. Some other effects also support quality levels. The quality levels are; PPQ_DEFAULT (standard, regular use) PPQ_FAST (for slow machines or lots of effects) PPQ_CRUDE (not as accurate, but fastest possible without disabling the shader) PPQ_HIGH (better look, for faster computers / simple scenes) and PPQ_BEST (no effects support this yet, so for now it's like using PPQ_HIGH)
same download location as before.
Adler1337; if this doesn't fix the old monitor effect for you, please try these;
1) does the effect work in the demo? i.e. is it only broken when you try including it in your own project?
2) try this shader in it's place, is it still broken?
Code: Select all
#define GL_OLDMONITOR "uniform float randNum,time,vecValue0;uniform sampler2D texture1;float tear(in float y){return (y-0.8)*0.01/(y*y*y*y+2.0);}void main(void){float c=dot(texture2D(texture1,vec2(floor(gl_TexCoord[0].x/0.002)*0.002+tear((gl_TexCoord[0].y-1.2+mod(time*0.1,1.4))*50.0)*5.0*vecValue0,floor(gl_TexCoord[0].y/0.005)*0.005+floor(mod(time*0.1+randNum*0.1,1.0)*1.1)*0.03*vecValue0)),vec4(0.2,0.5,0.3,0.0));gl_FragColor=(texture2D(texture1,vec2(gl_TexCoord[0].x+tear(tan(gl_TexCoord[0].y*10.0+time*2.0))*vecValue0,gl_TexCoord[0].y))*(1.0-0.7*vecValue0)+c*0.7*vecValue0+vec4(1.0)*0.1*vecValue0)*(1.0-(sin(gl_TexCoord[0].y*400.0)*0.05+(pow(gl_TexCoord[0].x*2.0-1.0,4.0)+pow(gl_TexCoord[0].y*2.0-1.0,4.0))*0.5)*vecValue0);}"
3) try the GL_A_SIMPLER_SHADER (from main.cpp in the example) in it's place, still broken?
4) if you can, tell me what errors (if any) appear on the command prompt when you run it (I don't know how to do this in windows, other than running the exe via the command line)
thanks
edit: Adler, seems I missed your last post, sorry about that. Here is the exact code I am using to test; (it's entirely from the example, just copied & pasted about a bit). This doesn't have the error for me.
Code: Select all
#ifdef _IRR_WINDOWS_
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#pragma comment(lib, "Irrlicht.lib")
#endif
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#include "CRendererPostProc.h"
#include "CEffectPostProc.h"
#include "CTransitionPostProc.h"
#include "CSplitPostProc.h"
#include "CLensFlarePostProc.h"
#include "CWaterPostProc.h"
#define GL_OLDMONITOR "uniform float randNum,time,vecValue0;uniform sampler2D texture1;float rand(in float s){return sin(gl_TexCoord[0].x*(1009.0+s*10.0)+tan(gl_TexCoord[0].y*(1090.0+s*100.0)+tan(gl_TexCoord[0].x*111.0+s*10000.0))+s*4.0+gl_TexCoord[0].y*10000.0)*0.5+0.5;}float tear(in float y){return (y-0.8)*0.01/(y*y*y*y+2.0);}void main(void){float c=dot(texture2D(texture1,vec2(floor(gl_TexCoord[0].x/0.002)*0.002+tear((gl_TexCoord[0].y-1.2+mod(time*0.1,1.4))*50.0)*rand(randNum)*5.0*vecValue0,floor(gl_TexCoord[0].y/0.005)*0.005+floor(mod(time*0.1+randNum*0.1,1.0)*1.1)*0.03*vecValue0)),vec4(0.2,0.5,0.3,0.0));gl_FragColor=(texture2D(texture1,vec2(gl_TexCoord[0].x+tear(tan(gl_TexCoord[0].y*10.0+time*2.0))*vecValue0,gl_TexCoord[0].y))*(1.0-0.7*vecValue0)+c*0.7*vecValue0+vec4(rand(randNum))*0.1*vecValue0)*(1.0-(sin(gl_TexCoord[0].y*400.0)*0.05+(pow(gl_TexCoord[0].x*2.0-1.0,4.0)+pow(gl_TexCoord[0].y*2.0-1.0,4.0))*0.5)*vecValue0);}"
#define DX_OLDMONITOR ""
int main( ) {
IrrlichtDevice* device = createDevice( video::EDT_OPENGL, dimension2d<s32>( 640, 480 ), 16, false, false, false, 0 );
IVideoDriver* driver = device->getVideoDriver( );
ISceneManager* smgr = device->getSceneManager( );
IGUIEnvironment* guienv = device->getGUIEnvironment( );
guienv->addStaticText( L"Custom Effect (Old Monitor)", rect<s32>( 10, 10, 260, 22 ), true );
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( smgr->getMesh( "../../media/sydney.md2" ) );
node->setMaterialFlag( EMF_LIGHTING, false );
node->setMD2Animation( scene::EMAT_STAND );
node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
smgr->addCameraSceneNode( 0, vector3df( 40.0f, 30.0f, -40.0f ), vector3df( 0.0f, 5.0f, 0.0f ) );
ISceneNode* sun = smgr->addSphereSceneNode( 50.0f, 16 );
sun->setPosition( vector3df( -500.0f, 0.0f, 1000.0f ) );
sun->setMaterialFlag( EMF_LIGHTING, false );
sun->setMaterialTexture( 0, driver->getTexture("../../media/sun.png") );
IPostProc* ppRenderer = new CRendererPostProc( smgr, dimension2di( 1024, 512 ), true, true, SColor( 255u, 100u, 101u, 140u ) );
CLensFlarePostProc* ppFlare = new CLensFlarePostProc( ppRenderer, dimension2di( 1024, 512 ), driver->getTexture("../../media/flare.png"), sun, 50.0f );
CEffectPostProc* ppMine = new CEffectPostProc( ppFlare, dimension2di( 1024, 512 ), GL_OLDMONITOR, DX_OLDMONITOR, EPST_PS_1_2, EMT_SOLID, PPF_FROMCODE, 1.0f );
ppMine->setTimer( device->getTimer( ) );
while( device->run( ) ) {
ppMine->setParameters( min_( 1.0f, device->getTimer( )->getTime( ) * 0.0002f ) );
driver->beginScene( false, false );
ppMine->render( NULL );
guienv->drawAll( );
driver->endScene( );
}
delete ppMine;
delete ppFlare;
delete ppRenderer;
device->drop();
return 0;
}