🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How to calculate depth slope of the polygon

Started by
0 comments, last by Stepan 1 year, 3 months ago

Hi

I'm trying to implement wireframe drawing with hidden line removal. In the geometry shader I make lines from the input triangle. I plan to change the z-value in the geometry shader so that the lines are closer to the camera to avoid stippling (maybe this approach is wrong too).

I want to do the same offset as implemented in glPolygonOffset. But I don't understand how to calculate the maximum depth slope m of a triangle:

I was thinking of going through the three triangle coordinates and choosing the maximum and minimum xy coordinates. Then dy = ymax - ymin, dx = xmax - xmin. But I think that would be resource intensive.

Can you please point me in the right direction?

I can't find any examples online and I feel I'm really stuck.

This topic is closed to new replies.

Advertisement