Replies: 5 comments 9 replies
-
I believe the right way to solve this would be to involve the depth of the vertex in their corrected UV values; see this page on Wikipedia. I feel like this will need to be done on a per-pixel rasterization level (and so would necessitate changing the fragment shader Tetra3D uses), as well as us needing to send the depth of the relevant vertices along with the pixel information. This is essentially impossible currently, I think. It might be possible if we use the depth texture to get the depth of the pixel. |
Beta Was this translation helpful? Give feedback.
-
Right, I know the principles, but I am afraid it may be hard to achieve as it is. I was playing with modifying Ebiten so that |
Beta Was this translation helpful? Give feedback.
-
I think the alternative way to go may be subdivision of meshes - like the PS1, which could only do affine texture mapping. What do you think? |
Beta Was this translation helpful? Give feedback.
-
Hello back @SolarLune ! I noticed that you recently started branch main...perspectiveCorrected. I see mostly a refactoring there, do you think of pursuing the way of custom shader? I have been thinking about it too, but it would require passing additional uniforms to the shader, and rendering single triangle perspective correct. Too much to dive into existing codebase, hence progress is slow :) |
Beta Was this translation helpful? Give feedback.
-
OK, I added perspective-corrected texture mapping, but it's experimental; triangles aren't clipped properly at the borders of the screen, so you still get skewing if the triangle is massively offscreen. I'm also encoding the values necessary to perform the texture mapping in the alpha color channel of the vertices, which means that I don't have a lot of accuracy due to floating point errors, so the texturing is a little "fuzzy" (for now). This is most visible on animated textures. Added in the commit: ec27c53 |
Beta Was this translation helpful? Give feedback.
-
I see it is on to-do list. I was looking for a possible way to implement, maybe even with some "cheating" like in Quake (affine interpolation every 16 pixels with correct Z).
My first guess is that Ebiten's
drawTriangles
is a limitation?Beta Was this translation helpful? Give feedback.
All reactions