Possible to render objects in front of others?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Possible to render objects in front of others?

Post by disanti »

Hello,

I'm wondering if it is possible to render a 3d object in front of another 3d object no matter what the ZBuffer says. I tried disabling the ZBuffer material flag, it worked, however all the faces were inverted after that (as if that flag flips normals).

So I'm wondering if there is a way to force a 3d object on top of another... Multi-pass rendering? I don't know, some suggestions?
________
HEMP
Last edited by disanti on Sun Feb 27, 2011 11:11 pm, edited 1 time in total.
Eternl Knight
Posts: 313
Joined: Tue Nov 01, 2005 5:01 am

Post by Eternl Knight »

That flag doesn't flip normals, but without ZBuffering the triangles rendered in an arbitrary order and not culled. So it is not "flipping" the normals but rendering all triangles on top of each other without regard for depth.

What you need to do is clear the ZBuffer such as via the following snippet of code...

Code: Select all

device->getVideoDriver()->clearZBuffer();
--EK
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

Awesome! ^_^ I'll get to it! thanks
________
WEED VAPORIZER
Last edited by disanti on Sun Feb 27, 2011 11:11 pm, edited 1 time in total.
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

Darn it! It isn't working...

Code: Select all

	// render delayed default objects

	CurrentRendertime = ESNRP_SOLID_LAST;

	DelayedSolidNodeList.sort(); // sort by textures

	for (i=0; i<DelayedSolidNodeList.size(); ++i)
	{
		Driver->clearZBuffer();
		DelayedSolidNodeList[i].node->render();
	}

	DelayedSolidNodeList.clear();
Sometimes it works and draws on top of everything... other times... well... it doesn't work! :twisted:
________
Rambler american specifications
Last edited by disanti on Sun Feb 27, 2011 11:11 pm, edited 1 time in total.
Eternl Knight
Posts: 313
Joined: Tue Nov 01, 2005 5:01 am

Post by Eternl Knight »

Doesn't work as in "renders as if ZBuffer is still there" or doesn't work as in "Nothing is rendered"?

A demo executable/source might help me here...

--EK
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

ZBuffer is still there... I don't really know how I can help anymore... I simply modified irrlicht to have another render state: ESNRP_SOLID_LAST, and I posted the code to render it. Everything else is in order.
________
Motorcycle Tires
Last edited by disanti on Sun Feb 27, 2011 11:11 pm, edited 1 time in total.
Pazystamo
Posts: 115
Joined: Sat Dec 03, 2005 5:56 pm
Location: Lithuania
Contact:

Post by Pazystamo »

If your model has transparent texture then it uses z buffer...
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

@Disanti: are you using tga files for your billboards?
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

@Pazystamo: No transparency, dunno where you got that idea...
@Afecelis: I'm not using billboards... where did you get that idea?
:?
Last edited by disanti on Sun Feb 27, 2011 11:12 pm, edited 1 time in total.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

hehehe, sorry! I got cross-confussed with the grass node info I was reading on the "project announcements" thread. :oops: :oops:

An idea of rendering one billboard in front of another crossed my mind and then I thought I could be the tga bug. :wink:
sRc
Posts: 431
Joined: Thu Jul 28, 2005 1:44 am
Location: Salt Lake City, Utah
Contact:

Post by sRc »

afecelis wrote:An idea of rendering one billboard in front of another crossed my mind and then I thought I could be the tga bug. :wink:
yeah you're the TGA bug alright afecelis ;)
The Bard sRc

Blog | Twitter
Guest

Post by Guest »

afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

looooooooool! :D
IT, IT, IT, IT, IT, IT, IT :wink:
Post Reply