[vtk-developers] Help with new illumination model for vtk

Jana Sefcikova neollie at gmail.com
Fri Apr 20 14:34:30 EDT 2012


Dear Users, I would like kindly ask you for any help/idea for new
illumination model.

It looks that vtk supports two basic shading models - Gouraund and Phong
and I found one lighting preset (vtkLightKit). I am working on new lighting
model that use intensity color of points resulting from other shading model
and according to complex algorithm generate absolutely new colors. New
algorithm produce inconsistent lights (lights are specifically assigned
only to some parts of input ), probably no lights will be preset in
rendering pipeline only final colors will be generated and shown, there
will be special blending and shadowing and other techniques like
back-lighting .

Currently I am working on first step , generate new colors and I am looking
for some function like color = GetColor (mesh point ), that is able return
real rendered color of the point.
Example: user presets scene, lights, materials or for example
preset lookup function and chooses Phong shading but for rendering he will
use new model. I am taking into account materials and object colors only as
an example, I do not know whether they will be finally incorporated due to
potential complexity.

My algorithm has to know these settings, and generate slightly different
illumination. So result will be only colors in this step.

Thus my question can be formalise as follow : Is there any possibility how
to obtain color of the point (in mesh) in the current scene according to
chosen illumination model and object/light properties and view vector
(without shading) using vtk CPU code ?
Simple version: Is there any possibility how to obtain gray color value of
the point (in mesh) in the current scene according to chosen illumination
model and directional white lights and likely white object using vtk CPU
code ?
I need exact color of the object as it is seen after rendering without
shading.

I found two shaders that seem to do what I am looking for :
vtkLighting_s.glsl and vtkLightingHelper_s.glsl
With current knowledge I do not know how precisely they match color
computation as is done with vtk rendering pipeline.
I would like use original vtk design as close as possible .

If there is no such CPU function I have following ideas :
1) One approach could be , dump mesh points into 3D texture (with normals)
and simulate some illumination via shaders like those mentioned, store
result into new 3d texture  and than unpack obtained illumiation back into
CPU and store it to some array as point property.
2) Other approach could be , rewrite shaders code into CPU class (if such
does not exist ? ) that should know all mentioned properties ... I am not
sure whether it is possible
3) Most simple approach would be to generate vtk independent illumination
function, ignore all vtk settigns (ligts, object colors, light properties
..), turn off lighting, and hardcoded compute illumination.
For example : i will use 0.4*specular term +0.6*diffuse term.  No color is
taken into account, only shading with specular and diffuse shading. (very
simple version of Phong)
I am not able to validate estimate complexity for now.

Further I do not know whether this can be vtkAlgorithm, or I will have to
write new render pipeline (I saw vtkRenderPasses ) or it will be
vtkLightPass .

As I am new in vtk, I would appreciate any advice concerning design, your
opinion to proposals,  reference examples (there are  some GPU rendering
examples ), texts or whatever concerning illumination concept for vtk.

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20120420/7d8aaf48/attachment.html>


More information about the vtk-developers mailing list