0

I have written a 3d model viewing program in vb.net, though the question is not language specific. Everything is working as expected though I have one issue. Partial transparency.

The program allows the user to make the entire model transparent via a checkbox and a slider that changes the alpha values for alpha blending. It also stops the zbuffer check.

This works fine when the model is very transperant but can induce more and more flicker during animation and render errors as the opacity increases. Which i'm guessing is due to out of z-order polygon rendering.

So the question is. Do I need to implement a Sort or painters algorithm for transperancey to work properly or is there any way to use the zbuffer & polygon location etc to avoid sorting everything?

Ps. This does not use api's. It's all software based rendering so OpenGl soloutions etc are no good.

user5847934
  • 31
  • 1
  • 5
  • Just to add if a sort is the only option then any pointers on which method would be most suitable (fast with sorted or partially sorted data sets) to implement. – user5847934 Jan 27 '21 at 17:46
  • in some cases you do not need to sort ... see [OpenGL - How to create Order Independent transparency?](https://stackoverflow.com/a/37783085/2521214) You can implement the same stuff in your SW render too you just need to implement the GL_CULL_FACE test which simply is a simple dot product between camera view direction and face normal ... the sign of result tells you if the face is front or back ... this might interest you too [Mathematically compute a simple graphics pipeline](https://stackoverflow.com/a/21100338/2521214) – Spektre Jan 27 '21 at 18:23
  • Cheers, Had a quick read and that first link was interesting not least for the comment linking to the Nvidia article. I will go through them both and see if I can make something that works for me. I also noticed mention of an A-Buffer which I will also look into. – user5847934 Jan 28 '21 at 20:53
  • Btw what you describe (GL_CULL_FACE) sounds like back face culling which I already have implemented. – user5847934 Jan 28 '21 at 20:59
  • Yest its back face culling ... you just need to have it configurable for both windings. So if you already have it there is not problem trying the approach... – Spektre Jan 28 '21 at 22:07

0 Answers0