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:
![](https://uploads.gamedev.net/forums/monthly_2023_03/16a4b9456a4346469b6cc084baedf202.img452.gif)
![](https://uploads.gamedev.net/forums/monthly_2023_03/98ff17f9e4594d81a23044e32daaea87.img450.gif)
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.