I have a requirement to detect which pixel of a texture is under the cursor in the 3D world. I assume that Ray casting is involved however, after that I'm not sure how one would accomplish this.

Can anyone please point me to an example? Preferably one that does not require a PhD to understand... lol

  • \$\begingroup\$ The problem is called picking. Do you actually need to know which texel, or just the color (or data) of the texel? \$\endgroup\$
    – MickLH
    Commented Nov 3, 2017 at 20:41
  • \$\begingroup\$ I actually need the location within the texture so I can look it up on the original image used for the texture. We are colorizing black and white image and I need the levels form the original. \$\endgroup\$
    – Reaper
    Commented Nov 3, 2017 at 21:21
  • \$\begingroup\$ Your options are raycasting and rasterizing. The raster approach is preferable if you'll fix the camera position and pick several pixels from random points on the screen. It also guarantees a pixel perfect match with the visual rendering. However, the raycasting approach is conceptually simpler and doesn't require interfacing with rendering hardware. (Though, if you already have the raster visuals set up, it might be easier to implement raster picking in practice.) \$\endgroup\$
    – MickLH
    Commented Nov 3, 2017 at 22:04
  • \$\begingroup\$ The camera is a pan, zoom and rotate on Z axis. We are loading huge high resolution composite images (32,880 x32,880) on multiple quads. The requirements are to replace an imaging system that has been build on 2D capabilities. Thank you for any help or insight you can provide. \$\endgroup\$
    – Reaper
    Commented Nov 3, 2017 at 22:19


You must log in to answer this question.

Browse other questions tagged .