Polygons disappear depending on distance to camera and angle

106 views
Skip to first unread message

basara

unread,
Nov 23, 2007, 2:33:23 PM11/23/07
to away3d.dev
I am trying to make a 3d room you in which you can move in first
person view however the polygons of the wall and floor keep
disappearing if I get close enough to them.
I know that this doesnt happen as much if I use smaller polygons ( the
room is right now just a cube in which each of its sides is just two
triangles ) but I want to know if there is some other way to go around
this problem since subdividing it will increase the triangle count a
lot.

I would also want to ask how big is the difference in speed between
the correct z sorting renderer and the regular one.

I found about away3d yesterday after searching for a while about
zsorting problems and solutions ( I was using papervision ) and I must
say I am impressed about how away3d solves zsort and polygon
intersection problems.

Peter Kapelyan

unread,
Nov 24, 2007, 11:57:15 PM11/24/07
to away3...@googlegroups.com
You can try using precisebitmap material or correctz ordering, the problem should go away with using more triangles. If you are just doing a simple room for now, try a grid of 3 x 3 (18 triangles)a s a start , and stay away from the wall as much as you can.
 
To do that you can:
Try moving the camera backwards a bit, and zooming in more. You can use moveBackwards() and changing the camera.zoom and camera.focus to where it feels like the camera is at that position of the player, althought the camera is farther away.
 
If you are doing the view from the players head postition (First person view),this is the best way to use.
 
Otherwise you can consider using a third person camera where the camera is farther away from the player even more. In this case you will probably want to make sure your camera NEVER goes into the wall so you will need to do a hit collision on your walls to make sure that never happens.
 
If you need help with any part of your code let me know.
-Pete
--
___________________

Actionscript 3.0 Flash 3D Graphics Engine

HTTP://AWAY3D.COM

basara

unread,
Nov 25, 2007, 11:29:12 AM11/25/07
to away3d.dev
Thanks for the reply, I must confess I hadnt made a lot of research
before posting, since then I have been trying to learn why it happens
and how it could be solved. I have now learnt why the polygons cant be
rendered if the distance of one of their vertexes to the viewing plane
is <= -focus ( projection perspective reaching infinity )

Since I am feeling adventurous I will try to implement some kind of
triangle clipping against the viewing plane. If I fail at that I can
fall back to the move the camera back + adjust zoom and focus
workaround.

I have noticed that the code that makes faces into drawing primitives
is inside the Mesh class, whats the reason for this? Wouldnt it make
more sense to have some kind of Face method that outputs a
DrawTriangle instead of the Mesh class doing all the work? Unless Mesh
class is supposed to be the only class that can draw Faces ( or maybe
its like this as an inlining optimization? )
This bothered me a bit because the clipping of faces must be done
before they are projected into DrawTriangles and placing the clipping
code for a face in the Mesh class seemed a bit against reusability.

Has anyone ever made what I am trying to do in away3d before? any tips
or suggestions?

On Nov 25, 1:57 am, "Peter Kapelyan" <flashn...@gmail.com> wrote:
> You can try using precisebitmap material or correctz ordering, the problem
> should go away with using more triangles. If you are just doing a simple
> room for now, try a grid of 3 x 3 (18 triangles)a s a start , and stay away
> from the wall as much as you can.
>
> To do that you can:
> Try moving the camera backwards a bit, and zooming in more. You can use
> moveBackwards() and changing the camera.zoom and camera.focus to where it
> feels like the camera is at that position of the player, althought the
> camera is farther away.
>
> If you are doing the view from the players head postition (First person
> view),this is the best way to use.
>
> Otherwise you can consider using a third person camera where the camera is
> farther away from the player even more. In this case you will probably want
> to make sure your camera NEVER goes into the wall so you will need to do a
> hit collision on your walls to make sure that never happens.
>
> If you need help with any part of your code let me know.
> -Pete
>

basara

unread,
Nov 25, 2007, 10:37:14 PM11/25/07
to away3d.dev
An update, my adventure has been quite a success so far and I was
almost sure that I would fail since this is the first time I ever get
near anything related to 3d :)

here is a demo featuring triangle clipping against the viewing plane:
http://www.sliekas.org/basara/flash/papervision/clipping/test.html

Move the view around using the arrow keys.
The zoom and focus are highly exagerated so that its possible to see
whats happening.

I havent yet made it adapt the uv coordinates so right now it only
works with flat materials.

I am quite happy with this, now its possible to have both big and very
low poly rooms to walk inside. In my opinion this feature should be
strongly considered for future versions of away3d.

stephen white

unread,
Nov 26, 2007, 3:19:27 AM11/26/07
to away3...@googlegroups.com
On 26/11/2007, at 2:07 PM, basara wrote:
> I am quite happy with this, now its possible to have both big and very
> low poly rooms to walk inside. In my opinion this feature should be
> strongly considered for future versions of away3d.

Even Alex was finding that a bit difficult, so you have done very
well. Yes, it would be great to include that in future versions of
Away3d, since a lot of people have similar problems with triangles
disappearing when too close.

--
st...@adam.com.au


Peter Kapelyan

unread,
Nov 27, 2007, 2:08:24 PM11/27/07
to away3...@googlegroups.com
That is beyond amazing!
I hope we can play with that soon in the engine :)
 
Sandy3D is the only other engines that has been able to clipping.
Their engine is amazing as well, thought maybe you might want to check it out :)
 
Amazing work! Congratulations.

Reply all
Reply to author
Forward
0 new messages