A simple, robust and extendible postprocessing class
-
- Posts: 914
- Joined: Fri Aug 03, 2007 12:43 pm
- Location: South Africa
- Contact:
Yeah it happens to all of the examples and my project.I guess you mean all the examples?
When i use DIRECT3D9 and run, it says "HLSL vertex shader compilation failed: error X3501: 'main': entrypoint not found". It displays that 3 times.Have you tried switching it to DIRECT3D9 instead of OPENGL?
When i use opengl it doesn't display anything. It just crashes. And this is what it displays in the call stack:
> Mars.exe!CEffectPostProc::setShader(const char * prog_gl=0x0043db18, const char * prog_dx=0x0043dbb0, irr::video::E_PIXEL_SHADER_TYPE gl_ps=EPST_PS_1_1, irr::video::E_PIXEL_SHADER_TYPE dx_ps=EPST_PS_2_0, irr::video::SMaterial * tgt=0x022d3dcc) Line 496 + 0xa bytes C++
Mars.exe!CEffectPostProc::setShader(const char * prog_gl=0x0043db18, const char * prog_dx=0x0043dbb0, irr::video::E_PIXEL_SHADER_TYPE gl_ps=EPST_PS_1_1, irr::video::E_PIXEL_SHADER_TYPE dx_ps=EPST_PS_2_0) Line 86 + 0x44 bytes C++
Mars.exe!CEffectPostProc::CEffectPostProc(IPostProc * follow1=0x0034dc98, irr::core::dimension2d<int> sOut={...}, POSTPROC_EFFECTID effectID=PP_RANGE, float para1=0.00000000, float para2=1.0000000, float para3=7285624.0, float para4=7285624.0, float para5=7285624.0, float para6=7285624.0, float para7=7285624.0, float para8=7285624.0) Line 190 C++
Mars.exe!CEffectPostProc::CEffectPostProc(IPostProc * follow1=0x0034dc98, irr::core::dimension2d<int> sOut={...}, POSTPROC_EFFECTID effectID=PP_NIGHTVISION, float para1=0.50000000, float para2=0.0049999999, float para3=0.30000001, float para4=7285624.0, float para5=7285624.0, float para6=7285624.0, float para7=7285624.0, float para8=7285624.0) Line 109 + 0x89 bytes C++
Mars.exe!wmain(int argc=1, wchar_t * * argv=0x003459e8) Line 269 + 0xbc bytes C++
(This changes to where ever an effect is.)
Mars.exe!__tmainCRTStartup() Line 583 + 0x19 bytes C
Mars.exe!wmainCRTStartup() Line 403 C
I tried changing my code around, but it still does the same thing. I don't know what is happening.
multum in parvo
ok, FuzzYspo0N - thanks, that seems to have removed the error, although I'm not sure if closeDevice is doing everything that's needed - it now behaves as though I'd simply removed the drop line (not sure what more I expected it to do!)
Adler1337 - I've tidied up some constructors (before I wasn't initializing everything properly) which may fix your problem. Do you get any errors like "An unhandled exception of type 'System.NullReferenceException' occurred in PostProcessor.exe"? because the bug you're seeing is in some code which is nearly identical to another bit which is apparently working! Confusing.
I also made the incomplete directX shaders act like a PP_DIRECT shader, so you'll be able to run your program in DIRECT3D9 mode now, though some effects won't work.
New version's at the same place as always.
Adler1337 - I've tidied up some constructors (before I wasn't initializing everything properly) which may fix your problem. Do you get any errors like "An unhandled exception of type 'System.NullReferenceException' occurred in PostProcessor.exe"? because the bug you're seeing is in some code which is nearly identical to another bit which is apparently working! Confusing.
I also made the incomplete directX shaders act like a PP_DIRECT shader, so you'll be able to run your program in DIRECT3D9 mode now, though some effects won't work.
New version's at the same place as always.
Code: Select all
IPostProc* ppRenderer = new CRendererPostProc(smgr, dimension2di( 1024, 512 ), true, true, SColor( 255, 100, 101, 140 ) );
CEffectPostProc* ppMotionBlur = new CEffectPostProc( ppRenderer, dimension2di( 1024, 512 ), PP_MOTIONBLUR);
while(device->run())
{
driver->beginScene( false, driver->getDriverType( ) == video::EDT_DIRECT3D9);
ppMotionBlur->render(NULL);
guienv->drawAll();
driver->endScene();
}
multum in parvo
It's still not working for some reason.Adler1337 wrote:Hope this helps. Also there is main.cpp to look at.Code: Select all
IPostProc* ppRenderer = new CRendererPostProc(smgr, dimension2di( 1024, 512 ), true, true, SColor( 255, 100, 101, 140 ) ); CEffectPostProc* ppMotionBlur = new CEffectPostProc( ppRenderer, dimension2di( 1024, 512 ), PP_MOTIONBLUR); while(device->run()) { driver->beginScene( false, driver->getDriverType( ) == video::EDT_DIRECT3D9); ppMotionBlur->render(NULL); guienv->drawAll(); driver->endScene(); }
Last edited by Tannz0rz on Sun Sep 27, 2009 11:36 pm, edited 2 times in total.
odd - if you can post the code you're using I may be able to fix that.Tannz0rz wrote:Found the problem, apparently the skybox I was using was somehow stopping the shaders, anyone else have this problem?
(I think m_krzywy uses a skybox in his project with this. Probably a problem with a specific type of skybox)
Adler1337;
hurrah! glad it's all working
Well, I've found that it won't work with any skybox nor skydome that I have whatsoever.DavidJE13 wrote:odd - if you can post the code you're using I may be able to fix that.Tannz0rz wrote:Found the problem, apparently the skybox I was using was somehow stopping the shaders, anyone else have this problem?
(I think m_krzywy uses a skybox in his project with this. Probably a problem with a specific type of skybox)
Adler1337;
hurrah! glad it's all working
I'll just toss in the main portion of the code:
Code: Select all
int main(int argc, char** argv)
{
MyEventReceiver receiver;
IrrlichtDevice *device =
createDevice(EDT_OPENGL, dimension2d<s32>(640, 480), 16,
false, false, false, &receiver);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
ply = smgr->addCubeSceneNode();
IAnimatedMesh * movingplane;
movingplane = smgr->addHillPlaneMesh("floor",
core::dimension2d<f32>(20,20),
core::dimension2d<u32>(40,40), 0, 0,
core::dimension2d<f32>(0,0),
core::dimension2d<f32>(10,10));
/*
scene::ISceneNode* skybox=smgr->addSkyBoxSceneNode(
driver->getTexture("media/skybox/nightsky_up2.png"),
driver->getTexture("media/skybox/nightsky_down.png"),
driver->getTexture("media/skybox/nightsky_north.png"),
driver->getTexture("media/skybox/nightsky_south.png"),
driver->getTexture("media/skybox/nightsky_east.png"),
driver->getTexture("media/skybox/nightsky_west.png"));
smgr->addSkyDomeSceneNode(driver->getTexture("media/SKY_DOME.jpg"));
*/
IAnimatedMeshSceneNode *floor=smgr->addAnimatedMeshSceneNode(movingplane);
if (ply)
{
ply->setMaterialFlag(EMF_LIGHTING, false);
ply->setPosition(vector3df(100,0,100));
}
camera = smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
IPostProc* ppRenderer = new CRendererPostProc(smgr, dimension2di( 640, 480 ), true, true, SColor( 255, 100, 101, 140 ) );
CEffectPostProc* ppMotionBlur = new CEffectPostProc( ppRenderer, dimension2di( 640, 480 ), PP_MOTIONBLUR);
while(device->run())
{
UpdateCamera();
driver->beginScene(true, true, SColor(0,200,200,200));
ppMotionBlur->render( NULL );
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
return 0;
}
Code: Select all
ppMotionBlur->render( NULL );
smgr->drawAll();
edit: worked it out; it's working when the skybox is disabled because smgr->drawAll isn't filling the screen, so transparent areas are showing the blur. With the skybox, nowhere is transparent during this second render.
btw, you're using non-power-of-two sizes for your post-processing render targets, which is fine but might cause slowdown on some cards (I'm not sure on the details). I'd recommend using 1024x512, unless graphics memory usage is important. This also gives you anti-aliasing on almost all setups for free!