Help with ZClip

Posted on 2003-03-13
Medium Priority
Last Modified: 2013-12-26

Im having problems with 3dclip a face againt plane screen.
My face routine take the 4 2d mapped coords to calc texture map and gouraud colors.
But i can´t calculate 2d coords if some 3d point lies behind camera (get inverted xy coords only)!!!
The function that transform 3d in 2d:

function Trans3Dto2D(Point: T3DPoint): T2DPoint;
var ZV: Single;
  if Point.z <> 0 then ZV := Z_FACTOR/(Point.z)
  else                 ZV := Z_FACTOR/0.000001;
  Result.X := (Point.x*(-ZV))+HALF_WIDTH;
  Result.Y := (Point.y*(ZV))+HALF_HEIGHT;

Theres a way to calculate correct 2d coords even if behind screen?
I tryied by taking the deltax and deltay of point in front of screen (2d mapped) and the clipped point
on screen plane (2d mapped too), but it dont works (i forgot the perspective?)

Or I should map the texture and gouraud shades on the 3d space, but how do this?

Thanks, for any help!!!
Question by:L-Tryosine
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

TGGC earned 320 total points
ID: 8158234
No, those points cannot be calculated correctly.

You need to clip all lines which have an point with with negative z on the near clipping plane. The near clipping is a plane paralell to xy with a z value above 0. If you have a triangle reaching behind that plane, you must clip everything with a lower z, which may result in two trangles.

Expert Comment

ID: 8164665
You wrote the software rendering program ?
I tried :-(
Performance is too low (especielly on texturing and alpha)
Use the OpenGL or DirectX API
Hardware Z-Buffer is very fast
The good tutorial for OpenGL (reccomend)

I have a lot of experience in writing
3d and 2d applications and games (Delphi)
So EMail me if is there any question

Expert Comment

ID: 9464455
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month9 days, 7 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question