[vtkusers] Rending texture problem

quengzi quengzi at gmail.com
Sun Sep 26 00:20:14 EDT 2010


I have read the source code of vtk3DSImpoter and vtkOBJReader, vtk3DSImpoter
implement below functions which related the metadata:
ImportProperties // just walk the list of material properties, creating vtk
properties
ImportLights
ImportCameras
ImportActors
And there is a function named "parse_mdata":
if (chunk.end <= mainchunk->end)
      {
      switch (chunk.tag)
        {
        case 0x2100: parse_colour (importer, &global_amb);
          break;
        case 0x1200: parse_colour (importer, &bgnd_colour);
          break;
        case 0x2200: parse_fog (importer, &chunk);
          break;
        case 0x2210: parse_fog_bgnd(importer); //It's a empty function, not
implement yet
          break;
        case 0xAFFF: parse_mat_entry (importer, &chunk);
          break;
        case 0x4000: parse_named_object (importer, &chunk);
          break;
        }
      }
the vtkOBJReader in the* IO* folder, but the vtk3DSImporter be put into*Hybird
* folder.


2010/9/26 quengzi <quengzi at gmail.com>

> Thank you Eric very much!
> Your advise is very important for me, I have searched the old mailing list,
> but most of the problem about 3DSImpoter is no result. I think you are
> right, the designer need send me another file format.
>
> Yun
>
> 2010/9/26 Eric E. Monson <emonson at cs.duke.edu>
>
> Hey Yun,
>>
>> I've never used the vtk3DSImporter (or dotnet), but I would guess that if
>> the importer has problems with textures, then probably it's not just losing
>> the textures, but it's also not importing the texture coordinates. So, when
>> you try to apply a texture manually there is nothing to tell the system
>> where to put the texture.
>>
>> I have a feeling, looking back on old mailing list postings, that the
>> 3DSImporter really just grabs the most basic geometry, and computes Normals,
>> but it's not designed to pull in anything more than the polygons. I'm sure
>> this will disappoint you, but maybe there's a chance someone else has
>> another solution for converting your file into another format...?
>>
>> Good luck,
>> -Eric
>>
>> ------------------------------------------------------
>> Eric E Monson
>> Duke Visualization Technology Group
>>
>>
>> On Sep 25, 2010, at 11:22 AM, quengzi wrote:
>>
>> > Hi all,
>> >
>> > I'm a newer of VTK, I use VTK Dotnet to open a 3ds file, someone tell me
>> that vtk3DSImpoter do not support texture, so I want to draw it by manual,
>> but it failed, I cannot see any different after add the texture by manual,
>> below is my code:
>> >             string fileName = @"E:\VTK\3D Module\Mickey\Mickey.3ds";
>> >             vtk3DSImporter importer = new vtk3DSImporter();
>> >             importer.ComputeNormalsOn();
>> >             importer.SetFileName(fileName);
>> >             importer.Read();
>> >             importer.GetRenderer().ResetCamera();
>> >             importer.DebugOn();
>> >
>> >             //Add or Remove this section, no differents
>> >             vtkPNGReader pngReader = new vtkPNGReader();
>> >             pngReader.SetDebug(1);
>> >             pngReader.SetFileName(@"E:\VTK\3D Module\Mickey\l.png");
>> >             vtkTexture texture = new vtkTexture();
>> >             texture.SetInput(pngReader.GetOutput());
>> >             texture.InterpolateOn();
>> >             vtkActor actor = new vtkActor();
>> >             actor.SetTexture(texture);
>> >             importer.GetRenderer().AddActor(actor);
>> >
>> >             //Below is add a light, and it's okay
>> >             vtkLight light = new vtkLight();
>> >             light.SetColor(1,1 , 1);
>> >             light.SwitchOn();
>> >             light.SetIntensity(0.9);
>> >             light.SetAmbientColor(1, 1, 1);
>> >
>> light.SetPosition(importer.GetRenderer().GetActiveCamera().GetPosition());
>> >
>> light.SetFocalPoint(importer.GetRenderer().GetActiveCamera().GetFocalPoint());
>> >
>> >             importer.GetRenderer().SetBackground(0.1,0.2,0.4);
>> >             importer.GetRenderer().AddLight(light);
>> >
>> >             renderer[0] = importer.GetRenderer();
>> >             AddRendererToRenderWindow(renWin);
>> > ...
>> > Any suggestions will be appropriated.
>> >
>> > Thanks,
>> > Yun
>> > _______________________________________________
>> > 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
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100926/ea1334c8/attachment.htm>


More information about the vtkusers mailing list