| Re: Question about volume objects and opacity [message #45703 is a reply to message #45702] |
Fri, 30 September 2005 14:20  |
Karl Schultz
Messages: 341 Registered: October 1999
|
Senior Member |
|
|
On Fri, 30 Sep 2005 19:31:29 +0200, Klemens Barfus wrote:
> Dear list members,
>
> trying to visualize three dimensional cloud fields, I started to work
> with object graphics. I created a testcase to get the differences
> between volume objects and polygon objects to decide which object to use.
>
> What I do not understand is the attribute opacity of the volume objects.
> In the code below opacity is 255 and therefor all the volumes should be
> opac and have the same colour. The polygon graphic should look like the
> volume graphic, or not ?
> But in the areas where there are more voxels in direction of the view,
> colour is a little bit more solid then in the areas where there is just
> one filled voxel.
>
> Is there something wrong in my understanding of volume objects ?
>
> Thanks for your help in advance !
>
> Klemens
I think your understanding is correct. The volume renderer implementation
takes some shortcuts in the name of efficiency. It uses integer math when
it can. It also pre-multiplies the color table by the opacity table.
Keeping integer math in mind, you can see that 0xff * 0xff = 0xfe01, and
if you normalize that back to 8 bits, you get 0xfe. So your effective
color for 100% red is really [254, 0, 0]. That's not the entire story,
but you get the idea. I suppose that you can argue that it is a bug, but
it may also be a planned shortcoming as a trade-off for speed.
I also point out that I really could not *visually* see the problem your
program demonstrates. I had to read the pixels back from the window and
examine them to see that the reds ranged from 247-255. Maybe I could see
the difference between a block of pixels with color [247,0,0] and a block
of [255,0,0] if they were right up next to each other, but I wouldn't be
able to detect this difference in any other situation. I don't know if the
difference is significant for you or not.
That's the explanation.
Karl
|
|
|
|