Date: Wed, 10 Dec 1997 00:28:03 +0400 From: Charles Blaquiere Subject: Re: [IML] Quest : Colored Shadows Voitek Niedbala wrote: > > First off, I would like to say hello. I am a very "fresh" Imagine User Welcome! > I have this partially transparent object with a green color applied to it. > Whenever I get a light that shines through it, it makes a partial shadow, > but no coloring, just a gray shadow. How can i make it so that it makes a > partially green shadow. I once reported this to Mike H. as a ray trace "bug", but it turned out to be a "feature". To create a semitransparent green object that gives a green shadow, you can't just create a green object and give it a 128,128,128 filter; this creates a grey shadow. (I know, this is counterintuitive, because the scene visible behind the object looks tinted; but it seems as if shadow calculations don't take into account the mixture of object color and transparency, just transparency) To get green shadows, use a filter setting like 0,128,0. ---------------------------------- Date: Wed, 10 Dec 1997 13:37:57 -0800 From: Clae & Deborah Tanett -----Original Message----- From: Voitek Niedbala Date: Tuesday, December 09, 1997 10:08 PM >Thanks for the info, but could you or someone on the list explain to me why >the normal filter settings didn't work. And could someone explain the >filter settings too. >Thanks >Voitek Niedbala >amethyst@enteract.com > Clae here Tried the Transpar.itx... it bombed on this task. I used a fiter setting of 100, 225, 100 to get the green shadow. Setting the Rrefr.Index the determined the effect of the shadow cast (1.5 looked good - I used a primitive sphere for the test). I see Charles Blaquiere writes of using a similar but lower setting but I didn't get a discrenible green shadow with such a setting. Fiter setting of 75, 215, 75 worked well also for a dark green shadow. My learned .02 worth. ---------------------------------- Date: Fri, 12 Dec 1997 21:09:53 +0400 From: Charles Blaquiere Bill Graham wrote: > > I've always used a filter setting where all three guns are the same, > usually pretty high, and the Color settings for the shadow color. So, for > a green glass sphere that casts a green shadow, try a filter of 180, 180, > 180, with a color of 50, 255, 100 or so. and, of course, a suitable index > of refraction. Unfortunately, Bill, when I use a greyscale filter setting on a green object, I get a grey shadow. (The background has a green tint, of course) If you only consider object color and base transparency for a moment, to determine the color of an object, Imagine mixes appropriate proportions of object color with "whatever's behind it" (the background). The mix ratio is controlled by the filter setting. Again, your apparent object color takes into account the base color _and_ the filter setting. When tracing shadows, however, Imagine only seems to take the object's filter setting into account, _not_ the base color. For example, place two spheres next to each other, both with filter = 192,192,192. Give one sphere a base color of 255,0,0 (red), and the other 0,255,0 (green). Trace with shadows on. You'll see both object project a 192,192,192 grey shadow. This is the cause of Voitek's problem. The quickest solution is to give the same RBG value to both filter and object color, so that transmitted light is the same color, regardless whether you're talking about light rays going to the camera (object + background), or light rays going towards a light source (shadow calculations). ---sidebar--- Since hue depends on the _ratio_ between R, G, and B, you can then adjust the object transparency (and thus the depth of its shadow) by multiplying each RGB filter component by the same number. This will lighten or darken the shadow without changing its color. For example, make an object gold (240,200,100) and use the same RGB value for its filter setting. Copy/Paste it, and move the copy to the side. Change the copy's filter setting to 180,150,75, i.e. multiply each RGB component by 0.75. When you trace, you'll see a deeper shadow, but of the same color. If you had deepened the shadow by _subtracting_ the same amount (e.g. 50, giving you 190,150,50) you would've changed the RGB ratios, and thus the hue. (This shadow appears redder) ------------- Finally, for Voitek, here's the actual definition of Imagine's filter setting. This setting works separately on each R, G, and B channel. It determines how much light of each RGB component passes through the object. A value of zero means no light is filtered through (or passes through) the object. You get a perfectly opaque object. Whatever lies in the background is irrelevant; it won't be seen. A value of 255 means all light is filtered through (or passes through) the object. You get a perfectly transparent object. The object base color is irrelevant; it won't be seen. Anything in between will make Imagine mix object surface appearance with transmitted light from the background. At 64, you'll get 25% transparency and 75% object color. At 128, you'll get 50% of each. At 192, you'll get 75% transparency and 25% object color. To deal with transparency, you must have a measure of "RGB literacy"i.e. the ability to visualize what color a certain RGB value represents. For example, a common beginner situation has the user creating a default (white) sphere in front of a black-and-white checkerboard plane. When they change the sphere's filter to 0,255,0, parts of the sphere appear purple! Why is that? The object is fully transparent in one channel, fully opaque in the others. Mathematically, each pixel belonging to this object will appear as: Red 0% background + 100% object = 255 Green 100% background + 0% object = background Blue 0% background + 100% object = 255 So the only thing that will vary across the object will be the green component, taken straight from the background at each pixel. (This example ignores factors such as lighting, reflectivity, etc. Only object color and filter are taken into account) Where the background is white (255,255,255), you'll get 255 units of green added to the object, giving you a total of 255,255,255 (white); but where there are black (0,0,0) checks in the background, zero units of green will be added, giving a total of 255,0,255 (purple). Therefore, you get purple-and-white checks. Totally counterintuitive, but mathematically correct. The problem is that no objects exist in our world that are white yet let green light shine through; thus the user can be forgiven for being baffled. This extreme example is only made possible in Imagine's virtual world, where you can enter numbers that have no basis in reality. If you use a filter setting related to the object color, you'll have a much easier time. ---------------------------------- Date: Fri, 12 Dec 1997 14:34:41 +0100 From: Stephane Van Israel Subject: Re: [IML] Quest : Colored Shadows (other kind of shadow) >Date: Fri, 12 Dec 1997 14:34:25 +0100 >To:Imagine >From:vanisrael@fytr.ucl.ac.be >Subject:Re: [IML] Quest : Colored Shadows (other kind of shadow) > >>I've always used a filter setting where all three guns are the same, >>usually pretty high, and the Color settings for the shadow color. So, for >>a green glass sphere that casts a green shadow, try a filter of 180, 180, >>180, with a color of 50, 255, 100 or so. and, of course, a suitable index >>of refraction. >> >>many ways to skin a cat with this proggy. >> >> >Don't forget that if you try to mimick a colored shadow created by the >saturation of certain kind of colored light (orange light gives a bluish >shadow) or something like the shadow you see on snow you can use the >ambient type of mapping. >It gives a kind of "impressionistic" look to your renderings. > >..and just a thought, use a very bright green bitmap as an ambient mapping >on your object, make an anim where you decrease the light from 100% to >0%..it will give you a spooky effect looking much like something lighten >with "blacklight" (you know, "the fluo look") > >Just a suggestion that is of course not usable in this case. ---------------------------------- Date: Wed, 10 Dec 1997 08:41:30 MST From: Ian Stearns Subject: [IML] Quest : Colored Shadows...explanation Thanks for the info, but could you or someone on the list explain to me why the normal filter settings didn't work. And could someone explain the filter settings too. Thanks Voitek Niedbala amethyst@enteract.com The explanation could be summed up with the question: Why does an air filter only output air? The "normal" filter settings filter all light going through, allowing only the 128,128,128 color to go through (pretty much). When filter is set to 0,0,0 on a green object, the shadow doesn't come out green...it comes out black because only light colored 0,0,0 get's through (which is to say, NO LIGHT gets through) Whenever using the Filter attributes, just imagine a stage gel placed over a lamp. A Red gel will block all colors but red...etc. But, what color over shadow would you get if you placed a red gel over a green light? :) experiment. It's kind of nice that the Face Color and Filter values are independent...makes for nice effects...like a Red Specular highlight on a Green Ball, with a blue filter. Wacky! BTW, the Transparent.itx takes the face color value and copies it to the filter value, allowing any regular texture to be turned into a transparent texture....and thus projected by a shadow casting light. Good for making slideshows and movie projectors (and great light effects!) ABColor2Attrib is an IFW texture by Alan Bucior which is also quite useful. the end. good enough??