How to decide a 3d point is visible to camera? 

Software: Away3D 4.x

ddmsama, Jr. Member
Posted: 26 April 2012 07:51 AM   Total Posts: 34

We are wondering how to decide a 3d point is visible to a camera?
Because the camera projection in Away3d 4 now,is projecting even when the point is not in front of the camera.

Is there a built-in function to easily decide if a 3d point is visible/in front of a camera?

Thank you.

   

ddmsama, Jr. Member
Posted: 01 May 2012 05:14 AM   Total Posts: 34   [ # 1 ]

kick this up to see if anyone could give us some hint on the topic, thank you.

   

ddmsama, Jr. Member
Posted: 03 May 2012 08:42 AM   Total Posts: 34   [ # 2 ]

raise me up~

   

Paul Schlichter, Newbie
Posted: 04 May 2012 01:14 PM   Total Posts: 13   [ # 3 ]

Try the following:

var inFrontOfCamera Vector3D  view3D.vector3DtoCheck.subtractview3D.camera.position );
if ( 
inFrontOfCamera.dotProductviewportA3d.camera.forwardVector ) > )
{
   
// vector3DtoCheck is in front of camera !

 

   

ddmsama, Jr. Member
Posted: 07 May 2012 09:41 AM   Total Posts: 34   [ # 4 ]
Paul Schlichter - 04 May 2012 01:14 PM

Try the following:

var inFrontOfCamera Vector3D  view3D.vector3DtoCheck.subtractview3D.camera.position );
if ( 
inFrontOfCamera.dotProductviewportA3d.camera.forwardVector ) > )
{
   
// vector3DtoCheck is in front of camera !

 

it works fine totally,wish my math can be as good as you, thank you Paul.

   

Paul Schlichter, Newbie
Posted: 07 May 2012 10:25 AM   Total Posts: 13   [ # 5 ]

Glad to help smile
My math isnt that good, just found this solution somewhere else smile

   

enael, Newbie
Posted: 07 May 2012 11:12 AM   Total Posts: 2   [ # 6 ]

i don’t use away3D so i just took a look at source;
your point : P1:Vector3D
the projection of your point : P2 = camera.project(P1)

if (P2.z>0) {
  the point is front of the camera
}

to be visible somthing like that:
P2.x<=1 && P2.x>=-1 && P2.y<=1 && P2.y>=-1 && P2.z>0 && P2.z<1

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X