STL 3D Model exported into OBJ file

Finally got it to work. Have to use P3D renderer. The following gives a yellow rotating mobius (needs more work):

PShape mobius;

float ry;
void setup() {
  size(400, 400, P3D);
  background(209);
  mobius = loadShape("mobius.obj");
  mobius.setFill(color(255, 255, 0));
  ry = 0.85;
}

void draw() {
  background(209);
  translate(width/2, height/2, 100);
  rotateZ(PI);
  rotateY(ry);
  scale(4.0);
  shape(mobius);
   ry += 0.02;
}

Blender is an impressive app. The good news is that it will convert from .stl to .obj without having to use an online converter. It also includes an accompanying .mtl file automatically.

1 Like

@glv @svan now it’s working!!

How did you get the setTexture to work in processing.js? @glv

My 3d model is now loading and visible with setFill, but the setTexture is not working.

“txt cannot be resolved to a variable”

mobius.setTexture(txt);

Works fine with Processing 4.1.1:

Be careful with names… I used txt and you had txtr in your examples.
It may be as simple as that… scrutinize your code.

moebius.obj data to copy to moebius.obj file :

Click to Open!
# Blender 3.3.2
# www.blender.org
o moebius
v 0.121339 -10.000000 -4.125570
v 0.121337 -10.000000 -24.125566
v 7.972092 -9.224739 -23.661596
v 2.093474 -10.719337 -4.603580
v 15.496721 -8.397884 -20.761618
v 4.356159 -11.378731 -4.421417
v 21.926605 -7.524071 -15.599192
v 6.682018 -11.974487 -3.442043
v 26.575626 -6.608175 -8.592623
v 8.785276 -12.503277 -1.610420
v 28.918232 -5.655327 -0.368103
v 10.352818 -12.962145 1.023182
v 28.651646 -4.670853 8.301783
v 11.084055 -13.348526 4.292091
v 25.734690 -3.660254 16.577797
v 10.734687 -13.660255 7.917543
v 20.398024 -2.629189 23.642994
v 9.158323 -13.895586 11.529477
v 13.124269 -1.583416 28.790798
v 6.339796 -14.053210 14.702682
v 4.599720 -0.528791 31.502056
v 2.414607 -14.132242 17.004772
v -4.357051 0.528792 31.502052
v -2.329559 -14.132242 18.050541
v -12.881602 1.583417 28.790791
v -7.471152 -14.053210 17.555897
v -20.155350 2.629187 23.642990
v -12.492250 -13.895586 15.384133
v -25.492012 3.660255 16.577795
v -16.831753 -13.660252 11.577803
v -28.408968 4.670853 8.301777
v -19.948864 -13.348522 6.370812
v -28.675550 5.655329 -0.368107
v -21.389164 -12.962145 0.177942
v -26.332949 6.608181 -8.592623
v -20.845352 -12.503277 -6.438898
v -21.683922 7.524071 -15.599199
v -18.204453 -11.974485 -12.824396
v -15.254039 8.397884 -20.761621
v -13.574874 -11.378727 -18.298731
v -7.729407 9.224739 -23.661596
v -7.288873 -10.719334 -22.233397
v 1.652933 9.224735 -3.175381
v 2.676990 8.397884 -1.958527
v 3.202543 7.524071 -0.667253
v 3.297681 6.608175 0.543303
v 3.066430 5.655327 1.569221
v 2.623951 4.670853 2.361130
v 2.074435 3.660256 2.917545
v 1.495226 2.629189 3.270622
v 0.929354 1.583416 3.467785
v 0.387119 0.528791 3.553259
v -0.144441 -0.528791 3.553259
v -0.686675 -1.583415 3.467785
v -1.252547 -2.629185 3.270622
v -1.831757 -3.660253 2.917546
v -2.381272 -4.670849 2.361130
v -2.823751 -5.655325 1.569221
v -3.055002 -6.608175 0.543303
v -2.959865 -7.524067 -0.667252
v -2.434311 -8.397881 -1.958527
v -1.410256 -9.224735 -3.175379
v 7.531552 10.719337 -22.233397
v 13.817552 11.378727 -18.298731
v 18.447126 11.974487 -12.824408
v 21.088034 12.503279 -6.438896
v 21.631844 12.962146 0.177937
v 20.191544 13.348524 6.370812
v 17.074438 13.660254 11.577799
v 12.734927 13.895587 15.384137
v 7.713834 14.053212 17.555897
v 2.572231 14.132246 18.050541
v -2.171933 14.132246 17.004772
v -6.097115 14.053212 14.702682
v -8.915648 13.895590 11.529477
v -10.492011 13.660255 7.917549
v -10.841378 13.348526 4.292092
v -10.110140 12.962147 1.023184
v -8.542599 12.503281 -1.610420
v -6.439343 11.974491 -3.442041
v -4.113481 11.378731 -4.421417
v -1.850796 10.719341 -4.603580
v 0.121337 10.000000 -24.125566
v 0.121340 10.000000 -4.125570
vn 0.0983 -0.9952 -0.0000
vn -0.3763 -0.9074 -0.1872
vn 0.1242 -0.9915 -0.0395
vn -0.2395 -0.9131 -0.3299
vn 0.1792 -0.9822 -0.0570
vn -0.0608 -0.9103 -0.4094
vn 0.2506 -0.9673 -0.0398
vn 0.1352 -0.8997 -0.4150
vn 0.3210 -0.9469 0.0183
vn 0.3213 -0.8820 -0.3449
vn 0.3713 -0.9212 0.1160
vn 0.4708 -0.8577 -0.2067
vn 0.3841 -0.8904 0.2441
vn 0.5614 -0.8274 -0.0170
vn 0.3466 -0.8547 0.3865
vn 0.5774 -0.7915 0.2004
vn 0.2528 -0.8142 0.5227
vn 0.5122 -0.7505 0.4176
vn 0.1053 -0.7693 0.6302
vn 0.3694 -0.7048 0.6057
vn -0.0850 -0.7202 0.6886
vn 0.1627 -0.6547 0.7381
vn -0.2995 -0.6672 0.6820
vn -0.0857 -0.6007 0.7948
vn -0.5141 -0.6107 0.6023
vn -0.3476 -0.5432 0.7643
vn -0.7026 -0.5509 0.4503
vn -0.5922 -0.4824 0.6454
vn -0.8400 -0.4883 0.2365
vn -0.7899 -0.4189 0.4478
vn -0.9058 -0.4231 -0.0202
vn -0.9160 -0.3529 0.1910
vn -0.8871 -0.3558 -0.2939
vn -0.9535 -0.2849 -0.0981
vn -0.7806 -0.2867 -0.5554
vn -0.8960 -0.2152 -0.3884
vn -0.5932 -0.2162 -0.7755
vn -0.7478 -0.1442 -0.6481
vn -0.3420 -0.1447 -0.9285
vn -0.5237 -0.0724 -0.8488
vn -0.1012 -0.0733 0.9922
vn -0.8025 -0.1404 0.5800
vn -0.4156 -0.1471 0.8976
vn -0.9472 -0.2042 0.2473
vn -0.6715 -0.2205 0.7074
vn -0.9575 -0.2612 -0.1223
vn -0.8432 -0.2929 0.4508
vn -0.8251 -0.3090 -0.4730
vn -0.9173 -0.3638 0.1622
vn -0.5670 -0.3463 -0.7474
vn -0.8931 -0.4325 -0.1233
vn -0.2258 -0.3727 -0.9000
vn -0.7819 -0.4989 -0.3738
vn 0.1396 -0.3901 -0.9101
vn -0.6042 -0.5623 -0.5646
vn 0.4695 -0.4022 -0.7860
vn -0.3865 -0.6226 -0.6804
vn 0.7176 -0.4143 -0.5598
vn -0.1580 -0.6793 -0.7166
vn 0.8589 -0.4317 -0.2756
vn 0.0541 -0.7322 -0.6789
vn 0.8884 -0.4585 0.0220
vn 0.2271 -0.7809 -0.5818
vn 0.8160 -0.4971 0.2948
vn 0.3465 -0.8252 -0.4460
vn 0.6611 -0.5472 0.5133
vn 0.4063 -0.8648 -0.2950
vn 0.4491 -0.6058 0.6567
vn 0.4098 -0.8995 -0.1514
vn 0.2095 -0.6683 0.7138
vn 0.3682 -0.9291 -0.0342
vn -0.0265 -0.7295 0.6835
vn 0.2985 -0.9534 0.0445
vn -0.2300 -0.7847 0.5756
vn 0.2199 -0.9722 0.0802
vn -0.3773 -0.8310 0.4088
vn 0.1513 -0.9855 0.0766
vn -0.4531 -0.8669 0.2078
vn 0.4531 0.8669 0.2078
vn -0.1513 0.9855 0.0766
vn 0.3773 0.8310 0.4088
vn -0.2199 0.9722 0.0802
vn 0.2300 0.7847 0.5756
vn -0.2985 0.9534 0.0445
vn 0.0265 0.7295 0.6835
vn -0.3682 0.9291 -0.0342
vn -0.2095 0.6683 0.7138
vn -0.4098 0.8995 -0.1514
vn -0.4491 0.6058 0.6567
vn -0.4063 0.8648 -0.2950
vn -0.6611 0.5472 0.5133
vn -0.3465 0.8252 -0.4460
vn -0.8160 0.4971 0.2948
vn -0.2271 0.7809 -0.5818
vn -0.8884 0.4585 0.0220
vn -0.0541 0.7322 -0.6789
vn -0.8589 0.4317 -0.2756
vn 0.1580 0.6793 -0.7166
vn -0.7176 0.4143 -0.5598
vn 0.3865 0.6226 -0.6804
vn -0.4695 0.4022 -0.7860
vn 0.6042 0.5623 -0.5646
vn -0.1396 0.3901 -0.9101
vn 0.7819 0.4989 -0.3738
vn 0.2258 0.3727 -0.9000
vn 0.8931 0.4325 -0.1233
vn 0.5670 0.3463 -0.7474
vn 0.9173 0.3638 0.1622
vn 0.8251 0.3090 -0.4730
vn 0.8432 0.2929 0.4508
vn 0.9575 0.2612 -0.1223
vn 0.6715 0.2205 0.7074
vn 0.9472 0.2042 0.2473
vn 0.4156 0.1471 0.8976
vn 0.8025 0.1404 0.5800
vn 0.1012 0.0733 0.9922
vn 0.2474 -0.0000 -0.9689
vn 0.0517 0.0725 -0.9960
vn 0.5237 0.0724 -0.8488
vn 0.3420 0.1447 -0.9285
vn 0.7478 0.1442 -0.6481
vn 0.5932 0.2162 -0.7755
vn 0.8960 0.2152 -0.3884
vn 0.7806 0.2867 -0.5554
vn 0.9535 0.2849 -0.0981
vn 0.8871 0.3558 -0.2939
vn 0.9160 0.3529 0.1910
vn 0.9058 0.4231 -0.0202
vn 0.7899 0.4189 0.4478
vn 0.8400 0.4883 0.2365
vn 0.5922 0.4824 0.6454
vn 0.7026 0.5509 0.4503
vn 0.3476 0.5432 0.7643
vn 0.5141 0.6107 0.6023
vn 0.0857 0.6007 0.7948
vn 0.2995 0.6672 0.6820
vn -0.1627 0.6547 0.7381
vn 0.0850 0.7202 0.6886
vn -0.3694 0.7048 0.6057
vn -0.1053 0.7693 0.6302
vn -0.5122 0.7505 0.4176
vn -0.2528 0.8142 0.5227
vn -0.5774 0.7915 0.2004
vn -0.3466 0.8547 0.3865
vn -0.5614 0.8274 -0.0170
vn -0.3841 0.8904 0.2441
vn -0.4708 0.8577 -0.2067
vn -0.3713 0.9212 0.1160
vn -0.3213 0.8820 -0.3449
vn -0.3210 0.9469 0.0183
vn -0.1352 0.8997 -0.4150
vn -0.2506 0.9673 -0.0398
vn 0.0608 0.9103 -0.4094
vn -0.1792 0.9822 -0.0570
vn 0.2395 0.9131 -0.3299
vn -0.1242 0.9915 -0.0395
vn 0.3763 0.9074 -0.1872
vn -0.0983 0.9952 -0.0000
vn 0.5518 0.0717 0.8309
vn -0.2356 -0.0000 0.9719
vn -0.4516 -0.8922 -0.0000
vn 0.1078 -0.9932 0.0446
vn -0.2474 -0.0000 -0.9689
vn -0.0517 -0.0725 -0.9960
vn 0.2356 -0.0000 0.9719
vn -0.5518 -0.0717 0.8309
vn 0.4516 0.8922 -0.0000
vn -0.1078 0.9932 0.0446
vt 0.500000 0.602711
vt 0.500000 0.326370
vt 0.500000 0.949970
vt 0.500000 0.326370
vt 0.636312 0.941914
vt 0.636312 0.339831
vt 0.534242 0.611010
vt 0.534242 0.313880
vt 0.766963 0.891562
vt 0.891562 0.354188
vt 0.766963 0.354188
vt 0.573529 0.607847
vt 0.607847 0.302431
vt 0.573529 0.302431
vt 0.878605 0.801927
vt 0.878605 0.369360
vt 0.801927 0.369360
vt 0.613913 0.590842
vt 0.590842 0.292087
vt 0.613913 0.292087
vt 0.959325 0.680272
vt 0.680272 0.385262
vt 0.650432 0.559040
vt 0.650432 0.282906
vt 0.559040 0.282906
vt 1.000000 0.537470
vt 0.537470 0.401807
vt 0.677649 0.513313
vt 0.513313 0.274938
vt 0.995371 0.386935
vt 0.386935 0.418900
vt 0.690346 0.456555
vt 0.690346 0.268230
vt 0.456555 0.268230
vt 0.944724 0.243238
vt 0.944724 0.436447
vt 0.243238 0.436447
vt 0.684279 0.393606
vt 0.684279 0.262817
vt 0.393606 0.262817
vt 0.120565 0.454349
vt 0.852064 0.454349
vt 0.852064 0.120565
vt 0.656909 0.330892
vt 0.656909 0.258731
vt 0.330892 0.258731
vt 0.725770 0.031184
vt 0.725770 0.472507
vt 0.607971 0.275796
vt 0.275796 0.255994
vt 0.607971 0.255994
vt 0.577758 0.490819
vt 0.577758 -0.015891
vt 0.539818 0.235825
vt 0.235825 0.254622
vt 0.539818 0.254622
vt 0.422242 0.509181
vt 0.422242 -0.015891
vt 0.457445 0.254622
vt 0.217667 0.254622
vt 0.457445 0.217667
vt 0.274230 0.527493
vt 0.274230 0.031184
vt 0.368172 0.255994
vt 0.226256 0.255994
vt 0.368172 0.226256
vt 0.147936 0.545651
vt 0.120565 0.545651
vt 0.147936 0.120565
vt 0.280990 0.258731
vt 0.263964 0.258731
vt 0.280990 0.263964
vt 0.055276 0.563553
vt 0.243238 0.563553
vt 0.055276 0.243238
vt 0.205644 0.262817
vt 0.330053 0.262817
vt 0.205644 0.330053
vt 0.386935 0.581100
vt 0.004629 0.386935
vt 0.420462 0.268230
vt 0.151521 0.268230
vt 0.151521 0.420462
vt 0.537470 0.598193
vt 0.000000 0.537470
vt 0.527989 0.274938
vt 0.126513 0.274938
vt 0.126513 0.527989
vt 0.680272 0.614738
vt 0.040675 0.680272
vt 0.642877 0.282906
vt 0.135956 0.642877
vt 0.801927 0.630640
vt 0.121396 0.630640
vt 0.121396 0.801927
vt 0.181810 0.292087
vt 0.753748 0.292087
vt 0.181810 0.753748
vt 0.891562 0.645812
vt 0.233038 0.645812
vt 0.233038 0.891562
vt 0.848799 0.302431
vt 0.262193 0.302431
vt 0.262193 0.848799
vt 0.363688 0.941914
vt 0.363688 0.660169
vt 0.371337 0.917117
vt 0.371337 0.313880
vt 0.586212 0.660169
vt 0.526593 0.660169
vt 0.526593 0.586212
vt 0.544374 0.645812
vt 0.565084 0.645812
vt 0.544374 0.565084
vt 0.553499 0.630640
vt 0.542664 0.630640
vt 0.553499 0.542664
vt 0.521645 0.614738
vt 0.555151 0.521645
vt 0.503832 0.598193
vt 0.551136 0.503832
vt 0.551136 0.598193
vt 0.490082 0.581100
vt 0.543453 0.490082
vt 0.543453 0.581100
vt 0.533912 0.563553
vt 0.533912 0.480421
vt 0.480421 0.563553
vt 0.523855 0.545651
vt 0.523855 0.474291
vt 0.474291 0.545651
vt 0.514030 0.527493
vt 0.514030 0.470867
vt 0.470867 0.527493
vt 0.504615 0.509181
vt 0.504615 0.469383
vt 0.469383 0.509181
vt 0.495385 0.469383
vt 0.495385 0.490819
vt 0.469383 0.490819
vt 0.485970 0.470867
vt 0.470867 0.472507
vt 0.485970 0.472507
vt 0.476145 0.474291
vt 0.474291 0.454349
vt 0.476145 0.454349
vt 0.466088 0.480421
vt 0.480421 0.436447
vt 0.466088 0.436447
vt 0.456547 0.490082
vt 0.490082 0.418900
vt 0.456547 0.418900
vt 0.448864 0.503832
vt 0.448864 0.401807
vt 0.503832 0.401807
vt 0.444849 0.521645
vt 0.521645 0.385262
vt 0.446501 0.542664
vt 0.446501 0.369360
vt 0.542664 0.369360
vt 0.455626 0.565084
vt 0.455626 0.354188
vt 0.565084 0.354188
vt 0.586212 0.339831
vt 0.473407 0.339831
vt 0.473407 0.586212
vt 0.628663 0.686120
vt 0.628663 0.917117
vt 0.737807 0.848799
vt 0.737807 0.697569
vt 0.848799 0.697569
vt 0.818190 0.753748
vt 0.818190 0.707913
vt 0.753748 0.707913
vt 0.864044 0.642877
vt 0.642877 0.717094
vt 0.873487 0.725062
vt 0.873487 0.527989
vt 0.527989 0.725062
vt 0.848479 0.731770
vt 0.848479 0.420462
vt 0.420462 0.731770
vt 0.794356 0.330053
vt 0.330053 0.737183
vt 0.794356 0.737183
vt 0.719010 0.263964
vt 0.263964 0.741269
vt 0.719010 0.741269
vt 0.226256 0.744006
vt 0.631828 0.226256
vt 0.631828 0.744006
vt 0.542555 0.217667
vt 0.217667 0.745378
vt 0.542555 0.745378
vt 0.235825 0.745378
vt 0.460182 0.745378
vt 0.460182 0.235825
vt 0.392029 0.744006
vt 0.275796 0.744006
vt 0.392029 0.275796
vt 0.343091 0.741269
vt 0.330892 0.741269
vt 0.343091 0.330892
vt 0.315721 0.737183
vt 0.393606 0.737183
vt 0.315721 0.393606
vt 0.309655 0.731770
vt 0.456555 0.731770
vt 0.309655 0.456555
vt 0.513313 0.725062
vt 0.322351 0.513313
vt 0.559040 0.717094
vt 0.349568 0.717094
vt 0.349568 0.559040
vt 0.590842 0.707913
vt 0.386087 0.707913
vt 0.386087 0.590842
vt 0.607847 0.697569
vt 0.426471 0.697569
vt 0.426471 0.607847
vt 0.465758 0.611010
vt 0.465758 0.686120
vt 0.500000 0.673630
vt 0.500000 0.949970
vt 0.500000 0.673630
vt 0.500000 0.602711
s 0
f 1/1/1 2/3/1 3/5/1
f 3/5/2 4/7/2 1/1/2
f 4/7/3 3/5/3 5/9/3
f 5/9/4 6/12/4 4/7/4
f 6/12/5 5/9/5 7/15/5
f 7/15/6 8/18/6 6/12/6
f 8/18/7 7/15/7 9/21/7
f 9/21/8 10/23/8 8/18/8
f 10/23/9 9/21/9 11/26/9
f 11/26/10 12/28/10 10/23/10
f 12/28/11 11/26/11 13/30/11
f 13/30/12 14/32/12 12/28/12
f 14/32/13 13/30/13 15/35/13
f 15/35/14 16/38/14 14/32/14
f 16/38/15 15/35/15 17/43/15
f 17/43/16 18/44/16 16/38/16
f 18/44/17 17/43/17 19/47/17
f 19/47/18 20/49/18 18/44/18
f 20/49/19 19/47/19 21/53/19
f 21/53/20 22/54/20 20/49/20
f 22/54/21 21/53/21 23/58/21
f 23/57/22 24/59/22 22/56/22
f 24/59/23 23/57/23 25/62/23
f 25/62/24 26/64/24 24/59/24
f 26/66/25 25/63/25 27/69/25
f 27/67/26 28/70/26 26/64/26
f 28/71/27 27/68/27 29/74/27
f 29/73/28 30/76/28 28/70/28
f 30/77/29 29/74/29 31/79/29
f 31/79/30 32/81/30 30/77/30
f 32/81/31 31/79/31 33/84/31
f 33/84/32 34/86/32 32/81/32
f 34/86/33 33/84/33 35/89/33
f 35/89/34 36/91/34 34/86/34
f 36/91/35 35/89/35 37/93/35
f 37/93/36 38/97/36 36/91/36
f 38/96/37 37/94/37 39/100/37
f 39/99/38 40/102/38 38/97/38
f 40/103/39 39/100/39 41/106/39
f 41/106/40 42/108/40 40/103/40
f 43/110/41 4/8/41 6/14/41
f 6/13/42 44/113/42 43/109/42
f 44/112/43 6/14/43 8/20/43
f 8/19/44 45/116/44 44/113/44
f 45/115/45 8/20/45 10/24/45
f 10/25/46 46/118/46 45/116/46
f 46/118/47 10/25/47 12/29/47
f 12/29/48 47/120/48 46/118/48
f 47/120/49 12/29/49 14/34/49
f 14/33/50 48/125/50 47/122/50
f 48/123/51 14/34/51 16/40/51
f 16/39/52 49/126/52 48/125/52
f 49/128/53 16/40/53 18/46/53
f 18/45/54 50/129/54 49/126/54
f 50/131/55 18/46/55 20/50/55
f 20/51/56 51/132/56 50/129/56
f 51/132/57 20/51/57 22/56/57
f 22/55/58 52/137/58 51/134/58
f 52/135/59 22/56/59 24/59/59
f 24/60/60 53/140/60 52/137/60
f 53/138/61 24/61/61 26/66/61
f 26/65/62 54/142/62 53/140/62
f 54/141/63 26/66/63 28/72/63
f 28/71/64 55/145/64 54/142/64
f 55/144/65 28/72/65 30/78/65
f 30/77/66 56/148/66 55/145/66
f 56/147/67 30/78/67 32/83/67
f 32/82/68 57/152/68 56/149/68
f 57/150/69 32/83/69 34/88/69
f 34/87/70 58/154/70 57/152/70
f 58/153/71 34/88/71 36/92/71
f 36/92/72 59/156/72 58/153/72
f 59/156/73 36/92/73 38/98/73
f 38/98/74 60/158/74 59/156/74
f 60/158/75 38/98/75 40/104/75
f 40/104/76 61/161/76 60/158/76
f 61/161/77 40/104/77 42/107/77
f 42/107/78 62/166/78 61/161/78
f 63/168/79 43/111/79 44/114/79
f 44/114/80 64/169/80 63/168/80
f 64/169/81 44/114/81 45/117/81
f 45/117/82 65/172/82 64/169/82
f 65/172/83 45/117/83 46/119/83
f 46/119/84 66/175/84 65/172/84
f 66/175/85 46/119/85 47/121/85
f 47/121/86 67/178/86 66/175/86
f 67/177/87 47/122/87 48/125/87
f 48/124/88 68/181/88 67/178/88
f 68/180/89 48/125/89 49/126/89
f 49/127/90 69/183/90 68/181/90
f 69/184/91 49/128/91 50/131/91
f 50/130/92 70/186/92 69/183/92
f 70/187/93 50/131/93 51/134/93
f 51/133/94 71/190/94 70/186/94
f 71/189/95 51/134/95 52/137/95
f 52/136/96 72/192/96 71/190/96
f 72/193/97 52/137/97 53/140/97
f 53/139/98 73/196/98 72/194/98
f 73/195/99 53/140/99 54/142/99
f 54/143/100 74/198/100 73/196/100
f 74/198/101 54/143/101 55/146/101
f 55/145/102 75/202/102 74/199/102
f 75/201/103 55/146/103 56/149/103
f 56/148/104 76/205/104 75/202/104
f 76/204/105 56/149/105 57/152/105
f 57/151/106 77/208/106 76/205/106
f 77/207/107 57/152/107 58/154/107
f 58/155/108 78/210/108 77/208/108
f 78/210/109 58/155/109 59/157/109
f 59/157/110 79/212/110 78/210/110
f 79/212/111 59/157/111 60/160/111
f 60/159/112 80/216/112 79/213/112
f 80/215/113 60/160/113 61/163/113
f 61/162/114 81/219/114 80/216/114
f 81/218/115 61/163/115 62/164/115
f 62/165/116 82/222/116 81/219/116
f 2/4/117 83/223/117 63/167/117
f 63/167/118 3/6/118 2/4/118
f 3/6/119 63/167/119 64/170/119
f 64/170/120 5/11/120 3/6/120
f 5/10/121 64/171/121 65/174/121
f 65/173/122 7/16/122 5/11/122
f 7/17/123 65/174/123 66/176/123
f 66/176/124 9/22/124 7/17/124
f 9/22/125 66/176/125 67/179/125
f 67/179/126 11/27/126 9/22/126
f 11/27/127 67/179/127 68/182/127
f 68/182/128 13/31/128 11/27/128
f 13/31/129 68/182/129 69/184/129
f 69/184/130 15/37/130 13/31/130
f 15/36/131 69/185/131 70/188/131
f 70/187/132 17/41/132 15/37/132
f 17/42/133 70/188/133 71/191/133
f 71/190/134 19/47/134 17/43/134
f 19/48/135 71/191/135 72/194/135
f 72/194/136 21/52/136 19/48/136
f 21/52/137 72/194/137 73/196/137
f 73/197/138 23/58/138 21/53/138
f 23/58/139 73/197/139 74/200/139
f 74/200/140 25/63/140 23/58/140
f 25/63/141 74/200/141 75/203/141
f 75/203/142 27/69/142 25/63/142
f 27/69/143 75/203/143 76/206/143
f 76/206/144 29/75/144 27/69/144
f 29/75/145 76/206/145 77/209/145
f 77/209/146 31/80/146 29/75/146
f 31/80/147 77/209/147 78/211/147
f 78/211/148 33/85/148 31/80/148
f 33/85/149 78/211/149 79/214/149
f 79/214/150 35/90/150 33/85/150
f 35/90/151 79/214/151 80/217/151
f 80/217/152 37/95/152 35/90/152
f 37/95/153 80/217/153 81/220/153
f 81/220/154 39/101/154 37/95/154
f 39/101/155 81/220/155 82/221/155
f 82/221/156 41/105/156 39/101/156
f 41/105/157 82/221/157 84/226/157
f 84/226/158 83/224/158 41/105/158
f 82/222/159 62/165/159 1/2/159
f 1/2/160 84/225/160 82/222/160
f 2/3/161 1/1/161 62/166/161
f 62/166/162 42/107/162 2/3/162
f 83/223/163 2/4/163 42/108/163
f 42/108/164 41/106/164 83/223/164
f 84/225/165 1/2/165 4/8/165
f 4/8/166 43/110/166 84/225/166
f 83/224/167 84/226/167 43/111/167
f 43/111/168 63/168/168 83/224/168

Working code:

PShape mobius;
PImage txtr;

void setup()
  {  
  size(500, 500, P3D);
  txtr = loadImage("http://learningprocessing.com/code/assets/sunflower.jpg");
  mobius = loadShape("moebius.obj");
  mobius.setFill(color(255)); // Brigthens the texture
  mobius.setTexture(txtr);
  }

void draw() 
  {
  background(255);
  translate(width/2, height/2);
  lights();
  
  rotateY(mouseX*TAU/width);
  rotateX(mouseY*TAU/height);

  scale(6);
  shape(mobius);
  }

And voila!

:)

1 Like

@glv

When using the following code, my 3d model turns back to black even when using Processing 4.1.1

mobius.setTexture(txtr);
PShape mobius;
PImage txtr;
float theta;

void setup(){
  size(1000,1000,P3D);
  txtr = loadImage("grid3.jpg");
  mobius = loadShape("ring2obj.obj");
  mobius.setTexture(txtr);
}

void draw() {
  background(txtr);
  
  pushMatrix();
  translate(width/2, height/2);
  shininess(5.0); 
  lights();
  rotateY(mouseY);
  rotateX(mouseX);
  //rotateZ(theta/2);
  scale(90);
  shape(mobius);
  popMatrix();
  
  theta+=.01;
  
}


