-
Notifications
You must be signed in to change notification settings - Fork 4
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
Attributes to FS contain NaN #10
Comments
Is this happening for every pixel or just some pixels (ie, the ones on the left side of the screen)? |
I've not determined. Been trying to build a version of the demos that shows the problem. |
I've been unable thus far to build a demo that shows the issue, but I did modify my shader: public unsafe void TerrainShaderFS(byte* bgr, float* attributes, int faceIndex)
{
// UVZ
// 012
var u = renderX.Clamp01(attributes[0]);
var v = renderX.Clamp01(attributes[1]);
var terrainHeight = attributes[2];
if (float.IsNaN(u) || float.IsNaN(v) || float.IsNaN(terrainHeight))
{
bgr[0] = 0;
bgr[1] = 0;
bgr[2] = 255;
return;
}
... And yes, it's only the ones on the left side of the screen. EDIT: Whoops, just realized that I had the patch from #5 (comment) applied when I got this result. |
Running without the patch from #5 I still get errors. However they are not all on the leftmost pixel: they are scattered. |
Can you try running it with the patch, however comment out these two lines in the patch: FROM[0] = roundf(FROM[0]);
TO[0] = roundf(TO[0]); They can be found right after the |
I got my demo variation showing the problem: https://github.com/kf6kjg/renderXF/tree/issue_10 And commenting out the roundf lines didn't fix it. Here's a screenshot using |
Okay excellent, I will check it out. |
Okay, I have fixed the problem, however I will have to reexamine the scanline algorithm as some issues have emerged while testing it in XFDraw. I have created a pull request for issue_10. |
From my research it it looks like the FROM and TWO are somehow getting the same value:
This result in a div/0 error that results in the attributes getting NaN as a value.
This is based off of master at 7702efb
The text was updated successfully, but these errors were encountered: