How to make a gradient on the background color

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.
arfgh
Posts: 104
Joined: Sat Aug 26, 2006 6:15 am

How to make a gradient on the background color

Post by arfgh »

Is possible to produce a background gradient on the scene ?
I don`t know have any idea to do.
Kriolyth
Posts: 26
Joined: Wed Mar 26, 2008 6:59 pm
Location: Moscow, Russia

Post by Kriolyth »

Draw a full-screen quad with vertex colors you need and lighting disabled. Turn off Z-buffer as well.
The cake is a lie.
arfgh
Posts: 104
Joined: Sat Aug 26, 2006 6:15 am

Post by arfgh »

can someone show some example ?

also, is not possible to create the gradient using only the background color ?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Questions is what a gradient with just the background color would be. You know, gradients need at least two colors...
But no, there's no toehr way, and the suggested one is pretty simple.
arfgh
Posts: 104
Joined: Sat Aug 26, 2006 6:15 am

Post by arfgh »

well hybird. Maybe is simple, but if we need to disable the z-buffer this will affect to the quality of the whole scene ?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, because you only disable it for rendering the quad (which is in the background anyway).
arfgh
Posts: 104
Joined: Sat Aug 26, 2006 6:15 am

Post by arfgh »

ok hybrid, but can you show me n example of the use of this procedure ? i am very new at all this :(
kornwaretm
Competition winner
Posts: 189
Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:

Post by kornwaretm »

make that background on adobe or what ever tools u have. use the

Code: Select all

virtual void irr::video::IVideoDriver::draw2DImage  (  const video::ITexture *  texture,  
  const core::rect< s32 > &  destRect,  
  const core::rect< s32 > &  sourceRect,  
  const core::rect< s32 > *  clipRect = 0,  
  video::SColor *  colors = 0,  
  bool  useAlphaChannelOfTexture = false 
 )  [pure virtual] 
put this code before the smgr->drawAll();
ofcourse u cant use skydome or sky box for your scene, otherwise your background will covered.
can you please read the Irrlicht Engine 1.4 API documentation
it is located on \irrlicht-1.4\doc\irrlicht.chm , on your hardDrive.
there's also some (one may be...) example about drawing 2d image included with the engine.
arfgh
Posts: 104
Joined: Sat Aug 26, 2006 6:15 am

Post by arfgh »

we are not talking about to put a texture on screen.
We are talking about to make a plane to show a gradient using the vertex colors.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Look at the custom scene node example/tutorial and work from there. It shows you how to do gradient colours and it shows how to construct shapes, you should be able to figure out how to create just a plane instead of the pyramid type shape.
Image Image Image
arfgh
Posts: 104
Joined: Sat Aug 26, 2006 6:15 am

Post by arfgh »

yes but the problem is the fact i need this plane be on the background and covering the full irrlicht window.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

So you've got your plane with the gradient coded and working? If not then get that working first, then you can tackle the problem of making it fill the background.

You could draw it by parenting the node to the camera and making it large enough to fill the view (fairly small and close to the camera should do it). When it's actually rendered you'll want to make sure the z write is disabled, that can be done in the material setting of the custom scene node, check the API for the correct way of doing this.
Image Image Image
arfgh
Posts: 104
Joined: Sat Aug 26, 2006 6:15 am

Post by arfgh »

anyways JP what tutorial you mean ?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Holy hell. The custom scene node example is included in the Irrlicht distribution in examples/03.CustomSceneNode/main.cpp. You already have the file on your machine, you just need to look at it.

Travis
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Yeah... there's not much more you can say apart from the custom scene node tutorial.... That's as descriptive as it gets :P
Image Image Image
Post Reply