<p dir="ltr">Den 13 mars 2017 8:10 fm skrev "Róbert Špir" <<a href="mailto:spir.robert@gmail.com">spir.robert@gmail.com</a>>:<br>
><br>
> Hi Elvis,<br>
> this is caused by multisampling, if you set window->SetMultiSamples(0); the<br>
> artifact will disappear. I can reproduce it in your example on windows with<br>
> nvidia card.<br>
><br>
> If you need antialiasing, you can try using FXAA which doesn't produce these<br>
> artifacts</p>
<p dir="ltr">Aha, thanks for having a look and clarifying. That makes perfect sense.</p>
<p dir="ltr">I'll give FXAA a go in a little while, when I'm back at work.</p>
<p dir="ltr">Elvis</p>
<p dir="ltr">> #include <vtkFXAAOptions.h><br>
><br>
> vtkSmartPointer<vtkFXAAOptions> FXAAOptions =<br>
> vtkSmartPointer<vtkFXAAOptions>::New();<br>
> FXAAOptions->SetRelativeContrastThreshold(0.125);<br>
> FXAAOptions->SetHardContrastThreshold(0.045);<br>
> FXAAOptions->SetSubpixelBlendLimit(0.75);<br>
> FXAAOptions->SetSubpixelContrastThreshold(0.25);<br>
> FXAAOptions->SetUseHighQualityEndpoints(true);<br>
> FXAAOptions->SetEndpointSearchIterations(12);<br>
><br>
> renderer->SetFXAAOptions(FXAAOptions);<br>
> renderer->SetUseFXAA(true);<br>
><br>
> Robert<br>
><br>
> -----Original Message-----<br>
> From: vtkusers [mailto:<a href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a>] On Behalf Of Elvis Stansvik<br>
> Sent: Monday, March 13, 2017 7:53 AM<br>
> To: VTK Users <<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>
> Subject: Re: [vtkusers] Artifacts along bounding box edges in volume<br>
> rendering<br>
><br>
> 2017-03-10 10:11 GMT+01:00 Elvis Stansvik <<a href="mailto:elvis.stansvik@orexplore.com">elvis.stansvik@orexplore.com</a>>:<br>
> > 2017-03-10 10:07 GMT+01:00 Elvis Stansvik <<a href="mailto:elvis.stansvik@orexplore.com">elvis.stansvik@orexplore.com</a>>:<br>
> >> Hi all,<br>
> >><br>
> >> I'm trying to debug a problem with artifacts appearing around the<br>
> >> bounding box edges in my volume rendering (at certain camera angles).<br>
> >> I can reproduce the problem with the minimal test case below. In the<br>
> >> attached screen shot, notice the faint white artifacts along the<br>
> >> bounding box edges.<br>
> >><br>
> >> Anyone know where these come from and how I can fix it?<br>
> ><br>
> > I forgot to say, this is with VTK 7.1.0.<br>
><br>
> Noone who knows where this comes from? Would be great if someone could<br>
> confirm that they can reproduce it with my test case, as I'm beginning to<br>
> suspect it might be graphics card specific (I'm on Linux, Intel graphics).<br>
><br>
> Should I post to vtk-dev perhaps?<br>
><br>
> Elvis<br>
><br>
> ><br>
> > Elvis<br>
> ><br>
> >><br>
> >> Thanks in advance,<br>
> >> Elvis<br>
> >><br>
> >><br>
> >> main.cpp:<br>
> >><br>
> >> #include <algorithm><br>
> >><br>
> >> #include <vtkCamera.h><br>
> >> #include <vtkColorTransferFunction.h> #include<br>
> >> <vtkGPUVolumeRayCastMapper.h> #include <vtkImageData.h> #include<br>
> >> <vtkNew.h> #include <vtkPiecewiseFunction.h> #include <vtkRenderer.h><br>
> >> #include <vtkRenderWindow.h> #include <vtkRenderWindowInteractor.h><br>
> >> #include <vtkVolume.h> #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>
> >> vtkNew<vtkImageData> data;<br>
> >> data->SetExtent(0, 200, 0, 200, 0, 200);<br>
> >> data->AllocateScalars(VTK_FLOAT, 1);<br>
> >> std::fill_n(static_cast<float *>(data->GetScalarPointer()),<br>
> >> 8000000, 0.1);<br>
> >><br>
> >> vtkNew<vtkGPUVolumeRayCastMapper> mapper;<br>
> >> mapper->SetInputData(data.Get());<br>
> >><br>
> >> vtkNew<vtkVolumeProperty> property;<br>
> >> property->SetScalarOpacity(opacityFunction.Get());<br>
> >> property->SetColor(colorFunction.Get());<br>
> >><br>
> >> vtkNew<vtkVolume> volume;<br>
> >> volume->SetMapper(mapper.Get());<br>
> >> volume->SetProperty(property.Get());<br>
> >><br>
> >> vtkNew<vtkRenderer> renderer;<br>
> >> renderer->AddVolume(volume.Get());<br>
> >> renderer->SetBackground(1.0, 1.0, 1.0);<br>
> >><br>
> >> vtkNew<vtkRenderWindow> window;<br>
> >> window->AddRenderer(renderer.Get());<br>
> >><br>
> >> // Position camera such that artifacts appear<br>
> >> auto camera = renderer->GetActiveCamera();<br>
> >> camera->SetPosition(500.0, 220.0, 500.0);<br>
> >> camera->SetFocalPoint(0.0, 80.0, 0.0);<br>
> >> renderer->ResetCameraClippingRange();<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>
> >> set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} /opt/VTK7)<br>
> >><br>
> >> find_package(VTK 7.1 COMPONENTS<br>
> >> vtkCommonCore<br>
> >> vtkCommonDataModel<br>
> >> vtkCommonExecutionModel<br>
> >> vtkCommonMath<br>
> >> vtkInteractionStyle<br>
> >> vtkRenderingCore<br>
> >> vtkRenderingOpenGL2<br>
> >> vtkRenderingVolume<br>
> >> vtkRenderingVolumeOpenGL2<br>
> >> REQUIRED<br>
> >> )<br>
> >><br>
> >> add_executable(TestCase WIN32 main.cpp)<br>
> >><br>
> >> target_link_libraries(TestCase PUBLIC<br>
> >> vtkCommonCore<br>
> >> vtkCommonDataModel<br>
> >> vtkCommonExecutionModel<br>
> >> vtkCommonMath<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">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html">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">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers">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">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
></p>