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

Brave Story a black triangle #8251

Closed
daniel229 opened this issue Dec 2, 2015 · 4 comments · Fixed by #11393
Closed

Brave Story a black triangle #8251

daniel229 opened this issue Dec 2, 2015 · 4 comments · Fixed by #11393
Labels
D3D9 Direct3D 9 D3D11 Direct3D 11 Guardband / Range Culling Involves vertices outside fustrum. OpenGL Vulkan
Milestone

Comments

@daniel229
Copy link
Collaborator

Also happen in 0.9.9.1-54-gdfbb0bd and 0.9.6
01

Ge debugger
02
other tabs
https://gist.github.com/daniel229/9e19640f86e74a082b46

Savestate
http://1drv.ms/1TtExKp

@unknownbrackets
Copy link
Collaborator

I tried disabling each test in a row, and it didn't help. Basically these are supposed to be the tops of the walls. It's drawing a near-black color.

My suspicion is that it's meant to be clipped, but isn't being. It's drawing 843 vertices with varying points, so it's hard to determine the exact problem points. Even with all tests disabled, it doesn't actually draw everywhere the points highlight (per the vertex preview.) Assuming this isn't a bug in the vertex preview, I assume it's culling or clipping or something.

Hmm.

-[Unknown]

@daniel229
Copy link
Collaborator Author

Also a gamesave here.
talk to rhis people,and then it take you to the world,then go to east.
01

Rename jpg to 7z.
ucjs100240001

@unknownbrackets unknownbrackets added the Depth / Z Issue involves depth drawing parameters. label Jan 18, 2016
@unknownbrackets
Copy link
Collaborator

I'm marking this as depth related, I think it is.

Viewport: 32750.0 +- 32750.0 => [0, 65500]
Minmaxz: [0, 65500]
Clipping: OFF
Stencil test: ALWAYS (REPLACE 00)
Alpha test: > 0x80 (no vert color, so this seems based on lighting which has fixed 0xff alpha.)
Depth test: src >= dst

If I expand the projected z by 1.1f, the triangle shrinks. 1.2f is enough to make it go away entirely. I'm not sure... maybe this means it isn't depth related exactly, and is some other kind of clipping issue? It does have culling enabled.

The area in question has depth values around ~21000 prior to the artifact. After the draw, the artifact's area has depth values around ~64851. I guess it could even be a CPU rounding issue in generating these coordinates... the very corner of the artifact has a depth of 65498, just barely below clipping.... but near the top right it's as low as 60971.

-[Unknown]

@unknownbrackets unknownbrackets removed the Depth / Z Issue involves depth drawing parameters. label Jan 24, 2016
@unknownbrackets
Copy link
Collaborator

So, putting this in the vertex shader, which is just a quick hack, makes the triangle go away:

        WRITE(p, "vec2 test123 = gl_Position.xy / gl_Position.w;");
        WRITE(p, "if (test123.x < -4.0 || test123.x > 4.0 || test123.y < -4.0 || test123.y > 4.0) { gl_Position.xyz = vec3(1000000.0 * -1000000.0 * gl_Position.w); }");

I think there's a good chance this issue is that vertices outside the 4096x4096 drawing space are supposed to be completely culled.

-[Unknown]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D3D9 Direct3D 9 D3D11 Direct3D 11 Guardband / Range Culling Involves vertices outside fustrum. OpenGL Vulkan
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants