[vtkusers] vtk & shaders & GPU

Gerrick Bivins gbivins at objectreservoir.com
Mon Jun 22 11:20:32 EDT 2009


Also, vtkEdge which I think is more focused on GPGPU algorithms has license
restrictions. If you are trying to do CAD type effects (simple phong
lighting or bump mapping for example) these can be done within the framework
of "regular" VTK.

You can load a shader (glsl or cg) to an actor's property via an xml
material file or it can be defined inlined. Then turn shadingOn() on the
associated property.

Although the  documentation is somewhat lacking (changing
uniforms,attributes etc) I've found that most of what I wanted to do can be
done.

Basic methods you need look like this (Java):
{
...
 property = actorToShade.GetProperty();
 property.LoadMaterialFromString(shader.getXMLShaderCodeString());
 property.ShadingOn();
...
}

I think some of the some of the tests in VTK show exactly how to do this.

Here are the references I found a while back on the wiki
Implementation:
http://www.vtk.org/Wiki/VTK_Shaders

Brief description:
http://www.vtk.org/Wiki/Shader_In_VTK

There was a pretty good paper that I found (not easily) that walked through
a tutorial describing the basic parts of defining the shader pretty well...I
can try to dig that up if you'd like as well.
Gerrick 


On 6/22/09 9:56 AM, "Wagner Sales" <wsales at gmail.com> wrote:

> Hi Giancarlo,
> 
> You are looking for www.vtkedge.org.
> 
> Regards,
> 
> Wagner Sales
> 
> 2009/6/22 Giancarlo Amati <ilferraresebono at hotmail.it>:
>> Hello guys,
>> 
>> I would love to improve the my 3d software. I have a NVIDIA 7900GS GeForce
>> which I suppose it has a GPU. now, does vtk supports shaders and GPU
>> programming. If yes How? any example available? Any tutorial in building a
>> shader with VTK?
>> 
>> very kind regards.
>> GC
>> 
>> 
>> ________________________________
>> Personalizza Messenger 2009. Scegli la grafica che ti rappresenta meglio!
>> _______________________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>> 
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>> 
>> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list