Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Luke
Admin
Posts: 449 Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:
Post
by Luke » Mon May 04, 2009 12:53 pm
hey, though I should post a bit of code I did lately for anaglyph rendering.
Code: Select all
void CGameEngine::drawAnaglyph()
{
vector3df oldPosition=camera->getPosition();
vector3df oldTarget=camera->getTarget();
matrix4 startMatrix=camera->getAbsoluteTransformation();
vector3df focusPoint= (camera->getTarget()-camera->getAbsolutePosition()).setLength(1) + camera->getAbsolutePosition() ;
//Left eye...
vector3df leftEye;
matrix4 leftMove;
leftMove.setTranslation( vector3df(-0.01f,0.0f,0.0f) );
leftEye=(startMatrix*leftMove).getTranslation();
//clear the depth buffer, and color
driver->beginScene( true, true, SColor(0,200,200,255) );
driver->getOverrideMaterial().Material.ColorMask=ECP_RED;
driver->getOverrideMaterial().EnableFlags=EMF_COLOR_MASK;
driver->getOverrideMaterial().EnablePasses=ESNRP_SKY_BOX+ESNRP_SOLID+ESNRP_TRANSPARENT+ESNRP_TRANSPARENT_EFFECT+ESNRP_SHADOW;
camera->setPosition( leftEye );
camera->setTarget( focusPoint );
draw(); // 'smgr->drawAll();' may go here
//Right eye...
vector3df rightEye;
matrix4 rightMove;
rightMove.setTranslation( vector3df(0.01f,0.0f,0.0f) );
rightEye=(startMatrix*rightMove).getTranslation();
//clear the depth buffer
driver->clearZBuffer();
driver->getOverrideMaterial().Material.ColorMask=ECP_GREEN+ECP_BLUE;
driver->getOverrideMaterial().EnableFlags=EMF_COLOR_MASK;
driver->getOverrideMaterial().EnablePasses=ESNRP_SKY_BOX+ESNRP_SOLID+ESNRP_TRANSPARENT+ESNRP_TRANSPARENT_EFFECT+ESNRP_SHADOW;
camera->setPosition( rightEye );
camera->setTarget( focusPoint );
draw(); // 'smgr->drawAll();' may go here
driver->endScene();
driver->getOverrideMaterial().Material.ColorMask=ECP_ALL;
driver->getOverrideMaterial().EnableFlags=0;
driver->getOverrideMaterial().EnablePasses=0;
camera->setPosition( oldPosition );
camera->setTarget( oldTarget );
}
similar to the code by bob, here:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=32209
but fixes a few problems, and more irrlicht friendly.
more images here
Last edited by
Luke on Mon May 04, 2009 1:15 pm, edited 1 time in total.
hybrid
Admin
Posts: 14143 Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:
Post
by hybrid » Mon May 04, 2009 1:02 pm
Wow, fantastic
Actually, this was the thing I wanted to try out with the override material, but I failed to find proper glasses. So I postponed it - guess I have to buy some urgently!
We should probably set up a tutorial with this code.
Malgodur
Posts: 195 Joined: Sun Mar 15, 2009 8:22 pm
Post
by Malgodur » Mon May 04, 2009 1:34 pm
Its for 1.5? I got a bunch off errors...
Code: Select all
rror C2039: 'getOverrideMaterial' : is not a member of 'irr::video::IVideoDriver'
error C2228: left of '.Material' must have class/struct/union
etc
Luke
Admin
Posts: 449 Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:
Post
by Luke » Mon May 04, 2009 1:47 pm
We should probably set up a tutorial with this code.
yeah sounds good.
Its for 1.5? I got a bunch off errors...
hmm, you may have to use the svn or wait for 1.6. sorry I always work off the svn, I forget what is in each version.
shadowslair
Posts: 758 Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria
Post
by shadowslair » Mon May 04, 2009 8:16 pm
Haha! This is niiice...
I`ll better wait for 1.6 also.
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
wITTus
Posts: 167 Joined: Tue Jun 24, 2008 7:41 pm
Location: Germany
Post
by wITTus » Tue May 05, 2009 11:09 am
@hybrid: Check out ebay, there you can find tons of these glasses.
@Luke: This is almost a candidate for the screenshot of the month competition. Absolutely awesome
. But is it real 3D? Normally the red and green bars around the objects should change their size with distance, shouldn't they?
Luke
Admin
Posts: 449 Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:
Post
by Luke » Tue May 05, 2009 11:19 am
@Luke: This is almost a candidate for the screenshot of the month competition. Absolutely awesome Cool. But is it real 3D? Normally the red and green bars around the objects should change their size with distance, shouldn't they? Question
yeah it is real 3d, and they do change. The red and green bars, reverse at the focus point (the difference between poping out, and looking far away), so it may not look like they change in that image.
have a look at some of the other shots here (you can see the size changing better):
http://corrodinggames.com/forums/viewtopic.php?f=1&t=16
wITTus
Posts: 167 Joined: Tue Jun 24, 2008 7:41 pm
Location: Germany
Post
by wITTus » Tue May 05, 2009 1:04 pm
True. Did I already mention that this is awesome?
Your LUA stuff is also quite cool btw.
Was it hard to implement?
CuteAlien
Admin
Posts: 9734 Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:
Post
by CuteAlien » Tue May 05, 2009 3:20 pm
Meh. I urgently need red-green glasses!
CuteAlien
Admin
Posts: 9734 Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:
Post
by CuteAlien » Wed May 06, 2009 2:49 pm
Hm, those are red-blue glasses. What will I need for that image here? Red-Green, Red-Blue, Red-XYZ?
wITTus
Posts: 167 Joined: Tue Jun 24, 2008 7:41 pm
Location: Germany
Post
by wITTus » Wed May 06, 2009 7:43 pm
In worst case, simply change the color within the code snippet
BlindSide
Admin
Posts: 2821 Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!
Post
by BlindSide » Thu May 07, 2009 1:36 am
CuteAlien wrote: Hm, those are red-blue glasses. What will I need for that image here? Red-Green, Red-Blue, Red-XYZ?
I knew you would say that you pedantic ****
Actually they are Red-Cyan glasses, the title is misleading. And this is Red-Cyan anaglyph rendering (RED/GREEN+BLUE):
From luke's code:
Code: Select all
driver->getOverrideMaterial().Material.ColorMask=ECP_GREEN+ECP_BLUE;
Yes I am hustlin' for my 1 DX point per 5 glass purchased.
ShadowMapping for Irrlicht!:
Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
CuteAlien
Admin
Posts: 9734 Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:
Post
by CuteAlien » Thu May 07, 2009 2:03 am
BlindSide wrote: CuteAlien wrote: Hm, those are red-blue glasses. What will I need for that image here? Red-Green, Red-Blue, Red-XYZ?
I knew you would say that you pedantic **** :P
Lol - purely innocent curiosity - I really had no idea :-)
thatdudeoverthere
Posts: 28 Joined: Fri Apr 24, 2009 2:43 pm
Location: over there...
Post
by thatdudeoverthere » Sun May 10, 2009 5:35 am
i'm having a seizure... oh, the images just look like that anyhow good work. lol