Advertisement

How to calculate depth slope of the polygon

Started by March 22, 2023 09:35 PM
0 comments, last by Stepan 1 year, 9 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