Skip to main content
Question

Rename material and texture from Wavefront OBJ to OBJ


Forum|alt.badge.img
Hi everbody,

 

 

i just want to rename the textures associated to my OBJ files.

 

I have for example a file called AB0001.obj and four textures :

 

 

noname001.jpg,noname002.jpg,noname003.jpg,noname004.jpg

 

 

I want to rename my textures in order to have :

 

 

AB001_1.jpg, AB001_2.jpg, AB_003.jpg,AB_004.jpg

 

 

So i used "Appearance extractor" and "Appearance setter" but without success.

 

 

Thanks!

5 replies

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • July 8, 2014
Changing the filenames is no problem using file and directory path reader or FilenamePartExtractor.

 

If you got you r models and textures neatly organized you can use this and concatenate the texturename and modelname and rewrite the file(s)

 

 

I don't see in the reader and writer directive though an option to manipulate the .mtl file where the references to texture file references are.

 

You need to acces it, with csv/text reader and parse in the new filenames, probably

 

 

I didnt know fme could render these things,lol (well somewhat renderish, no lightstaging i see..)

 

 

 

http://docs.safe.com/fme/html/FME_ReadersWriters/Default.htm#obj/Supported_OBJ_File_Synta.htm%3FTocPath%3DFME%20Readers%20and%20Writers%20(formats%20supported%20by%20FME%202014)%7CWavefront%20OBJ%20Reader%2FWriter%7C_____1

Forum|alt.badge.img
I try to modify my .mtl file but its really hard to do. I try to replace the old names of textures with the fme_basename but its not so easy. on the first picture i have the corespondance between my old name and the parcel cadastral. The second picture is my mtl file when i use an attribute splitter. how can i replace in the second picture the 'noname' in 'CY003' for example ? Manage the 3d data is really hard with FME.

 

 

Thanks!

 


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • July 14, 2014
Hi,

 

 

You can use a stringsearcher on the mtl (textlinedata; expose csv_linenumber)  to get the name Put the found into a variable (VariableSetter).

 

The non-found will go to sorter (see bit further)

 

 

 

Then read it using a VariableRetriever immediatly after the Setter.

 

Merge it with the name in the mappingfile (mappingfile as supplier).

 

 

Now both original name and mapped name are linked.

 

Put merged from FeatureMerger and not found from StringSearcher into a sorter.

 

Sort on csv_linenumber.

 

 

 

Now u can use for instance a conatenator to get the attribute on csv_linenumer with the name u wanted.

 

 

 

 

Used map

 

 

 

 

I used this on the Shuttle mtl i posted before.

 

 

result

 

 

 

 

For the other lines wher u need to replace the name u need to use StringSearcher/VariableSett/VariableRetriever combo as well.

 

U can Also this combo to search the empty rows, wich marks end of  material and lighting.

 

 

 

Have fun!

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • July 14, 2014
Oh! a tip.

 

 

Do not use "fme_basename" as name of a column in the csv. I found that the csv reader then will not display this in the reader (fme2013 sp2)

 

Thats why i changed it to "basename" in my example.

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • July 14, 2014
a little oops!

 

 

In the workspace i forgot to connect the "Not Merged" to the Sorter. U must connect this of course.

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings