Saturday, March 27, 2010

model overlap at certan distance

Hi,



Here is my problem:



I have a scene with models, cameras, textures, etc. When I
export this scene i see strange things like models that overlaps at
certain distance from the camera. I whould like to know if anyone
of you had that problem before an who you resolved it.



Many thanks in advance.model overlap at certan distance
Hi,



Yes, i think I had such a problem, Try setting the
camera(from witch you are viewing) hither to a greater value.

--

w3d.camera(1).hither = 50

--

That solved my problem.



Daniel.model overlap at certan distance
And if that doesn't work, try scaling the camera by a large
factor like

10-20 or so.



sprite(the currentSpriteNum).camera.scale = vector(20,20,20)



If you build the scale of the world too small it can suffer
from the

Z-buffer sorting issue, especially on older cards, and
enlarging the

camera's viewing frustum can compensate for it.



Cheers



Richard Smith






Oops, sorry that should have read...



sprite(the currentSpriteNum).camera.transform.scale =
vector(20,20,20)



Richard Smith






Thanks for the quick replies. I remember that problem too
danieloizo, and i solved scaling the camera and/or playing around
with hither yon values.



In this case tweaking the camera makes no diference, i've
tried. By unkowledge i didn't mention the part that the models with
problems have transparency.

Fontunately i have found this thread on director-online that
describes the cause of the problem(two transparent models, see the
shckwave movie whitin).



Maybe there is a way to correct this z-buffer problem, or
maybe not. I leave this thread open.




The problem is that models which have transparent textures
are sorted per-model, by their geometric centre. Here's a detailed
description of when and why the problem occurs:


http://nuttybar.drama.uga.edu/pipermail/dir3d-l/2005-February/008031.html



The solution is to break the model down into separate parts,
so that each part is sorted by its own geometric centre.



As a demo - here are 2 cubes, each sitting on opposite sides
of a long wall:


http://www.robotduck.com/models/?x=-240%26amp;y=35.00%26amp;z=40.00%26amp;t=79%26amp;a=-270%26amp;d=728.2%26amp;dir= alphaSort%26amp;file=alphaCubesAlphaWall



Both the cubes and the wall have alpha textures with
transparency. As the view rotates, each object is sorted only by
its distance from the camera, causing the cubes to appear to 'pop'
in front of and behind the wall as their geometric centre becomes
closer/further to the camera than the wall's geometric centre.



In this fixed scene, the wall has been split into 3 separate
models, thereby causing each separate piece to be sorted
independantly by its geometric centre. This reduces the chance that
a cube's centre will be closer to the camera than a wall which is
supposed to occlude it.




http://www.robotduck.com/models/?x=-240%26amp;y=35.00%26amp;z=40.00%26amp;t=79%26amp;a=-270%26amp;d=728.2%26amp;dir= alphaSort%26amp;file=alphaCubesAlphaWallSeparated



If you watch carefully however, there are still moments where
the sorting is incorrect and they overlap. This could be fixed by
breaking up the wall into still smaller sections.



Increasing the 'hither' value of the camera is not the
correct solution in this case. It is the correct solution to a
different problem with overlapping models however, called
'z-fighting' :
http://en.wikipedia.org/wiki/Z-fighting



hope this helps!



- Ben


Hi,



Very well explained duckets , It's good to know about this
z-buffer problem.



Daniel

No comments:

Post a Comment