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:

Color x = a_s * c_s (1 – a) + c ;

opacity c = a_s (1-a) + a

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.

EDIT INFORMATION: Thank you both for your help!

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:

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:

Sand: density 50-100, Oil: density: 100-150), Water: density 180-200; Stine: density 210-250. Values range from 0-255.

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.

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:

80 | 120 | 245.

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.

  • $\begingroup$ There is no information about the mixture, the oil, sand and water might give extra information to light dispersion, to be used by raytracer. The order of color mixing does matter, but if you only add them with precalculated color, it doesn't. To be honest, mixing material with colors and raycast 1 voxel is a bit odd. The title indicate RGB, but your data shows one value, Hue maybe? Perhaps it simply asks to precalculate alpha (half opacity is half color added) and calculate mean (not the best way to handle, but some data is missing for other options). $\endgroup$ – Evil Sep 25 '17 at 2:20
  • $\begingroup$ Since you do not fully understand the task, it is hard to give you meaningful help. I can try to help you with color calculation, but there are no guarantees it will be what is expected in the excersise. I encourage you to provide more details, at least color space, and quote the task given. If you do not have more details, there are some hiddem asumptions based on the lecture given or book recommended. Try it, quote it or ask the person who gave you the task (or appointed person to do so). $\endgroup$ – Evil Sep 25 '17 at 2:26
  • $\begingroup$ Also hard to see what the problem is, but this may help. This is an explanation of what alpha means and the compositing operator by one of the people who invented it: citeseerx.ist.psu.edu/viewdoc/… $\endgroup$ – Pseudonym Sep 25 '17 at 4:47
  • $\begingroup$ Thank you both for your help. I just added some information to the original post and explained my problem. Maybe this could help you to understand my problem! $\endgroup$ – Urakata Sep 25 '17 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.