Alpha Blending (?) of RGB colors - Computer Science Stack Exchange most recent 30 from cs.stackexchange.com 2019-11-14T02:18:22Z https://cs.stackexchange.com/feeds/question/81613 https://creativecommons.org/licenses/by-sa/4.0/rdf https://cs.stackexchange.com/q/81613 0 Alpha Blending (?) of RGB colors Urakata https://cs.stackexchange.com/users/77706 2017-09-24T16:22:06Z 2017-09-25T13:52:10Z <p>I've got a theoretical exercise at my university which belongs somewhere between alpha blending and ray casting – to be honest, I’m not sure. It says, that we are looking at a voxel (1-centimeter distance) which consists of different colors (sand: yellow, stone: red, oil: green and water: blue) where sand and water are transparent, stone is half transparent and oil is completely opaque. This information led to the following color value: 80 | 120 | 245 The value ranges from 0 – 255. The function values of the given elements are: sand (50-100), oil (100-150), water (180-200), stone (210-250). Now we are supposed to calculate the actual value of the pixel given the formula:</p> <p>Color x = a_s * c_s (1 – a) + c ;</p> <p>opacity c = a_s (1-a) + a</p> <p>Where a_s stands for alpha sample and c_s for color sample. I’m already thinking about this problem since days. I can’t differentiate between a_s and a. I’m quite sure I have to solve this problem recursively but how do I initiate the first step?... Suppose that a is 0 at the beginning and just use the information in the text? Also is there any meaning regarding the order of the calculation? Maybe someone understands my problem. </p> <p>EDIT INFORMATION: Thank you both for your help!</p> <p>I fully understand that it is really unclear what we are supposed to do because the wording of the exercise is pretty messy. I try to be more precise:</p> <p>The whole exercise, consisting of 5 subtasks, gave us the following information (translated from my native language): “You are given a volume data set regarding the earth structure of an earth field. The following relationship between these density values exists:</p> <p>Sand: density 50-100, Oil: density: 100-150), Water: density 180-200; Stine: density 210-250. Values range from 0-255. </p> <p>From a)-d) we were supposed to draw the transfer functions of these opacities. D) says: “Draw the transfer function for the opacity given that sand and water are transparent, oil is semi-transparent and stone fully opaque. </p> <p>Now coming back to the initial question: “An observer looks from the left side at the voxels with the same density from a distance of 1 centimeter. The voxel influence the calculated color value with their initial colors (sand yellow, stone red, oil green, water blue) and the opacity given in subtask d), which is:</p> <p>80 | 120 | 245. </p> <p>Calculate the actual color value for the visible pixels (using the formulas above). I (!) can just assume that the three digits represent a RGB code because the given colors of the elements could translate into: R=80=Stone; G=120=Oil; B=245=Water. I also just assumed ray casting because there is a volume data set given, even though I recognize some formula elements of Alpha Blending in the formula given in the text. So that is why I’m so confused.</p>