Page 1 of 1
[SOLVED] How change color of scene
Posted: Mon Mar 20, 2006 8:55 pm
by Lev_a
I want create night scene. But I don't want create real-time lights and shadows - it's really effected on fps. I just need made everything a little bit dark-blue. Like put mask on output window, but GUI - should be the same color.
I want keep:
ModelNode->setMaterialFlag(EMF_LIGHTING, false);
And I don't want use:
smgr->addLightSceneNode(...);
and
driver->setAmbientLight(...);
Posted: Mon Mar 20, 2006 9:52 pm
by JP
Could you maybe draw a 2D rectangle the full size of the screen and make it a seethru dark blue colour?
EDIT:
That won't work actually as it just draws the outline of a 2D rectangle.
maybe you oculd use draw2DImage and load a texture which is just a seethru blue rectangle?
Posted: Mon Mar 20, 2006 10:11 pm
by Lev_a
JP wrote:Could you maybe draw a 2D rectangle the full size of the screen and make it a seethru dark blue colour?
I already think about it.
If any other solutions for it?
I found
http://irrlicht.sourceforge.net/phpBB2/ ... 8831#58831
and I tryed:
ModelNode->getMaterial(0).AmbientColor.set(150, 50, 50, 255);
And no effect at all.
Any ideas?
Posted: Mon Mar 20, 2006 10:39 pm
by JP
I tried the draw2DImage thing but couldnt get it drawing see thru, just opaque.
My only other guess is that a shader might do the job.
Posted: Mon Mar 20, 2006 11:47 pm
by Warchief
Lev_a wrote:JP wrote:Could you maybe draw a 2D rectangle the full size of the screen and make it a seethru dark blue colour?
I already think about it.
If any other solutions for it?
I found
http://irrlicht.sourceforge.net/phpBB2/ ... 8831#58831
and I tryed:
ModelNode->getMaterial(0).AmbientColor.set(150, 50, 50, 255);
And no effect at all.
Any ideas?
Have not tried it (and cant atm), but check if you get it with:
Code: Select all
driver->beginScene();
SMaterial mat;
mat.AmbienColor.set(150, 50, 50, 255);
driver->setMaterial( mat );
driver->endScene();
UHM, sry; havent read you didnt want to use driver->setAmbientLight(...); [probably the same effect; OR MAYBE NOT, try and tell
]
Posted: Tue Mar 21, 2006 3:29 pm
by Lev_a
Warchief wrote:
Have not tried it (and cant atm), but check if you get it with:
Code: Select all
driver->beginScene();
SMaterial mat;
mat.AmbienColor.set(150, 50, 50, 255);
driver->setMaterial( mat );
driver->endScene();
UHM, sry; havent read you didnt want to use driver->setAmbientLight(...); [probably the same effect; OR MAYBE NOT, try and tell
]
Doesn't work - no any effects.
I just need put glasses on users eyes with color(.....).
I don't want use dynamic or other lights - I just want change color of air.
Any ideas?
Posted: Tue Mar 21, 2006 3:55 pm
by Lev_a
I found solution:
Code: Select all
driver->beginScene();
.....
irr::video::SColor col = irr::video::SColor(50, 0, 0, 150);
irr::core::rect<s32> pos = irr::core::rect<s32>(0, 0, 800, 600);
driver->draw2DRectangle(col, pos);
......
driver->endScene();
Posted: Tue Mar 21, 2006 4:18 pm
by JP
That's what i said in my first reply
Posted: Tue Mar 21, 2006 5:02 pm
by Lev_a
JP wrote:That's what i said in my first reply
Thanx, JP.
I could not read properly.
And I found "my" solution, but it's really your idea.
Sorry, for spam.
Topic closed.
Posted: Tue Jan 06, 2009 6:01 am
by Daggio
um....sorry to bump this thread up but I have the same problem with the thread starter,create a night scene
I've read the solutions he made (actually, JP made it) but it just didn't work on me
I typed the code just as he showed in the previous post, like this
Code: Select all
driver->beginScene();
video::SColor col = video::SColor(50, 0, 0, 150);
core::rect<s32> pos = core::rect<s32>(0,0,800,600);
driver->draw2DRectangle(col,pos);
// some other rendering codes here
driver->endScene();
but nothing happened, my scene still as bright as day
your help will be appreciated
Posted: Tue Jan 06, 2009 6:08 am
by Ion Dune
The problem is you're drawing the rectangle before you draw your stuff, do it the other way around:
Code: Select all
driver->beginScene();
// render scene here
video::SColor col = video::SColor(50, 0, 0, 150);
core::rect<s32> pos = core::rect<s32>(0,0,800,600);
driver->draw2DRectangle(col,pos);
// if applicable, render gui here
driver->endScene();
Posted: Tue Jan 06, 2009 6:30 am
by Daggio
thanks! it worked!
I don't know how can I be so foolish about the rendering order, but now everything's fine!
thanks a lot!