posted.
David E DeMarle
Kitware, Inc.
Principal Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909
On Thu, May 31, 2018 at 8:17 AM, David E DeMarle
wrote:
> I'll remove the need for them at some point, but for 5.5 they are helpful.
> So yes discourse is a good place for safe keeping.
>
> On Wed, May 30, 2018, 8:53 PM Scott, W Alan wrote:
>
>> Dave,
>>
>> Would this be a good set of scripts to put in our brand new, squeeky
>> clean Tips and Tricks section of Discourse?
>>
>>
>>
>> https://discourse.paraview.org/
>>
>>
>>
>> Alan
>>
>>
>>
>>
>>
>>
>>
>> *From:* ParaView [mailto:paraview-boun...@public.kitware.com] *On Behalf
>> Of *David E DeMarle
>> *Sent:* Tuesday, May 22, 2018 12:10 PM
>> *To:* Jonathan Borduas
>> *Cc:* paraview@public.kitware.com
>> *Subject:* [EXTERNAL] Re: [Paraview] OSPRay textures and materials
>> mapping
>>
>>
>>
>> And here is a python schell script to make step 4 (create the
>> lookuptable) automatic.
>>
>>
>>
>> apartment = FindSource("sample_apartment.obj")
>>
>> vtklevel = apartment.GetClientSideObject()
>>
>> lut = GetColorTransferFunction('MaterialIds')
>>
>> arr = vtklevel.GetOutput().GetFieldData().GetAbstractArray(0)
>>
>> lut.InterpretValuesAsCategories = 1
>>
>> ll = []
>>
>> for x in range(0, arr.GetNumberOfTuples()):
>>
>> ll.append(str(x))
>>
>> ll.append(arr.GetValue(x))
>>
>>
>>
>>
>>
>>
>> David E DeMarle
>> Kitware, Inc.
>> Principal Engineer
>> 21 Corporate Drive
>> Clifton Park, NY 12065-8662
>> Phone: 518-881-4909
>>
>>
>>
>> On Tue, May 22, 2018 at 1:51 PM, David E DeMarle <
>> dave.dema...@kitware.com> wrote:
>>
>> On Tue, May 22, 2018 at 12:34 PM, David E DeMarle <
>> dave.dema...@kitware.com> wrote:
>>
>>
>>
>> On Tue, May 22, 2018 at 10:34 AM, Jonathan Borduas <
>> jonathan.bord...@caboma.com> wrote:
>>
>> Hi David,
>>
>> I was able to complete all the steps. As you probably know, the step four
>> was tedious.
>>
>> However I couldn’t get the result I wanted since I couldn’t assign the
>> right textures to the right areas. Is there a mechanism to assign the
>> texture just like we assign materials ?
>> I guess this is what you mean by “multi-texture isn’t implemented yet”. I
>> could probably extract all objects using a connectivity filter and then
>> manually assign the textures, but again it is a tedious process for complex
>> objects.
>>
>>
>>
>> Better to do it in the code. We read in all of the texture coordinates
>> when we read the .obj and all of the texture files when we read the .mtl ->
>> we just aren't using the right set of texture coordinates in all cases yet.
>> That is most of what I mean by multitexture.
>>
>>
>>
>> Is there a roadmap as to when the multi-texture could be implemented ?
>>
>>
>>
>> I'm hoping for 5.6 in a couple of months time. Although this is important
>> it may very well slip because of other priorities.
>>
>>
>>
>>
>>
>>
>> In the meantime, this python programmable filter is a workaround.
>>
>>
>>
>> pdi = self.GetInput()
>>
>> pdo = self.GetOutput()
>>
>> pdo.ShallowCopy(pdi)
>>
>>
>>
>> arraynames = []
>>
>> arrays = {}
>>
>> *for* a *in* range(0,pdi.GetPointData().GetNumberOfArrays()):
>>
>> array = pdi.GetPointData().GetArray(a)
>>
>> *if* array.GetNumberOfComponents() != 2:
>>
>> *continue*
>>
>> arrname = array.GetName()
>>
>> pdo.GetPointData().RemoveArray(arrname)
>>
>> arraynames.append(arrname)
>>
>> arrays[arrname] = array
>>
>>
>>
>> tcoords = vtk.vtkFloatArray()
>>
>> tcoords.SetName("TCoords")
>>
>> tcoords.SetNumberOfComponents(2)
>>
>> pdo.GetPointData().SetTCoords(tcoords)
>>
>> # todo numpy this to make it 100x faster
>>
>> *for* p *in* range(0, pdi.GetNumberOfPoints()):
>>
>> tcoord = [0,0]
>>
>> *for* arrname *in* arrays:
>>
>> candidate = arrays[arrname].GetTuple2(p)
>>
>> *if* candidate[0] == -1 *and* candidate[1] == -1:
>>
>> *continue*
>>
>> tcoord = candidate
>>
>> tcoords.InsertNextTuple2(tcoord[0],tcoord[1])
>>
>>
>>
>>
>>
>>
>>
>> It would be great to have readers that can load
>> texture/Geometry/Materials files such as .obj (.mtl and .png), .fbx and
>> .dwg.
>>
>>
>>
>> Agreed.
>>
>>
>>
>> Best regards,
>>
>>
>>
>> Jonathan Borduas
>>
>>
>>
>> *From:* David E DeMarle
>> *Sent:* Friday, May 18, 2018 10:58 AM
>> *To:* Jonathan Borduas
>> *Cc:* paraview@public.kitware.com
>> *Subject:* Re: [Paraview] OSPRay textures and materials mapping
>>
>>
>>
>> Hi Jonathan.
>>
>>
>>
>> Yes you can do that.
>>
>>
>>
>> 1) File->Load OSPRay Materials, switch the file type from "OSPRay
>> Material Files (*.json)" to "Wavefront Material FIles (*.mtl)". That will
>> let you load all of the materials and textures. They should all show up in
>> the Material list.
>>
>>
>>
>> 2) The OSPRay Material selection (on Display section of Properties Tab
>> advanced) will have all of the individual materials listed in it + a few
>> others including "Value Indexed" which is all the way at the bottom. Choose
>> that it means "use the categorical