Custom Z sorting

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
MolokoTheMole
Posts: 109
Joined: Tue Jan 09, 2007 1:18 pm

Custom Z sorting

Post by MolokoTheMole »

I'm having a hard time with the Irrlicht Z buffer. I'm doing mainly 2D rendering, I have to do a lot of tweaking to make it sort correctly. Also there are artifacts when using the EMT_TRANSPARENT_ALPHA_CHANNEL material.
Image

How could I fix this? I was thinking of making my own node sorting, could I do this?
Crimson Glory full Irrlicht game source code!
What I Do - my blog & dev log
Currently developing Link-Dead
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

I think the node sorting should be fine, are you sure that your source image is not causing the problems? Maybe those pixels are transparent in the image?
Image Image Image
MolokoTheMole
Posts: 109
Joined: Tue Jan 09, 2007 1:18 pm

Post by MolokoTheMole »

Oh I should've explained how that is drawn. The arm is drawn on top of the torso. The graphics for the arms is antialiased. It looks fine against the background but on top of the torso it renders as if the background was there.
Crimson Glory full Irrlicht game source code!
What I Do - my blog & dev log
Currently developing Link-Dead
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

I see, certainly seems like some z sorting issues.

Can you not draw the arm after the torso? Or is that what you're doing already?
Image Image Image
IPv6
Posts: 188
Joined: Tue Aug 08, 2006 11:58 am

Re: Custom Z sorting

Post by IPv6 »

MolokoTheMole wrote:How could I fix this? I was thinking of making my own node sorting, could I do this?
Disable z buffer at all if you use 2d rendering in 3d, make your own material and mark it as transparent.

Custom sorting would be useful indeed. May be this will be added as feature sometimes.
GameRotor-Games and more...
Wiredplane-Shareware utilities...
MolokoTheMole
Posts: 109
Joined: Tue Jan 09, 2007 1:18 pm

Post by MolokoTheMole »

So how do I set the rendering order when I disable the z-buffer?
Crimson Glory full Irrlicht game source code!
What I Do - my blog & dev log
Currently developing Link-Dead
GnarlyHotep
Posts: 10
Joined: Tue Aug 14, 2007 6:35 pm

Post by GnarlyHotep »

MolokoTheMole wrote:The graphics for the arms is antialiased. It looks fine against the background but on top of the torso it renders as if the background was there.
How are you antialiasing the images? From the looks of it, it looks like a problem creating the antialiased image - instead of changing the alpha channel, the paint program is blending between a foreground color (the arm) and the background color. Different Z sorting won't change anything if that's the case.
MolokoTheMole
Posts: 109
Joined: Tue Jan 09, 2007 1:18 pm

Post by MolokoTheMole »

No that's not the case, the images are saved in png format. They are drawn that way in a paint program.
Crimson Glory full Irrlicht game source code!
What I Do - my blog & dev log
Currently developing Link-Dead
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

So you use 2 draw2DImage calls for the screenshot shown?
MolokoTheMole
Posts: 109
Joined: Tue Jan 09, 2007 1:18 pm

Post by MolokoTheMole »

No those are 3d sprites, made of 4 vertices, 2 polygons.
Would drawing everything with draw2dimage solve the problem?
Crimson Glory full Irrlicht game source code!
What I Do - my blog & dev log
Currently developing Link-Dead
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

At least it has some different settings for texture alpha layer handling. So it my be worth trying.
What's the code for drawing the two elements then? Is one a child of the other?
MolokoTheMole
Posts: 109
Joined: Tue Jan 09, 2007 1:18 pm

Post by MolokoTheMole »

No they are not children, would that help?
Crimson Glory full Irrlicht game source code!
What I Do - my blog & dev log
Currently developing Link-Dead
Post Reply