Reading one texel from depthbuffer

Started by
12 comments, last by Adam_42 7 years, 2 months ago

I do use the stencil buffer for reducing overdraw when doing point lights.

Advertisement

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.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

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