Skip to content
This repository has been archived by the owner on Feb 11, 2024. It is now read-only.

See-through pixels in triangle seams and lighting artifacts #19

Open
Henry00IS opened this issue Sep 24, 2017 · 3 comments
Open

See-through pixels in triangle seams and lighting artifacts #19

Henry00IS opened this issue Sep 24, 2017 · 3 comments
Labels
help wanted We desperately need help from new contributors. status: difficult The issue was more difficult than expected.

Comments

@Henry00IS
Copy link
Collaborator

Henry00IS commented Sep 24, 2017

I have been encountering this issue every time I create a dark environment. The triangulation seams are all slightly separated (I guess?) allowing very thin dynamic light to shine through as well as the skybox to be seen through thousands of flashing bright pixels.

seethroughpixels

I made a script that causes the player to "breathe" by slightly moving the camera up and down over time, it makes this extremely noticeable. I am actually looking into this problem myself I just figured I should start a discussion here as it may require the author's CSG knowledge to figure this out. ;)

@Henry00IS
Copy link
Collaborator Author

Henry00IS commented Sep 24, 2017

Using the "Export All To OBJ" feature I was able to reproduce the problem in Blender.

seethroughpixelsblender
It's here that I made a shocking discovery. The vertex coordinates are spot on and there are no obvious discrepancies.

I did some more research to check whether this is a common problem and found this: https://stackoverflow.com/questions/18523231/opengl-shimmering-pixels-artifact

It turns out we are dealing with T-Junction elimination.

"T-Junctions occur whenever you have a vertex that lies on, but is not part of another edge. Errors occur when there's not enough sub-pixel precision to properly identify the vertice's relationship to the other edge. They're really common on older hardware (i.e. PS1), less common these days."

I made two quads in Blender and placed them close together and they result in the same artifacts.
tjunction

Which turns out to be a common BSP/CSG issue that is solvable.

https://www.gamedev.net/forums/topic/230012-eliminating-discontinuities-t-junctions-in-bsp/
evanw/csg.js#13

However this may just be too complex for me to implement alone...

@Henry00IS
Copy link
Collaborator Author

I found an algorithm to fix T-Junctions here: https://github.com/jscad/csg.js/blob/85a8054c8dabaf17866b5de6dab9d5ee65fca4b7/src/CSG.js#L920

@RobbyZ
Copy link

RobbyZ commented Jan 18, 2018

I'm also experiencing this issue which is manifesting in two ways on my project:

First - I use Unity's standard edge detection script as a camera effect, and this error causes false edges to flicker:

edgedetectionerror

Second - During bake, light leaks through the edges into areas that should be dark:

lightleak1

lightleak2

@Henry00IS Henry00IS added the help wanted We desperately need help from new contributors. label Mar 6, 2018
@Henry00IS Henry00IS added the status: difficult The issue was more difficult than expected. label Mar 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted We desperately need help from new contributors. status: difficult The issue was more difficult than expected.
Projects
None yet
Development

No branches or pull requests

2 participants