Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mit-eddie!uw-beaver!cornell!vax5!z8my From: z8my@vax5.CIT.CORNELL.EDU Newsgroups: comp.graphics Subject: Re: ray tracing transparent images and color Keywords: color transparent raytracing Message-ID: <18775@vax5.CIT.CORNELL.EDU> Date: 10 Jun 89 07:28:19 GMT References: <2809@scolex.sco.COM> Sender: news@vax5.CIT.CORNELL.EDU Reply-To: z8my@vax5.cit.cornell.edu (Samuel Paik) Organization: XYNE knowledge structures Lines: 70 In article <2809@scolex.sco.COM> brianm@sco.COM (Brian Moffet) queries about transmitted light colors: >I was doing some thought experiments on how one would >do a ray trace of a transparent object. Ignore everything >except tint of the object. So, no refraction or reflection >involved. >I am going to work in a simple color scheme, where colors >will be defined as scales of red-green-blue with 0 being >lowest (ie off) and 16 being highest. >Given an object whose tint is { 2, 0, 4 } (r,g,b) in front of >a background whose solid color is { 14, 15, 10 }. >So, a different color will be shown for the object due to the >interaction of the transparent object and the solid background. >I also assume that the color will tend toward black. For the scheme I will present below (which while probably not theoretically correct, or even common usage in the computer graphic community) it would be much more convenient to keep colors using floats in the range 0..1. >Given this, I would say that I can take the two objects and combine them >in the following equation: > > Rfinal = Rback - Gobject - Bobject > Gfinal = GBack - Robject - Bobject > Bfinal = Bback - Gobject - Robject > >for a final shown color of { 10, 9, 8 }. How about Rfinal = Rback*Robject Gfinal = Gback*Gobject Bfinal = Bback*Gobject This is how I implemented transparency in my final project (a ray tracer) for a computer graphics course here at Cornell (with Don Greenberg as professor...) Since I sort of drifted through the lectures on color science, I can not attest to the correctness of this, but it seemed to produce reasonable results. >The reason I think this wa is it does produce blak on opposing colors >like red object and blue background. This scheme does too. Purely blue objects transmit NO red light. >Does this make sense? Any good references? What happens in your scheme when the color of the object is greater than the color of the background? >thanks. You are completely welcoe. >brian moffet >Please excuse spelling errors, This machine doesn't have spell! Ditto... well, I'm actually posting from a machine using the Eunice UNIX emulator for VMS. It breaks on a lot of things--I'm afriad to try spell, at least right now. Samuel Paik Internet: d65y@vax5.cit.cornell.edu note:^^^^ not z8my