Discussion:
[Paraview] Contribution : Silhouette edges filter
Thierry.CARRARD
2008-07-30 07:11:56 UTC
Permalink
Dear colleagues,



Here attached is a vtk filter that extracts silhouette edges from a poly data.

Silhouette of a surface is made of lines lying on the surface where the surface normal is orthogonal to a direction.



Such edges are useful to produce CAD or sketch like drawings. It can be combined with a constant colored surface rendering to hide non-visible edges.



Attached example images are made from an iso-surface, but much nicer results are achieved when working with lagrangian numerical simulations.





Usage:



Pipeline: vtkPolyData --> vtkPolyDataSilhouette --> vtkPolyDataMapper --> vtkActor



Parameters: SpecifiedVector and CameraVector modes use a uniform direction (resp. explicit or from a camera), while SpecifiedOrigin and CameraOrigin modes use the origin-to-center-of-the-edge direction. CameraOrigin mode is the one to use to produce sketch like drawings.



tips: try to combine black silhouettes edges (with line width between 1 and 3) with different kinds of surface base renderings (with or without lighting, constant colored or one color per material). It emphasizes very well the shape of some phenomena, especially for numerical simulations.



Note: Silhouette edges can also serve to generate shadow volumes, but this would need an additional contribution.





Contribution :



Author:

Thierry Carrard



Affiliation:

Commissariat ? l'Energie Atomique (CEA), Direction des Applications Militaires, D?partement des Sciences de l'Information et de la Simulation.

BP12, 91680 Bruy?res Le Chatel, France.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20080730/c9614652/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkPolyDataSilhouette.h
Type: application/octet-stream
Size: 5714 bytes
Desc: vtkPolyDataSilhouette.h
URL: <http://www.paraview.org/pipermail/paraview/attachments/20080730/c9614652/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkPolyDataSilhouette.cxx
Type: application/octet-stream
Size: 12091 bytes
Desc: vtkPolyDataSilhouette.cxx
URL: <http://www.paraview.org/pipermail/paraview/attachments/20080730/c9614652/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: glace2.JPG
Type: image/jpeg
Size: 28963 bytes
Desc: glace2.JPG
URL: <Loading Image...>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: glace1.JPG
Type: image/jpeg
Size: 28006 bytes
Desc: glace1.JPG
URL: <Loading Image...>
Paul Edwards
2008-07-30 10:13:39 UTC
Permalink
The filter looks good. I've tried to create an XML file to use in
ParaView. I've attached my attempt although I don't know how to
initialise the camera or prop. Can anyone help here?

Regards,
Paul
Post by Thierry.CARRARD
Dear colleagues,
Here attached is a vtk filter that extracts silhouette edges from a poly data.
Silhouette of a surface is made of lines lying on the surface where the
surface normal is orthogonal to a direction.
Such edges are useful to produce CAD or sketch like drawings. It can be
combined with a constant colored surface rendering to hide non-visible
edges.
Attached example images are made from an iso-surface, but much nicer results
are achieved when working with lagrangian numerical simulations.
Pipeline: vtkPolyData ? vtkPolyDataSilhouette ? vtkPolyDataMapper ? vtkActor
Parameters: SpecifiedVector and CameraVector modes use a uniform direction
(resp. explicit or from a camera), while SpecifiedOrigin and CameraOrigin
modes use the origin-to-center-of-the-edge direction. CameraOrigin mode is
the one to use to produce sketch like drawings.
tips: try to combine black silhouettes edges (with line width between 1 and
3) with different kinds of surface base renderings (with or without
lighting, constant colored or one color per material). It emphasizes very
well the shape of some phenomena, especially for numerical simulations.
Note: Silhouette edges can also serve to generate shadow volumes, but this
would need an additional contribution.
Thierry Carrard
Commissariat ? l'Energie Atomique (CEA), Direction des Applications
Militaires, D?partement des Sciences de l'Information et de la Simulation.
BP12, 91680 Bruy?res Le Chatel, France.
_______________________________________________
ParaView mailing list
ParaView at paraview.org
http://www.paraview.org/mailman/listinfo/paraview
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkPolyDataSilhouette.xml
Type: text/xml
Size: 2641 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20080730/87c16b4c/attachment.bin>
Thierry.CARRARD
2008-07-30 11:46:07 UTC
Permalink
Hi,

You don't need to initialize the prop, just the camera. I use it in my own VTK application so I'm not so familiar with Paraview architecture. Basically you have to initialize the camera with the one that is used by you're rendering window's renderer.
Here is a c++ pseudo-code :
renderer = renderWindow->GetRenderers()->GetFirstRenderer(); // correct if you have only one render

mySilhouetteFilter = vtkPolyDataSilhouette::New();
mySilhouetteFilter->SetInput( somePolyData );
mySilhouetteFilter->SetCamera( renderer->GetActiveCamera() );
mySilhouetteFilter->SetDirectionToCameraOrigin(); // this is the default

myMapper = vtkPolyDataMapper::New();
myMapper->SetInput(mySilhouetteFilter->GetOutput());

myActor = vtkActor::New();
myActor->SetMapper(myMapper);

renderWindow->AddViewProp(myActor);

PS: if you have a working plug-in for ParaView, please put it on the list or mail it to me.

Regards,
Thierry


-----Message d'origine-----
De?: Paul Edwards [mailto:paul.m.edwards at gmail.com]
Envoy??: mercredi 30 juillet 2008 12:14
??: CARRARD Thierry 601617
Cc?: paraview at paraview.org; COLIN DE VERDIERE Guillaume 114968; NOMINE Jean-Philippe 126153; COLOMBET Laurent 173059
Objet?: Re: [Paraview] Contribution : Silhouette edges filter

The filter looks good. I've tried to create an XML file to use in
ParaView. I've attached my attempt although I don't know how to
initialise the camera or prop. Can anyone help here?

Regards,
Paul
Post by Thierry.CARRARD
Dear colleagues,
Here attached is a vtk filter that extracts silhouette edges from a poly data.
Silhouette of a surface is made of lines lying on the surface where the
surface normal is orthogonal to a direction.
Such edges are useful to produce CAD or sketch like drawings. It can be
combined with a constant colored surface rendering to hide non-visible
edges.
Attached example images are made from an iso-surface, but much nicer results
are achieved when working with lagrangian numerical simulations.
Pipeline: vtkPolyData ? vtkPolyDataSilhouette ? vtkPolyDataMapper ? vtkActor
Parameters: SpecifiedVector and CameraVector modes use a uniform direction
(resp. explicit or from a camera), while SpecifiedOrigin and CameraOrigin
modes use the origin-to-center-of-the-edge direction. CameraOrigin mode is
the one to use to produce sketch like drawings.
tips: try to combine black silhouettes edges (with line width between 1 and
3) with different kinds of surface base renderings (with or without
lighting, constant colored or one color per material). It emphasizes very
well the shape of some phenomena, especially for numerical simulations.
Note: Silhouette edges can also serve to generate shadow volumes, but this
would need an additional contribution.
Thierry Carrard
Commissariat ? l'Energie Atomique (CEA), Direction des Applications
Militaires, D?partement des Sciences de l'Information et de la Simulation.
BP12, 91680 Bruy?res Le Chatel, France.
_______________________________________________
ParaView mailing list
ParaView at paraview.org
http://www.paraview.org/mailman/listinfo/paraview
Paul Edwards
2008-07-30 11:55:02 UTC
Permalink
The XML file is the only extra part that is needed in order to create
a plugin for ParaView but I'm still not sure how to go about
initialising the camera.

I've included the CMakeLists.txt required to build the plugin at the
end of the mail.

Regards,
Paul

8<--------------------------------
FIND_PACKAGE(ParaView REQUIRED)
INCLUDE(${PARAVIEW_USE_FILE})

