Quote Originally Posted by unknown123 View Post
Thanks for your reply programmerX. I have tried your method. It helped me.
Glad to help. I should mention that this method might work, but it is not physically correct. So you might get some strange artifacts under some circumstances. I am not sure, since I haven't checked it, but if you want it physically correct you might end up with the method mentioned by GClements.
In reality the light from the object behind the surface will be partially transmitted and add up with the reflected light. So you would do something like taking the color value in the color buffer (which should not be clamped to 1) multiply it by a factor that represents the percentage of transmitted light and add this up with the reflected light from the surface. After you have calculated all the color values in your scene, you need to divide every value in the color buffer by the same value to scale most of the values back into the range of 0-1. This what your eye is usually doing by controlling how much light is let in. Some of the mentioned steps might not be as easy to implement as it sound.

Quote Originally Posted by unknown123 View Post
Now i have another question. How to only apply color to the the edges of object.
Well, can't help you with a specific solution since I have not done it myself and I am currently preparing all the low level stuff to start a new graphics engine. Means I am currently not doing much graphic related stuff. I can only give you a hint here: I know that there is a section about edge detection in the OpenGL Cookbook. Every topic also has minimal code examples. So you could start there. The book is available for free as a pdf. Just google it.