Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mit-eddie!uw-beaver!uoregon!tillamook!markv From: markv@tillamook.uucp (Mark VandeWettering) Newsgroups: comp.graphics Subject: Re: ray tracing transparent images and color Keywords: color transparent raytracing Message-ID: <4806@uoregon.uoregon.edu> Date: 2 Jun 89 18:42:15 GMT References: <2809@scolex.sco.COM> Sender: news@uoregon.uoregon.edu Reply-To: markv@tillamook.UUCP (Mark VandeWettering) Organization: University of Oregon CIS Dept. Lines: 68 In article <2809@scolex.sco.COM> brianm@sco.COM (Brian Moffet) writes: >Just a quick (hah!) question regarding percieved color. >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. Aha. Great (and reasonably complex) topic you have accidentally stumbled upon. I recently have been thinking about precisely the problem you describe. >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. Good ole RGB color scheme..... >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. There is actually no reason to believe that the color will tend toward black at all. More on this later. >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 This is a strange set of equations, noticeably because you are using subtraction. The operator you wish to use is multiplication. Imagine that your colors are in the range 0-1 (the math is easier). Further imagine that you RGB are specific wavelengths of light. The color you perceive is due to the relative contribution of each frequency to the overall spectrum. Your transparent object acts as a filter. In order to determine the outgoing intensities after the filter, you MULTIPLY the filter at each frequency by the input frequency. For example, a perfectly clear object would have RGB like (1.0, 1.0, 1.0), and a red object would have (1.0, 0.0, 0.0). If we take your example, and normalize into the 0-1 range: {2, 0, 4} = (0.125, 0, .25) {14, 16, 10} = (0.875, .937, .625) output = (.1093, 0, .1562) = {2, 0, 2} >Does this make sense? Any good references? You method doesn't make sense, but that is because color is kind of hard to do properly. The truth is, you can't really get away with just using RGB if you want a reasonably accurate color model. Good Reference of the Day: Roy Hall's new book, published by Springer Verlag. The title... um.... help me out people, my copy is at home. Something like "Color and Illumination Models in Computer Graphics". Mark VandeWettering