Hi ZBuffer and thanks for the quick reply.
OK adding what you said gives me the blend for the cube model however if i use a larger model I get the same banding again. This means that in order to output correct positions, i need to adjust the scalar to scale the position to 0-1 range so that it may not be clamped
So can I assume that the shader code is correct. Is there any other way I can verify that my shader code is correct.
It look correct indeed.
However debugging with colors has to be done with care : for best results make sure the min and max values are within [0;1]
Pass the largest size of the object to the shader, instead of hardcoded 20, to have “autoadjust”.