[SOLVED] How change color of scene

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Lev_a
Posts: 52
Joined: Tue Jan 10, 2006 5:59 pm
Location: Toronto, Canada

[SOLVED] How change color of scene

Post 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(...);
Last edited by Lev_a on Tue Mar 21, 2006 3:56 pm, edited 1 time in total.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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?
Image Image Image
Lev_a
Posts: 52
Joined: Tue Jan 10, 2006 5:59 pm
Location: Toronto, Canada

Post 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?
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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.
Image Image Image
Warchief
Posts: 204
Joined: Tue Nov 22, 2005 10:58 am

Post 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 ;)]
Lev_a
Posts: 52
Joined: Tue Jan 10, 2006 5:59 pm
Location: Toronto, Canada

Post 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?
Lev_a
Posts: 52
Joined: Tue Jan 10, 2006 5:59 pm
Location: Toronto, Canada

Post 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();
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

That's what i said in my first reply :lol:
Image Image Image
Lev_a
Posts: 52
Joined: Tue Jan 10, 2006 5:59 pm
Location: Toronto, Canada

Post by Lev_a »

JP wrote:That's what i said in my first reply :lol:
Thanx, JP.
I could not read properly.
And I found "my" solution, but it's really your idea.
Sorry, for spam.
Topic closed.
Daggio
Posts: 9
Joined: Mon Oct 20, 2008 7:04 am
Location: Surabaya, Indonesia

Post 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 :D
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Post 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();

Daggio
Posts: 9
Joined: Mon Oct 20, 2008 7:04 am
Location: Surabaya, Indonesia

Post by Daggio »

thanks! it worked! :D

I don't know how can I be so foolish about the rendering order, but now everything's fine!

thanks a lot! :D
Post Reply