2

How to control texture repetition on my model. texture is applied by map_Kd texture.png in .mtl file

newmtl material_0
  Ns 10.000000
  Ni 1.500000
  d 1.000000
  Tr 0.000000
  Tf 1.000000 1.000000 1.000000
  illum 9
  stren 0.000000
  Ka 0.588000 0.588000 0.588000
  Kd 0.890196 0.847059 0.768628
  Ks 0.000000 0.000000 0.000000
  Ke 0.000000 0.000000 0.000000
  map_Kd logo.png

logo.png is a logo on dress so it display on whole dress by repeating so many time i just want it to show without repetition on whole dress. Or repet only some times I found -clamp on option to stop repetition here http://people.sc.fsu.edu/~%20jburkardt/m_src/obj_reader/help%20file%20format/MTL_format.html but not work. I used this like

map_Kd -clamp on logo.png 

but it now work. Please help me.

Deepak3301086
  • 447
  • 2
  • 23
  • Ar you calling `MTLLoader` directly, or are you calling `OBJMTLLoader`? Also, look at `MTLLoader.js`, and related source code, and see if you can isolate the issue. – WestLangley Feb 19 '14 at 16:35
  • i used THREE.OBJMTLLoader(); – Deepak3301086 Feb 21 '14 at 11:58
  • my code is loader.load( 'Pattern.obj', 'Pattern.mtl', function ( object ) {object.position.y = -35; object.wrapS = object.wrapT = THREE.ClampToEdgeWrapping; scene.add( object ); } ); – Deepak3301086 Feb 21 '14 at 12:15
  • Look at the source code. `MTLLoader` takes `options` that do what you want, but it does not appear that `OBJMTLLoader` does. Also read the parsing code so you can understand out what it does. You may have to figure out a work-around. – WestLangley Feb 21 '14 at 12:28
  • As i read MTLloader i found this: case 'map_kd': params[ 'map' ] = this.loadTexture( this.baseUrl + value );params[ 'map' ].wrapS = this.wrap;params[ 'map' ].wrapT = this.wrap; – Deepak3301086 Feb 21 '14 at 12:36
  • But not able to set proble. i need something like object.repeat.x =4 object.repeat.y =4 in loader.load() script as i user for THREE.OBJMTLLoader() – Deepak3301086 Feb 21 '14 at 12:37
  • Don't you mean `object.material.map.wrapS`? – WestLangley Feb 21 '14 at 13:14
  • i try object.material.map.repeat.set(X,Y) but show error material not defined. if remove material then show error map not defined. – Deepak3301086 Feb 24 '14 at 08:29
  • I also try clamp on | off in mtl file as map_Kd clamp on Fabric.png but it's also not working. clamp on | off is described in this link http://people.sc.fsu.edu/~%20jburkardt/m_src/obj_reader/help%20file%20format/MTL_format.html – Deepak3301086 Feb 24 '14 at 08:33
  • You have to read the source code and use a debugger to step through the program to isolate the problem. I can't do that for you... Does the loader parser support "clamp"? – WestLangley Feb 24 '14 at 14:58
  • No, if i add clamp in mtl and check file in 3D max, it also not work. So i try to find other option to do this. My image is png formate and don't know it is right format for loader or not. – Deepak3301086 Feb 25 '14 at 11:50
  • Can you provide a simple, live example (not your entire project) to demonstrate the problem? – WestLangley Feb 25 '14 at 15:20
  • As i provide you the sample but not get any answer. hope you check sample. – Deepak3301086 Mar 04 '14 at 11:06
  • Where is your live example? – WestLangley Mar 04 '14 at 14:56
  • As you not reply anything so i removed it. – Deepak3301086 Mar 10 '14 at 06:55

1 Answers1

2

map_Kd -s 1 1 1 logo.png

But it not work if import To blender

Texture map statements:

    map_Ka -s 1 1 1 -o 0 0 0 -mm 0 1 chrome.mpc
    map_Kd -s 1 1 1 -o 0 0 0 -mm 0 1 chrome.mpc
    map_Ks -s 1 1 1 -o 0 0 0 -mm 0 1 chrome.mpc
    map_Ns -s 1 1 1 -o 0 0 0 -mm 0 1 wisp.mps
    map_d -s 1 1 1 -o 0 0 0 -mm 0 1 wisp.mps
    disp -s 1 1 .5 wisp.mps
    decal -s 1 1 1 -o 0 0 0 -mm 0 1 sand.mps
    bump -s 1 1 1 -o 0 0 0 -bm 1 sand.mpb

-s u v w

The -s option scales the size of the texture pattern on the textured surface by expanding or shrinking the pattern. The default is 1, 1, 1.

"u" is the value for the horizontal direction of the texture

"v" is an optional argument. "v" is the value for the vertical direction of the texture.

"w" is an optional argument. "w" is a value used for the depth of a 3D texture. "w" is a value used for the amount of tessellation of the displacement map.

http://paulbourke.net/dataformats/mtl/

Alex
  • 21
  • 3