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

Back Surfaces Culling Mistake #113

Open
awarebayes opened this issue Oct 2, 2022 · 2 comments
Open

Back Surfaces Culling Mistake #113

awarebayes opened this issue Oct 2, 2022 · 2 comments

Comments

@awarebayes
Copy link

Hello!
I believe, back surfaces culling should be done in screen coordinates! Not in the original coordinates.
Let's discuss the implications doing original coordinates culling may cause.
For example, I am using a perspective projection in a scene like this:
image

As you can see, the perspective is warping towards the edge of the screen.
This is neglected in original coordinate culling, if I try doing back culling on original coordinates I get results like this:
image
This scene clearly demonstrates that.

@awarebayes
Copy link
Author

This means that code like

	glm::vec3 n = glm::cross(pts[2] - pts[0], pts[1] - pts[0]);
	glm::vec3 look_dir = args.look_at - args.camera_pos;
	float intensity = dot(n, look_dir);
	if (intensity < 0) {
		return;
	}

in triangle should run on the screen coordinates and not world coordinates

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
@awarebayes and others