Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Painter's Algorithm #1831

Open
jrygeorge opened this issue Sep 23, 2024 · 2 comments
Open

Painter's Algorithm #1831

jrygeorge opened this issue Sep 23, 2024 · 2 comments
Assignees

Comments

@jrygeorge
Copy link

jrygeorge commented Sep 23, 2024

https://en.wikipedia.org/wiki/Painter%27s_algorithm

Would be nice to see a video on Painter's Algorithm, one of the ways in which we determine which surfaces are visible and which are hidden to the user when drawing a 3D object.

@shiffman shiffman self-assigned this Oct 13, 2024
@shiffman
Copy link
Member

I like this idea!! Maybe I could even show a parallax effect along with it? What would be a very simple way to demonstrate the algorithm without getting into 3D rendering I wonder?

@jrygeorge
Copy link
Author

jrygeorge commented Oct 15, 2024

Easiest way I think would just be to take all the vertices we need, do all the affine transformations, pass it through the perspective projection matrix for the parallax effect, order the faces, then just chop off the Z coordinate and draw the polygons (Actually now, that seems like a lot).

I tried it like that myself and it mostly works.
The code is kind of a mish mash of things I wrote sometime ago, so might be a bit difficult to read.

Also after, you could talk about things like frustum culling and face culling too, would be nice :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants