I finished the visualization program with vtk, here are some results:<br><br><a href="http://es.youtube.com/watch?v=MEEd3oOf9To">http://es.youtube.com/watch?v=MEEd3oOf9To</a><br><br>I think it's a nice application of VTK (what can I say, I'm the father).
<br><br>Many thanks for the software!!!<br><br><div><span class="gmail_quote">2007/7/6, Francisco Jesús Martínez Serrano:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I found the problem: VTK was using the opaque codepath to render my<br>geometry. The following quick and dirty hack solved it:<br><br>actor->GetProperty()->SetOpacity(0.999999);<br><br><br>2007/7/6, Francisco Jesús Martínez Serrano:
<br>> Dear vtk users,<br>><br>> I'm trying to create an application to visualize the results of<br>> galaxy-formation simulations<br>> using particles. The technique that I want to use is the technique<br>
> that was used to make<br>> these videos:<br>><br>> <a href="http://www.aip.de/People/AKhalatyan/COSMOLOGY/STEREO/MW_ANDROMEDA/MW.htm">http://www.aip.de/People/AKhalatyan/COSMOLOGY/STEREO/MW_ANDROMEDA/MW.htm</a>
<br>><br>> It is basically a billboarding using a texture for each particle that<br>> reproduces the density field of each particle.<br>><br>> The billboarding implementation that I have so far consists of adding
<br>> all the particles as<br>> input of a vtkGlyph3D object and a vtkPlaneSource as source. The<br>> texture (consisting of a<br>> white square R=G=B=255 with varying alpha value for transparency) is<br>> then added to the
<br>> actor of the vtkPolyDataMapper of the glyph. I have set up a callback<br>> that sets the normal<br>> vector of each plane in the glyph directed towards the camera:<br>><br>> void OrientNormal( vtkObject* vtkNotUsed(object),unsigned long
<br>> eventId,void* sr,void* vtkNotUsed(calldata))<br>> {<br>> CallbackData* cd = reinterpret_cast<CallbackData*>(sr);<br>> vtkCamera* cam = cd->cam;<br>> vtkPolyData* pdata = cd->pdata;
<br>> vtkPointData *PD = pdata->GetPointData();<br>> vtkGlyph3D* glyph = cd->glyph;<br>><br>> double *rz;<br>> double rzm[3],rym[3],rxm[3];<br>> double *pos;
<br>> double *cpos = cam->GetPosition();<br>> // Vector data for directions<br>> vtkFloatArray *FA = vtkFloatArray::New();<br>> FA->SetName("directions");<br>> FA->SetNumberOfComponents(3);
<br>> uint n=pdata->GetNumberOfPoints();<br>> for (uint i=0; i<n; i++)<br>> {<br>> if ( cam->GetParallelProjection() != 0 )<br>> {<br>> rz = cam->GetDirectionOfProjection();
<br>> rzm[0] = -rz[0];<br>> rzm[1] = -rz[1];<br>> rzm[2] = -rz[2];<br>> }<br>> else<br>> {
<br>> pos=pdata->GetPoint(i);<br>> rzm[0] = -cpos[0] + pos[0];<br>> rzm[1] = -cpos[1] + pos[1];<br>> rzm[2] = -cpos[2] + pos[2];
<br>> // vtkMath::Normalize(rzm);<br>> }<br>> FA->InsertNextTuple(rzm);<br>> }<br>> // Add the data arrays to the point data<br>> PD->SetNormals(FA);
<br>> FA->Delete();<br>> }<br>><br>><br>> The problem comes with some relative postions of particles which don't<br>> work as supposed.<br>> An example can be seen at:<br>><br>> <a href="http://franjesus.googlepages.com/alphaproblem.png">
http://franjesus.googlepages.com/alphaproblem.png</a><br>><br>> Here the green particle is on the front (you can tell by the size, all<br>> particles have the same<br>> radius) and is partially covering the yellow and cyan particles. For
<br>> the yellow particle the<br>> desired effect is obtained and there's a blended transition zone. With<br>> the cyan particle, the<br>> problem happens and the green particle totally covers it until the
<br>> alpha channel goes to zero<br>> (ie. like a threshold).<br>><br>> Is there any option of the renderer that I have to set so get it<br>> working correctly?<br>> Might it be a problem with the OpenGL implementation? (nvidia linux 9755)
<br>><br></blockquote></div><br>