I added the data in my moebius.obj file in my previous post.

Which one did you use? I tried a few until I got acceptable results.

Be careful when exporting with Blender and copying the files to the Processing sketch… I made a few errors in the beginning and very methodical now about this.

:)

@glv oh I see! I’m not sure what to select after selecting UV> Cube Projection?

Are there further options before exporting?

I’ve been selecting UV> Cube Projection then exporting and nothing else.

When I use the same code as you… I get the following results. setTexture still is not working?

So that we are comparing the same thing…

Try it with the moebius.stl here:

Use this image:

txtr = loadImage("http://learningprocessing.com/code/assets/sunflower.jpg");

I also updated a previous topic to include code and the moebius.obj file that works for me.

Pay attention to the geometry selections when exporting.

There is a learning curve to all of this and I went through it… I did a lot of research to understand all of this and some mistakes along the way.

Have fun!

:)

Hi @glv! When I use the same 3d model and code as you, the setTexture is still not applying an image?

After selecting “UV > Cube Projection” do I need to select anymore options?

When exporting to an .OBJ file I have the same geometry selected as you.

Hello,

The fact that it is green means something is being textured from the image!

These are the notes I have in my code:

// Blender import:
//
// Delete cube and other stuff
// import Stl(.stl)
// Edit mode
// Cube projection
// Export Wavefront (.obj) with Geometry:
//  UV coordinates
//  Normals
//
// Make sure you are exporting it to a know location!
// Easy to mix up the exported files.

There are experimental and legacy options… do not use these!

I am not a Blender expert and much of this was research to understand what was going on, persistence, perseverance and trial and error.

All that to get a visible texture on a shape in Processing!

That is just the tip of the iceberg when it comes to mapping textures in Blender or in Processing.

https://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/UV_Map_Basics

:)

1 Like

You don’t have to do all that. All you really need is an .obj, .mtl, and graphic file (.jpg or .png) and a little Processing code as shown in Files/Examples/Basics/Shape/LoadDisplayOBJ:

PShape rocket;

float ry;
  
public void setup() {
  size(640, 360, P3D);    
  rocket = loadShape("rocket.obj");
}

public void draw() {
  background(0);
  lights();  
  translate(width/2, height/2 + 100, -200);
  rotateZ(PI);
  rotateY(ry);
  shape(rocket);
  
  ry += 0.02;
}

data folder:
data

output:

The original poster was importing an STL to Blender and exporting an OBJ and attempting to texture it with Processing.

I was assisting with that pursuit.

There is a nice definition of an STL file here:

This format describes only the surface geometry of a three-dimensional object without representing color, texture, or other common model attributes.

The challenge presented was to start with an STL, export to an OBJ and texture it.

It can be textured in Blender and exported or textured in Processing.

Only an STL file in this:

:)

Hi

My point was you don’t have to do all that with Blender; it’s an impressive app but it’s complicated. STL files can be converted to an .obj file with an online converter. The difficult part is getting the .mtl file. There are online repositories of .obj files and ideally the .mtl file comes with it. Otherwise I have re-purposed an .mtl file of one of Processing’s examples with limited success; not an ideal way to do it. In my opinion the reason the poster has had so much trouble is because the .mtl file was created in Blender and did not take into account the special images that were attempted to be added later. The .mtl file sets the texture normally. eg In the Processing example that I posted here is the .mtl

newmtl Default
illum 2
Ka 0.698039 0.698039 0.698039
Kd 0.698039 0.698039 0.698039
Ks 0.710000 0.710000 0.710000
Ns 76.109253
map_Kd rocket.png

Note that the last line sets the graphic file to be used.

Hello @asymmetric,

Thanks for this topic! I am having some fun with Blender! :)

For clarity…

I have not been texturing in Blender with an image and not exporting OBJ with materials (MTL file along with an image).

I have been:

  • Importing an STL.
  • Exporting an OBJ without an MTL file (materials not selected in Geometry) when exporting.
  • Texturing in Processing to the UV selected in Blender for the OBJ file. There is a whole menu of choices there!

I managed to “hide” one side of the moebius against the background like a chameleon:

When moved:

Blender UV Project from View (bounds) instead of Cube Projection used:

There are a lot of tutorials but I found this the most helpful for me at 0.75 speed:

I am still new at using Blender but a quick study and there is a steep learning curve; I am familiar with similar tools so it was not so bad.

I just wanted to share the possibilities!

Have fun!

Here is the output.obj file contents from example above:

