Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volume rendering is wrong #37

Open
GregAbram opened this issue Feb 11, 2016 · 2 comments
Open

Volume rendering is wrong #37

GregAbram opened this issue Feb 11, 2016 · 2 comments

Comments

@GregAbram
Copy link
Member

If you do a wavelet and use an all-white colormap against a white background, you should get a all-white image - a polar bear in snow picture, because opacity * white + (1 - opacity) * white is white. You do in a RenderView, but not in an OSPRay window - places where the opacity is low are dark. Maybe the data value is multiplied by the opacity twice - once as part of the accumulation along the array and later against the background?

@carsonbrownlee
Copy link
Collaborator

I’ve noticed that the colormaps in general for volumes and geometry seem to be a bit off. Will forward to the intel folks, your guess sounds likely for volumes, not sure what’s going on with geometry coloring.
Carson

On Feb 11, 2016, at 12:30 PM, Greg Abram notifications@github.com wrote:

If you do a wavelet and use an all-white colormap against a white background, you should get a all-white image - a polar bear in snow picture, because opacity * white + (1 - opacity) * white is white. You do in a RenderView, but not in an OSPRay window - places where the opacity is low are dark. Maybe the data value is multiplied by the opacity twice - once as part of the accumulation along the array and later against the background?


Reply to this email directly or view it on GitHub #37.

@GregAbram
Copy link
Member Author

Yes, its in OSPRay. RaycastVolumeRenderer_computeVolumeSample is attenuated first by the samples's w:

color = clamp(sampleOpacity / volume->samplingRate) * make_vec4f(sampleColor.x, sampleColor.y, sampleColor.z, 1.0f);

which is accumulated along the ray, where color is the accumulation and volumeColor is the sample:

color = color + (1.0f - color.w) * volumeColor;

Suppose the current color is (0,0,0,0) and we only do one sample, resulting in a volume color of (0.5,0.5,0.5,0.5) - that is, white attenuated by opacity/samplingRate = 0.5. The result of accumulation is (0.5,0.5,0.5,0.5) Now if background is enabled - say (1,1,1,1), it gets applied:

color = color.w * color + (1.0f - color.w) * background;

and the result is 0.5_(0.5,0.5,0.5,0.5) + (1-0.5)_(1,1,1,1) = (0.75,0.75,0.75,0.75)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants