Defining a render order?

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.
JuJuBean

Defining a render order?

Post by JuJuBean »

I was curious if there is a way to tell irrlicht in which order to render objects? For example, if I had 15 boxs, and wanted to render them (all in one frame) but wanted to render them in a certain distinct order, is that possible? I ask, because I want to attempt to implement a specific type of 2D mixed with 3D effect. Thanx.
l0calh05t
Posts: 68
Joined: Wed Apr 07, 2004 7:08 pm

Post by l0calh05t »

yes.

simply call draw for each scene node individually instead of calling draw all in the scene manager
Raw data for raw nerves

My main PC: Athlon XP 2800+, 512MB RAM, ATI Radeon 9700 Pro 128MB, Win2k SP4
My secondary PC: Pentium III 500 Mhz, 256MB RAM, TNT2 64, Gentoo Linux
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

They would still only appear on screen at the same time as it is only rendering one frame to the moniter so I don't think that is what you mean. You are going to have to explain a little more clearly and give an example I think.
l0calh05t
Posts: 68
Joined: Wed Apr 07, 2004 7:08 pm

Post by l0calh05t »

Tyn wrote:They would still only appear on screen at the same time as it is only rendering one frame to the moniter so I don't think that is what you mean. You are going to have to explain a little more clearly and give an example I think.
he said all in one frame
Raw data for raw nerves

My main PC: Athlon XP 2800+, 512MB RAM, ATI Radeon 9700 Pro 128MB, Win2k SP4
My secondary PC: Pentium III 500 Mhz, 256MB RAM, TNT2 64, Gentoo Linux
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Am I missing something? That's the point I am making. It doesn't matter what order you are rendering 3D objects in as the frame is worked out in it's entirety then sent to the moniter to be viewed in one frame. The position of the nodes determines the way it is viewed, not the order it is rendered in.
thesmileman
Posts: 360
Joined: Tue Feb 10, 2004 2:20 am
Location: Lubbock, TX

Post by thesmileman »

He is wanting to have 2D effects and 3d effects mixed I woudl assume something like Paper Mario. He would want 2d elements to apear to behind some 3D elements and infront of others. The only have to control that would be by drawing the elements one by one in the right depth order. At least I think so.
JuJuBean

Post by JuJuBean »

SmileMan hit it on the nose, I need to be able to controle the rendering order to "controle" the z buffer from cutting out my 2D elements that need to be place behind, or in front of my 3D objects. Thank you all for the quick response.

Is it very difficult to do what localhost has suggested? Call the render individualy instead of globaly? Also, if I do it that way, does irrlicht still cull the non visable objects, even though I declare to render them? Or must I now do my visual culling on my own after that?

And could someone give me a little code post, of how to turn off global rendering, and how to post an individual object for rendering?
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

If you are talking about using GUI images behind 3D meshes then call:

guienv->draw();
smgr->draw();

This will draw the GUI elements behind the 3D elements as opposed to drawing the 3D elements first which is the normal procedure. Personally, I would recommed using a billboard system if you were thinking of doing something simular to FF. In this way you can just place the billboard behind the meshes and do things that way. Using billboards is 10x more simple than going through and rendering each item seperatly as you would need a system to handle the render order. By all means try this if you want but you are reinventing the wheel.
JuJuBean

Post by JuJuBean »

I think I am probly going to have to control the render order, because I am going to need about a dozen different layers for the 2D, and I will also have to decide which layers the 3D models are to be rendered between.
thesmileman
Posts: 360
Joined: Tue Feb 10, 2004 2:20 am
Location: Lubbock, TX

Post by thesmileman »

JuJuBean wrote: Is it very difficult to do what localhost has suggested? Call the render individualy instead of globaly? Also, if I do it that way, does irrlicht still cull the non visable objects, even though I declare to render them? Or must I now do my visual culling on my own after that?

And could someone give me a little code post, of how to turn off global rendering, and how to post an individual object for rendering?

If what localhost suggest will work I do not think it would be very hard to do at all. To draw each object you will need to call each item from farthest to closest using drawMeshBuffer() for 3d objects and draw() for 2d images.

There is no code to turn off global rendering only the code drawall that you would put in yourself. just don't put it there and use the above to render each object.

As for visual culling I think this is based on whether or not you use an octree or not to store the mesh. I don't think that anything would be affected by rendering individually but I am not sure.
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Feel free by all means, but I would still advise you actually use psudo-2d graphics with billboards. What I mean by this is that you use billboards which are a 3D box with no Z axis. They always face the camera so they always look like a 2D image. In this way you can position them in 3D space and control where the 3D models are in relation to the billboard images.

__________|
____|_____|
____|_____|
____|_____|
|___|_____|
|_________|
|_________|

This horrible ASCII art diagram shows the sandwich of where the billboards would be if the camera was on the left hand side looking towards the right hand side. The far left and far right series of lines would be the billboards and the middle column would be the 3D mesh. The effect would be that it would appear that the 3D mesh was inbetween two 2D images.

You could always create your own rendering pipeline with the mesh in the middle but you would have to write this yourself which would be a lot harder than using this method.
l0calh05t
Posts: 68
Joined: Wed Apr 07, 2004 7:08 pm

Post by l0calh05t »

JuJuBean wrote:SmileMan hit it on the nose, I need to be able to controle the rendering order to "controle" the z buffer from cutting out my 2D elements that need to be place behind, or in front of my 3D objects. Thank you all for the quick response.

Is it very difficult to do what localhost has suggested? Call the render individualy instead of globaly? Also, if I do it that way, does irrlicht still cull the non visable objects, even though I declare to render them? Or must I now do my visual culling on my own after that?

And could someone give me a little code post, of how to turn off global rendering, and how to post an individual object for rendering?
That's what I thought.

It's not difficult, you just have to keep track of the scene nodes individually and call the draw routines individually. In one of my programs I have one scene node which is not stored in the scene manager for which i do this. You will probably have to do culling yourself although I'm not sure (check the implementation).

You don't have to turn of global rendering, just don't call drawAll for the scene manager.

To render a scenenode just call yourSceneNodePointer->draw() that's it.
Raw data for raw nerves

My main PC: Athlon XP 2800+, 512MB RAM, ATI Radeon 9700 Pro 128MB, Win2k SP4
My secondary PC: Pentium III 500 Mhz, 256MB RAM, TNT2 64, Gentoo Linux
thesmileman
Posts: 360
Joined: Tue Feb 10, 2004 2:20 am
Location: Lubbock, TX

Post by thesmileman »

What Tyn is suggesting is good as it would handle the resizing of the models for you. The only problem with that is that if you want models on the sides of the screen not to get smaller then the ones in the center at the same depth then you would have to have a very low FOV or handle their positions in a werid way.
JuJuBean

Post by JuJuBean »

Ok, another quick question, is it even possible to render part of a scene using ortho, and another part of the scene using projection? I think I might also need to do this with some of my 2D elements??
JuJuBean

Post by JuJuBean »

Wow, ok, Perspective and ortho at the same time, just realized I use the wrong **** word. lol.
Post Reply