Depth textures

Is there a way to put z information in a texture (relative to the textured surface, not absolute screen space Z) and render it ?

I suppose you could use the depth-write feature of GL_ARB_fragment_program.

Yes this is possible. Nvidia did this in their tide pool demo calling it “z correct bump mapping”. Unfortunately they’ve managed to hide it so well I can’t find any reference to it on their site.

ATI also showed it for their Mojo Day presentation, with an extremely nice looking explosion on a field. Two quads, but it looked great, because the explosion quad was a billboard with depth per pixel in an animation.

Slide 15 of 88 here:

This is possible with NV_texture_shader and NV_texture_shader3 (dot_product_depth_replace and dot_product_affine_depth_replace respectively) as well. Just use depth scale and bias via texture stages coordinates for placing depth-sprite in right place at scene.