Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Draw texture without perspective on mesh with perspective depth

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2015

    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.

    Click image for larger version. 

Name:	FlatTexture.jpg 
Views:	39 
Size:	18.8 KB 
ID:	2864

    Thanks a lot and best regards


  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    If you want texture coordinates interpolated in screen space, add the noperspective qualifier to the variable.

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

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2015
    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!!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts