Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Z-Test

    SDK Help
    0
    10
    978
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 01/08/2003 at 05:35, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   8.100 
      Platform:      
      Language(s) :     C++  ;

      ---------
      Hi
      i wanted to upgrade my Pointcollapse Tool with a "only visible Points" mode
      so i have the problem of checking whether a point is visible.
       
      Does someone know if there is a way to use the Z-buffer for a visibility check.
      BaseDraw::TestPointZ(..) seems only to check if the Point is within the nearclip/farclip range.
      I could also use the RayCollider to check if there are polys in front of my point.  Hope this is not too slow.
      Michael

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 01/08/2003 at 06:05, xxxxxxxx wrote:

        Hi Michael,
        Z-Buffer...hmm, doubt this would be useable but not sure.
        With TestPointZ you are right, it doesn´t check for visibility somehow (maybe it´s buggy?)
        Cannot help you with the RayCollider though for I haven´t used it. Mikael will be back on Monday, I guess he can tell you more then.
        Good luck! (and let me know how you worked it out 🙂

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 02/08/2003 at 15:35, xxxxxxxx wrote:

          A Z buffer test is for most purposes not a viable option - it's simply too imprecise. Also think of some gfx cards that do not allow to read GL Z values (though they have become rare).
          The best way is to send in rays to detect which points are visible and which not.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 03/08/2003 at 00:36, xxxxxxxx wrote:

            thank you guys
            ....but, now i would really like to try that z-test thing out  😉     I can hardly believe that it is too imprecise. Since it is precise enougth for drawing.
            so i would do someting like 
            visible = ( Abs(p.z - buffer[p.x][p.y]) < small_value ) 
            i think it would be enougth to filter out points that are far behind the visible surface.
             
            And for the ray test, there are two problems:  there are some strange perspective projetions where i don't know where to start the rays.  And i have to test every point against every poly... That is no good unless the point-polys-test is O(log n)
            i will think some more about it..

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 04/08/2003 at 04:26, xxxxxxxx wrote:

              ok i'm using the ray shooting method now.   It works quite well unless the mesh is not too big.

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 04/08/2003 at 17:18, xxxxxxxx wrote:

                yes, I believe it is. But if it works..why not ;o)
                IMO there should be a convenience function in the SDK that returns only the visible points, just like we can get the selected, hidden points.

                1 Reply Last reply Reply Quote 0
                • H
                  Helper
                  last edited by

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 07/08/2003 at 15:58, xxxxxxxx wrote:

                  you could try the C4DObjectList class
                  this seems to be the fastest way to get a z distance to a given point on screen.
                  you can use it  something like this
                  AutoAlloc<C4DObjectList> mylist;
                  SelectionListCreate(doc, NULL, bd, x, y, NULL, mylist);
                  you will need to convert your world coords into screen  coords.
                  this will put a list of all objects that can be found at the screen coord x,y into mylist
                  of course the first object is the nearest and you can read its z distance.
                  the advantage of this is that you dont need to consider which objects are in the scene or how many.
                  spline objects are passed as planes , so you should check through the list for the first valid polygon based object.
                  im not sure if this is the right method for you plugin , but its a very fast and  easy way to get z depth values and can be abused in many ways.

                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 08/08/2003 at 00:16, xxxxxxxx wrote:

                    that is not necessary for my plugin since it should only consider "self" occlusion of the active object. Similar to the live selection tool.

                    1 Reply Last reply Reply Quote 0
                    • H
                      Helper
                      last edited by

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 08/08/2003 at 04:28, xxxxxxxx wrote:

                      You can't access C4D's Z buffer. There are lots of reasons it's not very practical to do so: the Z buffer may be in unititialized state, the Z scaling is different for the various display types, some GL buffers don't support Z access etc.
                      Finally, as beaker said, its so imprecise. If C4D would use this for selection, you couldn't work with it. (All according to the developers.)

                      1 Reply Last reply Reply Quote 0
                      • H
                        Helper
                        last edited by

                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                        On 08/08/2003 at 05:33, xxxxxxxx wrote:

                        aha.  then i was wrong i guess. but never mind. i build in ray shooting anyway. It was very easy with the raycollider.  It's slow with large meshes but guess i can limit the number of point's that must be checked... in a future version.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post