Logarithmic Z-buffer Example

Contained in the .blend is a horrible presentation (the scene is not pretty) of the logarithmic z-buffer.

Maybe one the better artists here can take what I did and make a prettier example. All you have to do is take the five specified lines from the GLSL code and stick them in your script to get this. You probably will notice a few optimizations that could be made to it.

City made with the suicidator city engine.

ordinary mouse look
middle mouse wheel to zoom (FOV is actually dynamically changing)
space bar focuses and zooms on the city that’s 100,000 BU’s away.
Note: mouse look automatically compensates for the smaller FOV.

Comment out the line to see how the distant city looks with the old z-buffer:

68    #### comment this next line of code 
69    #### to see what the normal z-buffer looks like.
70    #main() <--like this
71    ####

Download! 1.8 MB


Very cool. Will take a closer look at it later

Is there any chance you could hardcode this into Blender 2.5, this would be useful for more than just the BGE, but pretty much every 3D viewport mode for object and edit mode and maybe even the renderer.

wow, thats pretty cool

Very nice! I don’t have much else to say here.

Remember though, this only works with GLSL in real time.

I don’t think the offline renderer needs this since it has a much higher resolution z-buffer, but I really don’t know anything about that.

If this was to be added to gameBlenders code, I’m sure there would also have to be some c++ to go with it. I did only the most simplest of implementations. So, I think that is a little beyond my abilities.

I did this mainly to show the regular gameBlender coders that it would probably be very easy for them to implement this into Blenders code and for anyone with GLSL experience who may want to create gigantic scenes in the game engine, (eg. an entire planet with scale details).

Also, I did not come up with this: