<div dir="ltr">thanks..I just wanted to make sure that we remove that as one of the culprit. I am wondering if it is something to do with the geometry (bbox) or <div>something to do with some edge case (calculation that is going off because of very small delta). Although in the past we have tried very think volumes <br><div><br></div><div>Is it possible for you to send a sample dataset to us? </div><div><br><div><div class="gmail_quote"><div dir="ltr">On Wed, Oct 4, 2017 at 10:09 AM Elvis Stansvik <<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Aashish,<br>
<br>
2017-10-04 15:47 GMT+02:00 Aashish Chaudhary <<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a>>:<br>
> Please make sure that your sampling distance is less than < 2. You can set<br>
> the sampling distance manually in the API.<br>
<br>
Hm. I don't think it's related to sampling distance. In the test case<br>
I'm not setting sampling distance at all, so I think it should default<br>
to 1, and then be automatically adjusted during interaction.<br>
<br>
In any case, even if I amend the test case with e.g.:<br>
<br>
volumeMapper->AutoAdjustSampleDistancesOff();<br>
volumeMapper->SetSampleDistance(0.2);<br>
...<br>
volumeMapper2->AutoAdjustSampleDistancesOff();<br>
volumeMapper2->SetSampleDistance(0.2);<br>
<br>
The result is the same.<br>
<br>
Elvis<br>
<br>
><br>
> On Wed, Oct 4, 2017 at 8:23 AM Elvis Stansvik <<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>><br>
> wrote:<br>
>><br>
>> Hi all,<br>
>><br>
>> In the test case below, I render one 200x200x2 volume and one<br>
>> 200x200x3 volume, both with the same settings.<br>
>><br>
>> The 200x200x3 volume looks as expected (the light gray one in the<br>
>> attached screenshot), while the 200x200x2 one looks strange (too dark,<br>
>> and with some kind of gradient artifact).<br>
>><br>
>> Is there some limitation on rendering a volume that is only 2 thick in<br>
>> one of the dimensions? I can understand why a volume of thickness 1<br>
>> can't be rendered properly, since VTK must have values to interpolate<br>
>> between, but 2 should be OK right?<br>
>><br>
>> Thanks for any help.<br>
>><br>
>> Elvis<br>
>><br>
>><br>
>> main.cpp:<br>
>><br>
>> #include <algorithm><br>
>><br>
>> #include <vtkColorTransferFunction.h><br>
>> #include <vtkGenericOpenGLRenderWindow.h><br>
>> #include <vtkGPUVolumeRayCastMapper.h><br>
>> #include <vtkImageData.h><br>
>> #include <vtkNew.h><br>
>> #include <vtkPiecewiseFunction.h><br>
>> #include <vtkProperty.h><br>
>> #include <vtkRenderer.h><br>
>> #include <vtkRenderWindow.h><br>
>> #include <vtkRenderWindowInteractor.h><br>
>> #include <vtkVolume.h><br>
>> #include <vtkVolumeProperty.h><br>
>><br>
>> int main(int argc, char *argv[])<br>
>> {<br>
>> vtkNew<vtkColorTransferFunction> colorFunction;<br>
>> colorFunction->AddRGBPoint(0.0, 0.0, 0.0, 0.0);<br>
>> colorFunction->AddRGBPoint(1.0, 0.0, 0.0, 0.0);<br>
>><br>
>> vtkNew<vtkPiecewiseFunction> opacityFunction;<br>
>> opacityFunction->AddPoint(0.0, 0.0);<br>
>> opacityFunction->AddPoint(1.0, 1.0);<br>
>><br>
>> // A 200x200x2 volume<br>
>> vtkNew<vtkImageData> imageData;<br>
>> imageData->SetExtent(0, 199, 0, 199, 0, 1);<br>
>> imageData->AllocateScalars(VTK_FLOAT, 1);<br>
>> std::fill_n(static_cast<float *>(imageData->GetScalarPointer()),<br>
>> 200 * 200 * 2, 0.01);<br>
>><br>
>> vtkNew<vtkGPUVolumeRayCastMapper> volumeMapper;<br>
>> volumeMapper->SetInputData(imageData.Get());<br>
>><br>
>> vtkNew<vtkVolumeProperty> volumeProperty;<br>
>> volumeProperty->SetScalarOpacity(opacityFunction.Get());<br>
>> volumeProperty->SetColor(colorFunction.Get());<br>
>> volumeProperty->ShadeOff();<br>
>><br>
>> vtkNew<vtkVolume> volume;<br>
>> volume->SetMapper(volumeMapper.Get());<br>
>> volume->SetProperty(volumeProperty.Get());<br>
>> volume->SetPosition(120, 0, 0);<br>
>><br>
>> // A 200x200x3 volume<br>
>> vtkNew<vtkImageData> imageData2;<br>
>> imageData2->SetExtent(0, 199, 0, 199, 0, 2);<br>
>> imageData2->AllocateScalars(VTK_FLOAT, 1);<br>
>> std::fill_n(static_cast<float *>(imageData2->GetScalarPointer()),<br>
>> 200 * 200 * 3, 0.01);<br>
>><br>
>> vtkNew<vtkGPUVolumeRayCastMapper> volumeMapper2;<br>
>> volumeMapper2->SetInputData(imageData2.Get());<br>
>><br>
>> vtkNew<vtkVolumeProperty> volumeProperty2;<br>
>> volumeProperty2->SetScalarOpacity(opacityFunction.Get());<br>
>> volumeProperty2->SetColor(colorFunction.Get());<br>
>> volumeProperty2->ShadeOff();<br>
>><br>
>> vtkNew<vtkVolume> volume2;<br>
>> volume2->SetMapper(volumeMapper2.Get());<br>
>> volume2->SetProperty(volumeProperty2.Get());<br>
>> volume2->SetPosition(-120, 0, 0);<br>
>><br>
>> vtkNew<vtkRenderer> renderer;<br>
>> renderer->AddVolume(volume.Get());<br>
>> renderer->AddVolume(volume2.Get());<br>
>> renderer->SetBackground(1.0, 1.0, 1.0);<br>
>><br>
>> // Render with "plain" render window / interactor<br>
>> vtkNew<vtkRenderWindow> window;<br>
>> window->SetMultiSamples(0);<br>
>> window->AddRenderer(renderer.Get());<br>
>><br>
>> vtkNew<vtkRenderWindowInteractor> interactor;<br>
>> interactor->SetRenderWindow(window.Get());<br>
>> interactor->Start();<br>
>><br>
>> return 0;<br>
>> }<br>
>><br>
>><br>
>> CMakeLists.txt:<br>
>><br>
>> cmake_minimum_required(VERSION 3.1)<br>
>><br>
>> project(TestCase)<br>
>><br>
>> find_package(VTK 8.0 COMPONENTS<br>
>> vtkCommonCore<br>
>> vtkCommonDataModel<br>
>> vtkCommonExecutionModel<br>
>> vtkCommonMath<br>
>> vtkFiltersSources<br>
>> vtkGUISupportQt<br>
>> vtkInteractionStyle<br>
>> vtkRenderingCore<br>
>> vtkRenderingOpenGL2<br>
>> vtkRenderingVolume<br>
>> vtkRenderingVolumeOpenGL2<br>
>> REQUIRED<br>
>> )<br>
>><br>
>> add_executable(TestCase main.cpp)<br>
>><br>
>> target_link_libraries(TestCase PUBLIC<br>
>> vtkCommonCore<br>
>> vtkCommonDataModel<br>
>> vtkCommonExecutionModel<br>
>> vtkCommonMath<br>
>> vtkFiltersSources<br>
>> vtkInteractionStyle<br>
>> vtkRenderingCore<br>
>> vtkRenderingOpenGL2<br>
>> vtkRenderingVolume<br>
>> vtkRenderingVolumeOpenGL2<br>
>> )<br>
>><br>
>> target_include_directories(TestCase PUBLIC<br>
>> ${VTK_INCLUDE_DIRS}<br>
>> )<br>
>><br>
>> target_compile_definitions(TestCase PUBLIC<br>
>> ${VTK_DEFINITIONS}<br>
>> )<br>
>><br>
>> set_target_properties(TestCase PROPERTIES<br>
>> CXX_STANDARD 14<br>
>> CXX_STANDARD_REQUIRED ON<br>
>> )<br>
>> _______________________________________________<br>
>> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Please keep messages on-topic and check the VTK FAQ at:<br>
>> <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>><br>
>> Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div></div></div></div></div>