i was wandering if it is possible to beat polygon count with ray marching. instead of just wondering around with the idea, i start coding. for start every object is like a terrain object. only use single height map and a color texture. usually people store height in the alpha channel, but i think alpha channel is required to make a non “cube object”. for example a coin. same technique, same primitive, plus alpha channel. check out the famous lion and wall texture being rendered.
from the distance function i can get a nice depth map of objects. and each object means doing a render target volley so i can compare the depth. here is a quick example of 2 object rendered. black means far from camera. notice the nice intersection between object.
next i create a simple deferred rendering by generating normal map. normal map generated from the depth field. also deferred rendering requires positions which also generated from the depth map. as you can see below, the 3 component of deferred rendering, the position is not being renderer. see the lower right square is the scene lit by a simple lighting calculation
the final image looks like this, well i drop the ambient lighting for more geometry exposure. as you can see artifact appear in some places. on the bottom middle part of the image, some sort of rippling appear. it is easily fix by increasing the color depth of the render texture. increasing render target texture from a8r8g8b8 to a32r32g32b32 sadly kill the performance. probably due to render target switching (volley).
i borrow some texture from these sites