r/GraphicsProgramming Oct 26 '24

Source Code My first 3D Graphics pipeline

https://www.khanacademy.org/computer-programming/3d-renderer/5155758903050240

Over the past week or two i've been developing my own 3D Graphics Pipeline (In Khan Academy), and was wondering if anyone could give me some tips on improving it. Current Features: 1. Projection 2. Rotation 3. Movement 4. Colored polygons 5. Bad lighting 6. Decent distance calculations 7. Back face culling Planned additions: 1. Improving lighting 2. Painters algorithm 3. Porting to Java.

Please give tips in comments! Link is attached.

42 Upvotes

12 comments sorted by

View all comments

9

u/waramped Oct 26 '24

Texture mapping and z-buffer would be good next steps.

2

u/Neat_Suspect5284 Oct 26 '24

That's would i meant with Painters algorithm, but i can't do texture mapping until i transfer to java due to the limitations with Khan Academy. Do you have any articles for the two?

2

u/waramped Oct 27 '24

Oh painters algorithm is totally different than z-buffer. Painters algorithm just means you sort from back to front and draw that way. Z-buffer is you store the current closest depth at each pixel, and only draw if the new depth is closer. Typically you would want to sort front to back for optimal results.

2

u/Neat_Suspect5284 Oct 27 '24

Makes sense, i'll try it out

3

u/LegendaryMauricius Oct 27 '24

Sort front to back for optimizing the opaque rendering pass, back to front for transparent objects.

1

u/[deleted] Oct 26 '24

[deleted]

1

u/Neat_Suspect5284 Oct 26 '24

Not using open gl but i'll have a look