# Server Manager Plugin
ADD_PARAVIEW_PLUGIN(PolyDataSilhouetteSMPlugin "0.1"
SERVER_MANAGER_XML vtkPolyDataSilhouette.xml
SERVER_MANAGER_SOURCES vtkPolyDataSilhouette.cxx)
-------------------------------->8
Post by Thierry.CARRARD
Hi,
You don't need to initialize the prop, just the camera. I use it in my own VTK application so I'm not so familiar with Paraview architecture. Basically you have to initialize the camera with the one that is used by you're rendering window's renderer.
renderer = renderWindow->GetRenderers()->GetFirstRenderer(); // correct if you have only one render
mySilhouetteFilter = vtkPolyDataSilhouette::New();
mySilhouetteFilter->SetInput( somePolyData );
mySilhouetteFilter->SetCamera( renderer->GetActiveCamera() );
mySilhouetteFilter->SetDirectionToCameraOrigin(); // this is the default
myMapper = vtkPolyDataMapper::New();
myMapper->SetInput(mySilhouetteFilter->GetOutput());
myActor = vtkActor::New();
myActor->SetMapper(myMapper);
renderWindow->AddViewProp(myActor);
PS: if you have a working plug-in for ParaView, please put it on the list or mail it to me.
Regards,
Thierry
-----Message d'origine-----
De : Paul Edwards [mailto:paul.m.edwards at gmail.com]
Envoy? : mercredi 30 juillet 2008 12:14
? : CARRARD Thierry 601617
Cc : paraview at paraview.org; COLIN DE VERDIERE Guillaume 114968; NOMINE Jean-Philippe 126153; COLOMBET Laurent 173059
Objet : Re: [Paraview] Contribution : Silhouette edges filter
The filter looks good. I've tried to create an XML file to use in
ParaView. I've attached my attempt although I don't know how to
initialise the camera or prop. Can anyone help here?
Regards,
Paul
Post by Thierry.CARRARD
Dear colleagues,
Here attached is a vtk filter that extracts silhouette edges from a poly data.
Silhouette of a surface is made of lines lying on the surface where the
surface normal is orthogonal to a direction.
Such edges are useful to produce CAD or sketch like drawings. It can be
combined with a constant colored surface rendering to hide non-visible
edges.
Attached example images are made from an iso-surface, but much nicer results
are achieved when working with lagrangian numerical simulations.
Pipeline: vtkPolyData ? vtkPolyDataSilhouette ? vtkPolyDataMapper ? vtkActor
Parameters: SpecifiedVector and CameraVector modes use a uniform direction
(resp. explicit or from a camera), while SpecifiedOrigin and CameraOrigin
modes use the origin-to-center-of-the-edge direction. CameraOrigin mode is
the one to use to produce sketch like drawings.
tips: try to combine black silhouettes edges (with line width between 1 and
3) with different kinds of surface base renderings (with or without
lighting, constant colored or one color per material). It emphasizes very
well the shape of some phenomena, especially for numerical simulations.
Note: Silhouette edges can also serve to generate shadow volumes, but this
would need an additional contribution.
Thierry Carrard
Commissariat ? l'Energie Atomique (CEA), Direction des Applications
Militaires, D?partement des Sciences de l'Information et de la Simulation.
BP12, 91680 Bruy?res Le Chatel, France.
_______________________________________________
ParaView mailing list
ParaView at paraview.org
http://www.paraview.org/mailman/listinfo/paraview
Moreland, Kenneth
2008-08-04 19:41:30 UTC
Permalink
Filters within ParaView have no access the camera for a variety of reasons. If you want the filter to update with new camera positions, you will have to integrate it into a representation/view. Representations and views can be added with plugins, they just take a bit more work than adding a filter.

A new feature that is available on the ParaView development branch and will be available in 3.4 is the ability for a plugin to add a new representation to the 3D View (the default view within ParaView). Right now, the feature is undocumented, but documentation should be coming soon. Perhaps Utkarsh can fill in here.

-Ken

________________________________
From: paraview-bounces at paraview.org [mailto:paraview-bounces at paraview.org] On Behalf Of Paul Edwards
Sent: Wednesday, July 30, 2008 4:14 AM
To: Thierry.CARRARD at cea.fr
Cc: guillaume.colin-de-verdiere at cea.fr; Laurent.COLOMBET at cea.fr; Jean-Philippe.NOMINE at cea.fr; paraview at paraview.org
Subject: Re: [Paraview] Contribution : Silhouette edges filter


The filter looks good. I've tried to create an XML file to use in
ParaView. I've attached my attempt although I don't know how to
initialise the camera or prop. Can anyone help here?

