Results 1 to 6 of 6

Thread: Java Help With Culling

  1. #1
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default Java Help With Culling

    Can't get culling working, it seems to recognize that some faces aren't supposed to be drawn, but some aspects are still being shown even though they are completely blocked off.


    Anyone any idea's to fix this? current algo for culling is..

    Code:
    	public boolean Cull(Triangle3D Triangle) {
    		return (Dot(
    				Cross(Sub(Triangle.a, Triangle.b),
    						Sub(Triangle.a, Triangle.c)),
    		 CamPos) <= 0);
    						
    	}
    CamPos is a vector (0, 0, -20)
    Edit : Triangle3D is just a triangle with 3 vectors. (X1, Y1, Z1), (X2, Y2, Z2), (X3, Y3, Z3)
    Last edited by Kasi; 09-25-2012 at 07:07 PM.

  2. #2
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    It seems to work on the teapot though. Culling is just not drawing triangles that are faced backwards, not the removal of triangles that aren't visible.
    Working on: Tithe Farmer

  3. #3
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    It seems to work on the teapot though. Culling is just not drawing triangles that are faced backwards, not the removal of triangles that aren't visible.
    i don't understand, are you saying i have to add another feature to remove triangles that are deeper in / overlapping?

  4. #4
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Quote Originally Posted by pur3b100d View Post
    i don't understand, are you saying i have to add another feature to remove triangles that are deeper in / overlapping?
    yes, this is what culling is checking for:

    Working on: Tithe Farmer

  5. #5
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    ahh Thanks

  6. #6
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Working on: Tithe Farmer

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •