zauonlok/renderer

Performance ideas.

medram opened this issue · 3 comments

Hey, this renderer is really a great job, I like the 3D and its algorithms (it's all illusions), and I personally made a simple one using pure javascript running on the browser:
https://github.com/medram/3Din2DCanvas

any way, about your renderer, I've noticed that when I zoom closer to the 3D object the renderer get suffering and the frame rate tremendously get low, and I guess it caused by the clipping, and to fix this issue I suggest the following:

  • The clipping is costly, so don't do the clipping at all (except Near and Far plains).
  • Don't render/calculate the 3D object if it was out of the scene.
  • Try improving the clipping algorithm.
  • or don't clip the triangles that should be clipped, and just render the triangles that are in the scene and those that needs the clipping (but don't clip it), and don't render/calculate the triangles that are outside of the scene.

I hope that make sense (my English is a little bit broken).

and all of the mentioned ideas/algorithms has been implemented in my Javascript renderer and it helps a lot in the performance.

One last thing please, I'm a python expert, but I didn't know how and where did you connect C code with Python code? and did you use Python "ctype"?

Thanks.

Sorry for the late reply.

These optimizations will surely speed up the renderer. For the sake of simplicity, they are not implemented in the first place. I will implement them later.

Python is only used for preprocessing asserts downloaded from the internet. It is not used in runtime.

Hello zauonlok,

Thank you for your reply,

I like this renderer project, and I have some C knowledge, so I may going to implement these ideas/algorithms and send you a Pull request, just let me know where the clipping is happening to improve it,

Thanks.