Draw texture without perspective on mesh with perspective depth

Good morning guys.
I know my question sounds a bit strange, so I will try to explain which is my problem and what I need.
I worked a lot on a my own engine for rendering 2.5D with 3D objects on pre-rendered screens (such old Alone in the dark, resident evil etc…)
I tried with a lot of solution, the last one consists using pre-rendered backgrounds+pre-rendered grayscale depth mask to fill z-buffer.
Last solution was very interesting, and worked well for object near cam, but unfortunately I discovered that for far objects the z-buffer precision was not so good.

In my opinion best solution for mid-grounds (so 2D pictures that can be rendered in front or behind 3D objects) would be using planes or boxes with perspective, but with a flat texture, rendered exactly as-is, without any transformation applied.

How is it possible to do it?

In attachment a simple example with my own engine to clarify better my intention.


Thanks a lot and best regards


If you want texture coordinates interpolated in screen space, add the [var]noperspective[/var] qualifier to the variable.

If you’re having issues with depth precision, try increasing the distance to the near plane.

Dear GClements, thanks for your reply,
with depth mask I tried to increase distance, but when objects are so far it’s still a bit tricky, infact I read that this solution has this kind of problem.
I should try with noperspective qualifier, but I don’t know whether this is enough to resolve.
In practice what I need is a quad that can be positioned in the space (so with a perspective, depth and so on), but with his texture rendered as I provide in the PNG file, without any interpolation.
I don’t know if it’s clear enough.

In any case many thanks!!