I do use the stencil buffer for reducing overdraw when doing point lights.
Reading one texel from depthbuffer
I am doing this in my editor to raise/lower terrain (i.e increment/decrement values in a heightmap). To do that I first need to reconstruct the 3d point from 2d screen coords and for that I need depth for that pixel (afaik) and then somehow go from that 3d point to modify the correct hieghtmap texel (but that is a later problem).
almost sounds like a raypick vs ground mesh problem.
I am doing this in my editor to raise/lower terrain (i.e increment/decrement values in a heightmap). To do that I first need to reconstruct the 3d point from 2d screen coords and for that I need depth for that pixel (afaik) and then somehow go from that 3d point to modify the correct hieghtmap texel (but that is a later problem).
almost sounds like a raypick vs ground mesh problem.
It probably very much is :) do you have any light to shed on the subject?
Picking is often done entirely on the CPU. You construct a 3D ray and intersect it with objects / triangles in the scene.
I found a basic tutorial at: http://www.rastertek.com/dx11tut47.html
If you're using a physics engine of some kind, it should be able to handle the hit testing of the ray for you. Here's an example that uses the Bullet Physics library: http://halogenica.net/ray-casting-and-picking-using-bullet-physics/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement