Yesterday we discussed on discord about textri and its use to render textured 3d graphic. Turns out it's not really suitable becouse the image interpolation doesn't take into account the depth of the image, creating affine texture mapping artifacts.
A possible solution that was proposed is to add three new optional parameters, d1, d2, d3 that represents the depth of the three vertices and change the interpolation method if they are provided.
The change should not be hard to implement (i could give it a try eventually), but it's probably more a question of pertinence. Should TIC support this kind of 3d primitive?
Note that one could implement his own raster in Lua but i'm sure the performance penality would be noticeable.
I think this is a good idea. I'm also making 3D stuff with textri, and this can be very handy.
Perhaps a function like textri3D()?
i don't think it warrant a new instruction, it could be made with the current textri adding 3 optional parameters (thus not breaking any existing code)
It should be done with just additional parameters , no new functions, if you don't pass in the Z parameters it should just use the normal path ( for speed ) then Z divide when needed parameters are passsd in.
I tried to implement a function to render perspective correct textured triangles in Lua, but it was way too slow. You can try subdivision, but that doesn't really work that well either. So far, the only triangles that are good for games are flat and single-color, which is boring.
We could have another one func like ptextri() to render a perspective corrected triangle.
Or something like pttri() / ttri()