RenderKit / ospray

An Open, Scalable, Portable, Ray Tracing Based Rendering Engine for High-Fidelity Visualization
http://ospray.org
Apache License 2.0
1.02k stars 186 forks source link

Wrong result when rendering multiple volumes #134

Closed wilsonCernWq closed 7 years ago

wilsonCernWq commented 7 years ago

Hi

I found OSPRay will give wrong rendering result when there are multiple volumes in the scene. What I did was simply putting four identical volumes next to each other, and rendered them using one ospModel.

In the result, some volumes seemed to be skipped by the ray and became transparent (volumes supposed to be visible were missed). Look at areas near volume boundaries in the attached images.

I tested my code with both block_bricked_volume and shared_structured_volume. They gave me identical results. My code is uploaded here: https://github.com/wilsonCernWq/OSPRayTinyLoader/blob/volume-debug/src/otv_main.cpp

screenshot from 2017-03-16 16-18-07

screenshot from 2017-03-16 16-18-53

screenshot from 2017-03-16 16-17-30

Can anyone help me with that? Thanks!

johguenther commented 7 years ago

Hi, you are right: multiple volumes are currently not well handled in OSPRay (even more so when they intersect). The SciVis renderer is about to be refactored, also with the goal to better handle your situation. We'll keep you posted when the improvements are available. Best regards, Johannes

wilsonCernWq commented 7 years ago

Hi I noticed my issue is here still. Actually I found the bug a while ago and updated it inside my fork already I just want to make this as a reminder so that the issue will be fixed in the next release :smile:

In ospray/ospray/render/scivis/SciVisRenderer.ispc line 212 (devel branch)

volumeColor = SciVisRenderer_computeVolumeInterval(renderer, v, ray, tBegin, tEnd, .98f - color.w, 0, rayOffset, sampleID, 1.f);

The 6th argument should be changed to 1.0f or 0.99f. The early termination opacity should always be one for each volume. Otherwise the ray will exit too early and go directly into the second volume.

carsonbrownlee commented 7 years ago

hi Wilson, this actually was fixed already but is currently in a merge request for devel. That merge request should likely be merged with devel very soon.

carsonbrownlee commented 7 years ago

I'll go ahead and close this issue, and thanks for reporting it!