Click here to expand!
# Blender 3.3.2
# www.blender.org
o moebius
v 0.092979 -10.000000 -6.497766
v 0.092977 -10.000000 -26.497763
v 7.943732 -9.224739 -26.033792
v 2.065114 -10.719337 -6.975777
v 15.468362 -8.397884 -23.133814
v 4.327799 -11.378731 -6.793613
v 21.898245 -7.524071 -17.971388
v 6.653658 -11.974487 -5.814240
v 26.547266 -6.608175 -10.964819
v 8.756917 -12.503277 -3.982616
v 28.889872 -5.655327 -2.740299
v 10.324458 -12.962145 -1.349014
v 28.623285 -4.670853 5.929586
v 11.055696 -13.348526 1.919895
v 25.706329 -3.660254 14.205602
v 10.706327 -13.660255 5.545347
v 20.369663 -2.629189 21.270798
v 9.129964 -13.895586 9.157281
v 13.095910 -1.583416 26.418602
v 6.311436 -14.053210 12.330485
v 4.571361 -0.528791 29.129860
v 2.386247 -14.132242 14.632577
v -4.385411 0.528792 29.129856
v -2.357919 -14.132242 15.678346
v -12.909962 1.583417 26.418594
v -7.499512 -14.053210 15.183702
v -20.183710 2.629187 21.270794
v -12.520610 -13.895586 13.011937
v -25.520372 3.660255 14.205599
v -16.860113 -13.660252 9.205606
v -28.437328 4.670853 5.929581
v -19.977224 -13.348522 3.998616
v -28.703911 5.655329 -2.740303
v -21.417524 -12.962145 -2.194254
v -26.361309 6.608181 -10.964819
v -20.873713 -12.503277 -8.811094
v -21.712282 7.524071 -17.971395
v -18.232813 -11.974485 -15.196592
v -15.282398 8.397884 -23.133818
v -13.603233 -11.378727 -20.670927
v -7.757767 9.224739 -26.033792
v -7.317233 -10.719334 -24.605593
v 1.624573 9.224735 -5.547577
v 2.648630 8.397884 -4.330723
v 3.174183 7.524071 -3.039450
v 3.269322 6.608175 -1.828894
v 3.038070 5.655327 -0.802975
v 2.595591 4.670853 -0.011066
v 2.046075 3.660256 0.545349
v 1.466866 2.629189 0.898426
v 0.900994 1.583416 1.095589
v 0.358759 0.528791 1.181063
v -0.172801 -0.528791 1.181063
v -0.715035 -1.583415 1.095589
v -1.280907 -2.629185 0.898426
v -1.860117 -3.660253 0.545350
v -2.409632 -4.670849 -0.011066
v -2.852111 -5.655325 -0.802975
v -3.083362 -6.608175 -1.828894
v -2.988225 -7.524067 -3.039448
v -2.462671 -8.397881 -4.330723
v -1.438616 -9.224735 -5.547575
v 7.503192 10.719337 -24.605593
v 13.789192 11.378727 -20.670927
v 18.418766 11.974487 -15.196604
v 21.059673 12.503279 -8.811092
v 21.603483 12.962146 -2.194260
v 20.163183 13.348524 3.998616
v 17.046078 13.660254 9.205603
v 12.706568 13.895587 13.011941
v 7.685474 14.053212 15.183702
v 2.543872 14.132246 15.678346
v -2.200293 14.132246 14.632575
v -6.125474 14.053212 12.330486
v -8.944007 13.895590 9.157281
v -10.520370 13.660255 5.545353
v -10.869738 13.348526 1.919896
v -10.138499 12.962147 -1.349012
v -8.570958 12.503281 -3.982616
v -6.467703 11.974491 -5.814238
v -4.141840 11.378731 -6.793613
v -1.879156 10.719341 -6.975777
v 0.092977 10.000000 -26.497763
v 0.092980 10.000000 -6.497766
vn 0.0983 -0.9952 -0.0000
vn -0.3763 -0.9074 -0.1872
vn 0.1242 -0.9915 -0.0395
vn -0.2395 -0.9131 -0.3299
vn 0.1792 -0.9822 -0.0570
vn -0.0608 -0.9103 -0.4094
vn 0.2506 -0.9673 -0.0398
vn 0.1352 -0.8997 -0.4150
vn 0.3210 -0.9469 0.0183
vn 0.3213 -0.8820 -0.3449
vn 0.3713 -0.9212 0.1160
vn 0.4708 -0.8577 -0.2067
vn 0.3841 -0.8904 0.2441
vn 0.5614 -0.8274 -0.0170
vn 0.3466 -0.8547 0.3865
vn 0.5774 -0.7915 0.2004
vn 0.2528 -0.8142 0.5227
vn 0.5122 -0.7505 0.4176
vn 0.1053 -0.7693 0.6302
vn 0.3694 -0.7048 0.6057
vn -0.0850 -0.7202 0.6886
vn 0.1627 -0.6547 0.7381
vn -0.2995 -0.6672 0.6820
vn -0.0857 -0.6007 0.7948
vn -0.5141 -0.6107 0.6023
vn -0.3476 -0.5432 0.7643
vn -0.7026 -0.5509 0.4503
vn -0.5922 -0.4824 0.6454
vn -0.8400 -0.4883 0.2365
vn -0.7899 -0.4189 0.4478
vn -0.9058 -0.4231 -0.0202
vn -0.9160 -0.3529 0.1910
vn -0.8871 -0.3558 -0.2939
vn -0.9535 -0.2849 -0.0981
vn -0.7806 -0.2867 -0.5554
vn -0.8960 -0.2152 -0.3884
vn -0.5932 -0.2162 -0.7755
vn -0.7478 -0.1442 -0.6481
vn -0.3420 -0.1447 -0.9285
vn -0.5237 -0.0724 -0.8488
vn -0.1012 -0.0733 0.9922
vn -0.8025 -0.1404 0.5800
vn -0.4156 -0.1471 0.8976
vn -0.9472 -0.2042 0.2473
vn -0.6715 -0.2205 0.7074
vn -0.9575 -0.2612 -0.1223
vn -0.8432 -0.2929 0.4508
vn -0.8251 -0.3090 -0.4730
vn -0.9173 -0.3638 0.1622
vn -0.5670 -0.3463 -0.7474
vn -0.8931 -0.4325 -0.1233
vn -0.2258 -0.3727 -0.9000
vn -0.7819 -0.4989 -0.3738
vn 0.1396 -0.3901 -0.9101
vn -0.6042 -0.5623 -0.5646
vn 0.4695 -0.4022 -0.7860
vn -0.3865 -0.6226 -0.6804
vn 0.7176 -0.4143 -0.5598
vn -0.1580 -0.6793 -0.7166
vn 0.8589 -0.4317 -0.2756
vn 0.0541 -0.7322 -0.6789
vn 0.8884 -0.4585 0.0220
vn 0.2271 -0.7809 -0.5818
vn 0.8160 -0.4971 0.2948
vn 0.3465 -0.8252 -0.4460
vn 0.6611 -0.5472 0.5133
vn 0.4063 -0.8648 -0.2950
vn 0.4491 -0.6058 0.6567
vn 0.4098 -0.8995 -0.1514
vn 0.2095 -0.6683 0.7138
vn 0.3682 -0.9291 -0.0342
vn -0.0265 -0.7295 0.6835
vn 0.2985 -0.9534 0.0445
vn -0.2300 -0.7847 0.5756
vn 0.2199 -0.9722 0.0802
vn -0.3773 -0.8310 0.4088
vn 0.1513 -0.9855 0.0766
vn -0.4531 -0.8669 0.2078
vn 0.4531 0.8669 0.2078
vn -0.1513 0.9855 0.0766
vn 0.3773 0.8310 0.4088
vn -0.2199 0.9722 0.0802
vn 0.2300 0.7847 0.5756
vn -0.2985 0.9534 0.0445
vn 0.0265 0.7295 0.6835
vn -0.3682 0.9291 -0.0342
vn -0.2095 0.6683 0.7138
vn -0.4098 0.8995 -0.1514
vn -0.4491 0.6058 0.6567
vn -0.4063 0.8648 -0.2950
vn -0.6611 0.5472 0.5133
vn -0.3465 0.8252 -0.4460
vn -0.8160 0.4971 0.2948
vn -0.2271 0.7809 -0.5818
vn -0.8884 0.4585 0.0220
vn -0.0541 0.7322 -0.6789
vn -0.8589 0.4317 -0.2756
vn 0.1580 0.6793 -0.7166
vn -0.7176 0.4143 -0.5598
vn 0.3865 0.6226 -0.6804
vn -0.4695 0.4022 -0.7860
vn 0.6042 0.5623 -0.5646
vn -0.1396 0.3901 -0.9101
vn 0.7819 0.4989 -0.3738
vn 0.2258 0.3727 -0.9000
vn 0.8931 0.4325 -0.1233
vn 0.5670 0.3463 -0.7474
vn 0.9173 0.3638 0.1622
vn 0.8251 0.3090 -0.4730
vn 0.8432 0.2929 0.4508
vn 0.9575 0.2612 -0.1223
vn 0.6715 0.2205 0.7074
vn 0.9472 0.2042 0.2473
vn 0.4156 0.1471 0.8976
vn 0.8025 0.1404 0.5800
vn 0.1012 0.0733 0.9922
vn 0.2474 -0.0000 -0.9689
vn 0.0517 0.0725 -0.9960
vn 0.5237 0.0724 -0.8488
vn 0.3420 0.1447 -0.9285
vn 0.7478 0.1442 -0.6481
vn 0.5932 0.2162 -0.7755
vn 0.8960 0.2152 -0.3884
vn 0.7806 0.2867 -0.5554
vn 0.9535 0.2849 -0.0981
vn 0.8871 0.3558 -0.2939
vn 0.9160 0.3529 0.1910
vn 0.9058 0.4231 -0.0202
vn 0.7899 0.4189 0.4478
vn 0.8400 0.4883 0.2365
vn 0.5922 0.4824 0.6454
vn 0.7026 0.5509 0.4503
vn 0.3476 0.5432 0.7643
vn 0.5141 0.6107 0.6023
vn 0.0857 0.6007 0.7948
vn 0.2995 0.6672 0.6820
vn -0.1627 0.6547 0.7381
vn 0.0850 0.7202 0.6886
vn -0.3694 0.7048 0.6057
vn -0.1053 0.7693 0.6302
vn -0.5122 0.7505 0.4176
vn -0.2528 0.8142 0.5227
vn -0.5774 0.7915 0.2004
vn -0.3466 0.8547 0.3865
vn -0.5614 0.8274 -0.0170
vn -0.3841 0.8904 0.2441
vn -0.4708 0.8577 -0.2067
vn -0.3713 0.9212 0.1160
vn -0.3213 0.8820 -0.3449
vn -0.3210 0.9469 0.0183
vn -0.1352 0.8997 -0.4150
vn -0.2506 0.9673 -0.0398
vn 0.0608 0.9103 -0.4094
vn -0.1792 0.9822 -0.0570
vn 0.2395 0.9131 -0.3299
vn -0.1242 0.9915 -0.0395
vn 0.3763 0.9074 -0.1872
vn -0.0983 0.9952 -0.0000
vn 0.5518 0.0717 0.8309
vn -0.2356 -0.0000 0.9719
vn -0.4516 -0.8922 -0.0000
vn 0.1078 -0.9932 0.0446
vn -0.2474 -0.0000 -0.9689
vn -0.0517 -0.0725 -0.9960
vn 0.2356 -0.0000 0.9719
vn -0.5518 -0.0717 0.8309
vn 0.4516 0.8922 -0.0000
vn -0.1078 0.9932 0.0446
vt 0.655720 0.840130
vt 0.042995 0.748934
vt 0.935335 0.665666
vt 0.668669 0.798999
vt 0.975760 0.350319
vt 0.667668 0.734334
vt 0.566347 0.684238
vt 0.398999 0.002002
vt 0.002002 0.398999
vt 0.990854 0.587605
vt 0.481760 0.542116
vt 0.267668 0.001001
vt 0.655720 0.649570
vt 0.042995 0.963238
vt 0.773367 0.452030
vt 0.132332 0.398999
vt 0.636313 0.991659
vt 0.026321 0.752665
vt 0.856802 0.601524
vt 0.982157 0.000000
vt 0.000000 0.758730
vt 0.667668 0.797998
vt 0.934334 0.664665
vt 0.856802 0.400909
vt 0.982157 0.241196
vt 0.566348 0.854459
vt 0.766963 0.939527
vt 0.964811 0.019997
vt 0.566348 0.649572
vt 0.279327 0.496372
vt 0.026321 0.748934
vt 0.975760 0.587625
vt 0.655720 0.654428
vt 0.481760 0.819809
vt 0.279327 0.753849
vt 0.464136 0.400909
vt 0.878605 0.846724
vt 0.261541 0.513006
vt 0.288551 0.477770
vt 0.684436 0.649572
vt 0.813896 0.028631
vt 0.481760 0.500263
vt 0.959325 0.720769
vt 0.291013 0.506405
vt 0.839973 0.012779
vt 0.481760 0.604794
vt 1.000000 0.572920
vt 0.288469 0.542273
vt 0.874414 0.000000
vt 0.998461 0.852801
vt 0.428452 0.717355
vt 0.464462 0.704445
vt 0.733366 0.037630
vt 0.995371 0.417064
vt 0.279557 0.582302
vt 0.813894 0.260707
vt 0.986550 0.601525
vt 0.467335 0.704444
vt 0.994711 0.253115
vt 0.910055 0.614682
vt 0.813894 0.000000
vt 0.986550 0.858694
vt 0.172945 0.531749
vt 0.944724 0.268289
vt 0.949949 0.624311
vt 0.261541 0.756789
vt 0.958143 0.340982
vt 0.949950 0.601525
vt 0.066969 1.000000
vt 0.927446 0.011788
vt 0.261541 0.496372
vt 0.958143 0.601525
vt 0.062140 0.496372
vt 0.852064 0.141280
vt 0.921234 0.361018
vt 0.279556 0.387392
vt 0.964811 0.000000
vt 0.332634 0.714070
vt 0.019209 0.402987
vt 0.725770 0.048739
vt 0.256929 0.351070
vt 0.380274 0.704444
vt 0.109069 0.965611
vt 0.279556 0.719913
vt 0.000000 0.296507
vt 0.577758 0.000000
vt 0.243223 0.302011
vt 0.332634 0.704444
vt 0.099328 0.986935
vt 0.874414 0.022064
vt 0.005714 0.187029
vt 0.422242 0.000000
vt 0.241424 0.243992
vt 0.927447 0.000000
vt 0.077389 0.999479
vt 0.380273 0.729494
vt 0.035023 0.084978
vt 0.274230 0.048740
vt 0.253401 0.182327
vt 0.428452 0.704444
vt 0.172945 0.748933
vt 0.084210 0.000000
vt 0.300998 0.400909
vt 0.147936 0.141280
vt 0.279556 0.123367
vt 0.536310 0.348705
vt 0.122992 0.748645
vt 0.284005 0.300079
vt 0.055276 0.268289
vt 0.524955 0.290066
vt 0.063520 0.732058
vt 0.279556 0.192898
vt 0.004629 0.417064
vt 0.520724 0.218906
vt 0.000000 0.699073
vt 0.088929 0.969444
vt 0.767048 0.878427
vt 0.286802 0.089645
vt 0.000000 0.572920
vt 0.524514 0.141525
vt 0.689550 0.878427
vt 0.055290 0.993704
vt 0.839708 0.636398
vt 0.303764 0.000000
vt 0.689550 0.440331
vt 0.040675 0.720769
vt 0.536310 0.065468
vt 0.773366 0.667885
vt 0.839706 0.601526
vt 0.910055 0.601524
vt 0.480626 0.958365
vt 0.856802 0.396305
vt 0.773366 0.400909
vt 0.839706 0.849281
vt 0.733367 0.241984
vt 0.121395 0.846724
vt 0.773365 0.621612
vt 0.733367 0.000000
vt 0.921234 0.358425
vt 0.689550 0.649572
vt 0.634129 0.249235
vt 0.233038 0.939528
vt 0.651824 0.009733
vt 0.620640 0.638160
vt 0.536310 0.246706
vt 0.363688 0.991659
vt 0.001001 0.267668
vt 0.561427 0.011473
vt 0.548870 0.601753
vt 0.397998 0.001001
vt 0.001001 0.397998
vt 0.026321 0.933807
vt 0.975760 0.340983
vt 0.934334 0.534334
vt 0.526593 0.623385
vt 0.958143 0.353014
vt 0.684436 0.838722
vt 0.845255 0.276465
vt 0.544374 0.601510
vt 0.860840 0.263980
vt 0.553499 0.578297
vt 0.874414 0.252987
vt 0.998461 0.601526
vt 0.555151 0.556536
vt 0.986550 0.612560
vt 0.467335 0.957551
vt 0.994711 0.000000
vt 0.551136 0.538093
vt 0.982156 0.010131
vt 0.949950 0.854537
vt 0.066969 0.748933
vt 0.543453 0.523857
vt 0.055290 0.759159
vt 0.964811 0.252137
vt 0.372561 0.956393
vt 0.533912 0.513855
vt 0.380274 0.943913
vt 0.109069 0.748934
vt 0.523855 0.507508
vt 0.099328 0.759835
vt 0.332634 0.941086
vt 0.099328 0.748934
vt 0.514030 0.503963
vt 0.088929 0.758840
vt 0.927447 0.239556
vt 0.077389 0.748934
vt 0.504615 0.502427
vt 0.066969 0.758656
vt 0.428452 0.951126
vt 0.172945 0.496372
vt 0.495385 0.502427
vt 0.162846 0.506495
vt 0.485971 0.503963
vt 0.151669 0.515734
vt 0.476145 0.507508
vt 0.139128 0.523645
vt 0.088929 0.748933
vt 0.466088 0.513855
vt 0.077389 0.758181
vt 0.761343 0.667884
vt 0.055290 0.748933
vt 0.456547 0.523857
vt 0.042995 0.759300
vt 0.910055 0.831978
vt 0.480626 0.704444
vt 0.448864 0.538093
vt 0.467335 0.715461
vt 0.921234 0.601524
vt 0.689550 0.400909
vt 0.444849 0.556536
vt 0.675020 0.412230
vt 0.446501 0.578297
vt 0.656784 0.419905
vt 0.455626 0.601510
vt 0.473407 0.623385
vt 0.998999 0.665666
vt 0.990854 0.340982
vt 0.635336 0.422324
vt 0.268669 0.132332
vt 0.132332 0.268669
vt 0.628663 0.965985
vt 0.737807 0.895253
vt 0.818190 0.796843
vt 0.864044 0.682052
vt 0.873487 0.563104
vt 0.848479 0.451776
vt 0.794356 0.358172
vt 0.719010 0.289747
vt 0.631828 0.250706
vt 0.542555 0.241814
vt 0.460182 0.260613
vt 0.392029 0.301997
vt 0.343091 0.359041
vt 0.315721 0.423971
vt 0.309655 0.489145
vt 0.322351 0.547909
vt 0.349568 0.595253
vt 0.386087 0.628179
vt 0.426471 0.645785
vt 0.465758 0.649059
vt 0.998999 0.535335
vt 0.798999 0.735335
vt 0.398999 0.132332
vt 0.267668 0.131331
vt 0.131331 0.267668
vt 0.500000 1.000000
vt 0.798999 0.798999
vt 0.797998 0.734334
vt 0.997998 0.534334
vt 0.500000 0.640467
s 0
f 1/1/1 2/7/1 3/13/1
f 3/14/2 4/18/2 1/2/2
f 4/19/3 3/15/3 5/24/3
f 5/25/4 6/28/4 4/20/4
f 6/29/5 5/26/5 7/34/5
f 7/35/6 8/38/6 6/30/6
f 8/39/7 7/36/7 9/42/7
f 9/42/8 10/44/8 8/39/8
f 10/44/9 9/42/9 11/46/9
f 11/46/10 12/48/10 10/44/10
f 12/48/11 11/46/11 13/52/11
f 13/52/12 14/55/12 12/48/12
f 14/56/13 13/53/13 15/61/13
f 15/62/14 16/65/14 14/57/14
f 16/66/15 15/63/15 17/71/15
f 17/72/16 18/75/16 16/67/16
f 18/76/17 17/73/17 19/79/17
f 19/79/18 20/81/18 18/76/18
f 20/81/19 19/79/19 21/85/19
f 21/85/20 22/87/20 20/81/20
f 22/87/21 21/85/21 23/91/21
f 23/91/22 24/93/22 22/87/22
f 24/93/23 23/91/23 25/97/23
f 25/97/24 26/99/24 24/93/24
f 26/99/25 25/97/25 27/102/25
f 27/102/26 28/105/26 26/99/26
f 28/106/27 27/103/27 29/108/27
f 29/108/28 30/110/28 28/106/28
f 30/110/29 29/108/29 31/112/29
f 31/112/30 32/114/30 30/110/30
f 32/114/31 31/112/31 33/118/31
f 33/118/32 34/120/32 32/114/32
f 34/120/33 33/118/33 35/124/33
f 35/124/34 36/127/34 34/120/34
f 36/128/35 35/125/35 37/133/35
f 37/134/36 38/137/36 36/129/36
f 38/138/37 37/135/37 39/141/37
f 39/141/38 40/143/38 38/138/38
f 40/143/39 39/141/39 41/145/39
f 41/145/40 42/148/40 40/143/40
f 43/152/41 4/21/41 6/31/41
f 6/32/42 44/156/42 43/153/42
f 44/157/43 6/33/43 8/40/43
f 8/41/44 45/160/44 44/158/44
f 45/160/45 8/41/45 10/45/45
f 10/45/46 46/162/46 45/160/46
f 46/162/47 10/45/47 12/49/47
f 12/50/48 47/165/48 46/163/48
f 47/166/49 12/51/49 14/58/49
f 14/59/50 48/169/50 47/167/50
f 48/170/51 14/60/51 16/68/51
f 16/69/52 49/173/52 48/171/52
f 49/174/53 16/70/53 18/77/53
f 18/78/54 50/177/54 49/175/54
f 50/177/55 18/78/55 20/82/55
f 20/83/56 51/180/56 50/178/56
f 51/181/57 20/84/57 22/88/57
f 22/89/58 52/184/58 51/182/58
f 52/185/59 22/90/59 24/94/59
f 24/95/60 53/188/60 52/186/60
f 53/189/61 24/96/61 26/100/61
f 26/101/62 54/192/62 53/190/62
f 54/192/63 26/101/63 28/107/63
f 28/107/64 55/194/64 54/192/64
f 55/194/65 28/107/65 30/111/65
f 30/111/66 56/196/66 55/194/66
f 56/196/67 30/111/67 32/115/67
f 32/116/68 57/199/68 56/197/68
f 57/200/69 32/117/69 34/121/69
f 34/122/70 58/203/70 57/201/70
f 58/204/71 34/123/71 36/130/71
f 36/131/72 59/207/72 58/205/72
f 59/208/73 36/132/73 38/139/73
f 38/140/74 60/211/74 59/209/74
f 60/211/75 38/140/75 40/144/75
f 40/144/76 61/213/76 60/211/76
f 61/213/77 40/144/77 42/149/77
f 42/149/78 62/218/78 61/213/78
f 63/221/79 43/155/79 44/159/79
f 44/159/80 64/222/80 63/221/80
f 64/222/81 44/159/81 45/161/81
f 45/161/82 65/223/82 64/222/82
f 65/223/83 45/161/83 46/164/83
f 46/164/84 66/224/84 65/223/84
f 66/224/85 46/164/85 47/168/85
f 47/168/86 67/225/86 66/224/86
f 67/225/87 47/168/87 48/172/87
f 48/172/88 68/226/88 67/225/88
f 68/226/89 48/172/89 49/176/89
f 49/176/90 69/227/90 68/226/90
f 69/227/91 49/176/91 50/179/91
f 50/179/92 70/228/92 69/227/92
f 70/228/93 50/179/93 51/183/93
f 51/183/94 71/229/94 70/228/94
f 71/229/95 51/183/95 52/187/95
f 52/187/96 72/230/96 71/229/96
f 72/230/97 52/187/97 53/191/97
f 53/191/98 73/231/98 72/230/98
f 73/231/99 53/191/99 54/193/99
f 54/193/100 74/232/100 73/231/100
f 74/232/101 54/193/101 55/195/101
f 55/195/102 75/233/102 74/232/102
f 75/233/103 55/195/103 56/198/103
f 56/198/104 76/234/104 75/233/104
f 76/234/105 56/198/105 57/202/105
f 57/202/106 77/235/106 76/234/106
f 77/235/107 57/202/107 58/206/107
f 58/206/108 78/236/108 77/235/108
f 78/236/109 58/206/109 59/210/109
f 59/210/110 79/237/110 78/236/110
f 79/237/111 59/210/111 60/212/111
f 60/212/112 80/238/112 79/237/112
f 80/238/113 60/212/113 61/214/113
f 61/214/114 81/239/114 80/238/114
f 81/239/115 61/214/115 62/215/115
f 62/215/116 82/240/116 81/239/116
f 2/8/117 83/243/117 63/219/117
f 63/220/118 3/16/118 2/9/118
f 3/17/119 63/221/119 64/222/119
f 64/222/120 5/27/120 3/17/120
f 5/27/121 64/222/121 65/223/121
f 65/223/122 7/37/122 5/27/122
f 7/37/123 65/223/123 66/224/123
f 66/224/124 9/43/124 7/37/124
f 9/43/125 66/224/125 67/225/125
f 67/225/126 11/47/126 9/43/126
f 11/47/127 67/225/127 68/226/127
f 68/226/128 13/54/128 11/47/128
f 13/54/129 68/226/129 69/227/129
f 69/227/130 15/64/130 13/54/130
f 15/64/131 69/227/131 70/228/131
f 70/228/132 17/74/132 15/64/132
f 17/74/133 70/228/133 71/229/133
f 71/229/134 19/80/134 17/74/134
f 19/80/135 71/229/135 72/230/135
f 72/230/136 21/86/136 19/80/136
f 21/86/137 72/230/137 73/231/137
f 73/231/138 23/92/138 21/86/138
f 23/92/139 73/231/139 74/232/139
f 74/232/140 25/98/140 23/92/140
f 25/98/141 74/232/141 75/233/141
f 75/233/142 27/104/142 25/98/142
f 27/104/143 75/233/143 76/234/143
f 76/234/144 29/109/144 27/104/144
f 29/109/145 76/234/145 77/235/145
f 77/235/146 31/113/146 29/109/146
f 31/113/147 77/235/147 78/236/147
f 78/236/148 33/119/148 31/113/148
f 33/119/149 78/236/149 79/237/149
f 79/237/150 35/126/150 33/119/150
f 35/126/151 79/237/151 80/238/151
f 80/238/152 37/136/152 35/126/152
f 37/136/153 80/238/153 81/239/153
f 81/239/154 39/142/154 37/136/154
f 39/142/155 81/239/155 82/240/155
f 82/240/156 41/146/156 39/142/156
f 41/146/157 82/240/157 84/250/157
f 84/250/158 83/246/158 41/146/158
f 82/241/159 62/216/159 1/3/159
f 1/4/160 84/247/160 82/242/160
f 2/10/161 1/5/161 62/217/161
f 62/218/162 42/149/162 2/11/162
f 83/244/163 2/12/163 42/150/163
f 42/151/164 41/147/164 83/245/164
f 84/248/165 1/6/165 4/22/165
f 4/23/166 43/154/166 84/249/166
f 83/246/167 84/250/167 43/155/167
f 43/155/168 63/221/168 83/246/168

You will have to supply a texture image of your choice.

:)

2 Likes

Nice obj. Textures up easily. No .mtl file?

I noticed that your obj file had no mtllib xxxx.mtl line of code at the top. Did you delete it or was it just not put there by Blender? Apparently if that line is not there it makes it easier for Processing users to add their own textures.

Below is a file that I created in Blender from an imported .stl and edited using the Project from View setting. It included an .mtl file with the exported .obj file, but if I REM out the mtllib line out of the first line of the .obj file then I can also easily add my own texture just like I did with your obj file.

mtl

In summary, apparently if you leave out the .mtl file (ie mtllib reference to it in obj file) it’s possible to add your own texture easily. It also looks like this only works if you create the .obj file in Blender. I didn’t have similar luck using an online converter (stl to obj).

Addendum:
I just now realized that those .stl files are for 3D printers. The images that are shown with the file are not textures to be used, but are the output from a 3D printer. No wonder I couldn’t get them to work as a texture. Homemade images work much better (or official downloaded texture files). Custom bulldog below came from a Blender converted .stl file with my own .png file and no .mtl file:

Second Addendum:
Turns out Blender adds a blank .mtl file when using Project from View so you don’t really have to REM out the first line of the obj file; it will also work with your own graphic file just as easily if you leave the first line in place in the .obj file.

1 Like