z-fighting and passindex

If you feel like you're up to the challenge of building your own Ages in Blender or 3ds Max, this is the place for you!

z-fighting and passindex

Postby teedyo » Sat Mar 21, 2009 6:06 pm

Firstly, these are just some thoughts.

I've been reading with some curiosity, all the issues people are having with getting objects to draw in the correct order. Now, it's been a LONG time since I've written any code to render 3D scenes and a lot has changed since then, but something may still apply.

When we rendered a scene; all OBJECTS were drawn from far to near with respect to the camera; and all MATERIALS were drawn in layer order(passindex) with respect to their parent object. To give an example: let's use a wall, a lamppost, a sidewalk and then the camera. Let's also assume the lamppost has a cracked pane. Our renderer would draw the wall, then the lamppost, then the crack, then the light flare and finally the sidewalk. If the camera was on the other side of the wall; it would draw the sidewalk, the lamppost, the crack, the flare and finally the wall. This worked perfectly for 90% of all cases.

The other 10%? ahh. Let's imagine a tree next to a pond such that some of its branches and leaves hung over the water. With the camera at a reasonable height, say eye-level; this still worked fine. Now put the camera up on a balcony looking down at the pond and horror! The water obscured part of the leaves! Why? Because all of our objects were drawn from back to front, bottom to top. Our objects' "roots" were at a corner and with this configuration, the water was 'closer' than the tree. The solution? Lots more code. ;-) What we did was change the "root" of an object to its ~center volume. ie. in the case of the tree; it was moved up into the foliage instead of at its base which made it 'closer' to the camera. Done this way, it was very difficult to create a case where the render order was incorrect. We had fewer objects than is common now, of course.

Where is this leading? Well. When you create an object in Blender; it defaults to having an object's reference at its center. After modifying this object; that point of reference is no longer at the center unless it is moved there by its creator. Now Tikibear made a comment in another thread that he was solving problems with draw order by parenting and de-parenting objects. My guess is that when an object is de-parented; Blender resets that object's reference point back to its volumetric center allowing its ordering to be correct more often.

So, without knowing exactly how Plasma orders its renders; could the problems people are having with z-fighting be cured/reduced simply by setting an object's reference back to is center volume or a determined optimal location which increases the probability of it being drawn correctly?

Thoughts, flak, gunshots??
teedyo
 
Posts: 212
Joined: Tue Oct 09, 2007 5:47 pm

Re: z-fighting and passindex

Postby Aikijitsu » Sat Mar 21, 2009 6:11 pm

I know nothing about 3D modeling....I'm trying the tutorial, but I'm having technical difficulties at the moment.

What you said does make sense though. I'm correct in assuming that different angles of view for different objects need different reference points right? Once I start modeling, I'll keep that in mind,
Currently Learning Blender: 0%
Status: Building computer...
User avatar
Aikijitsu
 
Posts: 98
Joined: Fri Mar 20, 2009 8:52 am
Location: Kissimmee, Florida

Re: z-fighting and passindex

Postby boblishman » Sun Mar 22, 2009 2:58 am

see HERE
when it comes to Age creation ... "DOH" seems to be my middle name...
User avatar
boblishman
 
Posts: 882
Joined: Fri Oct 05, 2007 4:47 pm
Location: Spain

Re: z-fighting and passindex

Postby Nadnerb » Sun Mar 22, 2009 3:13 am

Thanks, I was just about to point to myself too. <.<
Image
Live KI: 34914 MOULa KI: 23247 Gehn KI: 11588 Available Ages: TunnelDemo3, BoxAge, Odema
Nadnerb
 
Posts: 1057
Joined: Fri Sep 28, 2007 8:01 pm
Location: US (Eastern Time)


Return to Building

Who is online

Users browsing this forum: No registered users and 4 guests