Regards,
Paul
Post by Thierry.CARRARD
Dear colleagues,
Here attached is a vtk filter that extracts silhouette edges from a poly data.
Silhouette of a surface is made of lines lying on the surface where the
surface normal is orthogonal to a direction.
Such edges are useful to produce CAD or sketch like drawings. It can be
combined with a constant colored surface rendering to hide non-visible
edges.
Attached example images are made from an iso-surface, but much nicer results
are achieved when working with lagrangian numerical simulations.
Pipeline: vtkPolyData ? vtkPolyDataSilhouette ? vtkPolyDataMapper ? vtkActor
Parameters: SpecifiedVector and CameraVector modes use a uniform direction
(resp. explicit or from a camera), while SpecifiedOrigin and CameraOrigin
modes use the origin-to-center-of-the-edge direction. CameraOrigin mode is
the one to use to produce sketch like drawings.
tips: try to combine black silhouettes edges (with line width between 1 and
3) with different kinds of surface base renderings (with or without
lighting, constant colored or one color per material). It emphasizes very
well the shape of some phenomena, especially for numerical simulations.
Note: Silhouette edges can also serve to generate shadow volumes, but this
would need an additional contribution.
Thierry Carrard
Commissariat ? l'Energie Atomique (CEA), Direction des Applications
Militaires, D?partement des Sciences de l'Information et de la Simulation.
BP12, 91680 Bruy?res Le Chatel, France.
_______________________________________________
ParaView mailing list
ParaView at paraview.org
http://www.paraview.org/mailman/listinfo/paraview
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20080804/ecc3e9ba/attachment.htm>
Utkarsh Ayachit
2008-08-05 16:45:00 UTC
Permalink
Actually, I think a new view type that applies the silhouette filters to
all the props rendered in the scene might be more appropriate. There are
plugin examples that talk about how to add a new view to ParaView. Thoughts?

Utkarsh
Post by Moreland, Kenneth
Filters within ParaView have no access the camera for a variety of
reasons. If you want the filter to update with new camera positions,
you will have to integrate it into a representation/view.
Representations and views can be added with plugins, they just take a
bit more work than adding a filter.
A new feature that is available on the ParaView development branch and
will be available in 3.4 is the ability for a plugin to add a new
representation to the 3D View (the default view within ParaView). Right
now, the feature is undocumented, but documentation should be coming
soon. Perhaps Utkarsh can fill in here.
-Ken
------------------------------------------------------------------------
*From:* paraview-bounces at paraview.org
[mailto:paraview-bounces at paraview.org] *On Behalf Of *Paul Edwards
*Sent:* Wednesday, July 30, 2008 4:14 AM
*To:* Thierry.CARRARD at cea.fr
*Cc:* guillaume.colin-de-verdiere at cea.fr; Laurent.COLOMBET at cea.fr;
Jean-Philippe.NOMINE at cea.fr; paraview at paraview.org
*Subject:* Re: [Paraview] Contribution : Silhouette edges filter
The filter looks good. I've tried to create an XML file to use in
ParaView. I've attached my attempt although I don't know how to
initialise the camera or prop. Can anyone help here?
Regards,
Paul
Post by Thierry.CARRARD
Dear colleagues,
Here attached is a vtk filter that extracts silhouette edges from a poly data.
Silhouette of a surface is made of lines lying on the surface where the
surface normal is orthogonal to a direction.
Such edges are useful to produce CAD or sketch like drawings. It can be
combined with a constant colored surface rendering to hide non-visible
edges.
Attached example images are made from an iso-surface, but much nicer
results
Post by Thierry.CARRARD
are achieved when working with lagrangian numerical simulations.
Pipeline: vtkPolyData ? vtkPolyDataSilhouette ? vtkPolyDataMapper ?
vtkActor
Post by Thierry.CARRARD
Parameters: SpecifiedVector and CameraVector modes use a uniform direction
(resp. explicit or from a camera), while SpecifiedOrigin and CameraOrigin
modes use the origin-to-center-of-the-edge direction. CameraOrigin mode is
the one to use to produce sketch like drawings.
tips: try to combine black silhouettes edges (with line width between
1 and
Post by Thierry.CARRARD
3) with different kinds of surface base renderings (with or without
lighting, constant colored or one color per material). It emphasizes very
well the shape of some phenomena, especially for numerical simulations.
Note: Silhouette edges can also serve to generate shadow volumes, but this
would need an additional contribution.
Thierry Carrard
Commissariat ? l'Energie Atomique (CEA), Direction des Applications
Militaires, D?partement des Sciences de l'Information et de la Simulation.
BP12, 91680 Bruy?res Le Chatel, France.
_______________________________________________
ParaView mailing list
ParaView at paraview.org
http://www.paraview.org/mailman/listinfo/paraview
------------------------------------------------------------------------
_______________________________________________
ParaView mailing list
ParaView at paraview.org
http://www.paraview.org/mailman/listinfo/paraview
Continue reading on narkive:
Search results for '[Paraview] Contribution : Silhouette edges filter' (Questions and Answers)
19
replies
Do you know Himedal, the poet?
started 2011-02-14 12:58:53 UTC
poetry
Loading...