Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I found a script for converting m3 files (3D f="https://forum.tuteehub.com/tag/model">models f="https://forum.tuteehub.com/tag/use">used in Starcraft 2) to obj files, but I do not know how to f="https://forum.tuteehub.com/tag/use">use it. All the information I got was "Well, here is the script.", so I cannot really give you much information, besides the fact that I have never heard of PHP before.
Here is the script
file = $argv[1]; $path = $temp[0];# "./Assets/Doodads/AiurTree/AiurTree_06"; echo("Exporting Model $path to $path.obj\n\n"); $file = fopen($file, 'rb') or die("Failed to open $file!\n"); if(fread($file,4) != "33DM") die("Failed! File is not a StarCraft 2 f="https://forum.tuteehub.com/tag/model">model!\n"); fseek($file, 4); # find where tags start $f="https://forum.tuteehub.com/tag/index">index = unpack(V, fread($file, 4)); # search for __8U "5F 5F 38 55" tag for vertex offset $offset = $f="https://forum.tuteehub.com/tag/index">index[1]; while(1){ fseek($file, $offset+16); $string = fread($file, 4); if ($string == '__8U'){ $offset+=20; break; } $offset++; } fseek($file, $offset); $f="https://forum.tuteehub.com/tag/index">index = unpack(V, fread($file, 4)); fseek($file, $offset+4); $maxVerts = unpack(V, fread($file, 4)); # maximum extents $maxVerts[1] = $maxVerts[1] + $f="https://forum.tuteehub.com/tag/index">index[1]; fseek($file, $offset+6); $version = unpack(V, fread($file, 4)); # up to 7 versions currently known if ($version[1] == 7 or $version[1] == 0){ $EOB = 4; # versions have different number of values after uv - value to reach end of block } elseif ($version[1] == 1 or $version[1] == 2 or $version[1] == 3 or $version[1] == 6){ $EOB = 8; } else { $EOB = 8; echo("Model not yet supported, report it to Teal\n"); //die("Model not yet supported, report it to Teal"); } echo("Model type $version[1]\n"); if ($version[1] == 2) echo("This f="https://forum.tuteehub.com/tag/model">model will have invalid UV coordinates... working on it.\n"); fseek($file, $offset+32); # face data $f="https://forum.tuteehub.com/tag/index">indexFaces = unpack(V, fread($file, 4)); fseek($file, $offset+36); $maxFaces = unpack(V, fread($file, 4)); $maxFaces[1] = $maxFaces[1]*2 + $f="https://forum.tuteehub.com/tag/index">indexFaces[1]; $i = 0; $k = 0; $offset = $f="https://forum.tuteehub.com/tag/index">index[1]; while(1){ if ($offset >= $maxVerts[1]) break; for($j=0;$j<3;$j++){ # read verts fseek($file, $offset); $temp = unpack(f, fread($file, 4)); $vert[$i] = $temp[1]; $offset +=4; $i++; } $offset+=12; for($j=0;$j<2;$j++){ # read UV fseek($file, $offset); $temp = unpack(v, fread($file, 2)); if ($temp[1] > 2046){ $uv[$k] = $temp[1] / 65536; } else { $uv[$k] = $temp[1] / 2046; } $offset +=2; $k++; } $offset+=$EOB; } $i=0; $offset = $f="https://forum.tuteehub.com/tag/index">indexFaces[1]; while(1){ # read faces if ($offset >= $maxFaces[1]) break; fseek($file, $offset); $temp = unpack(v, fread($file, 2)); $face[$i]=$temp[1]; $i++; $offset+=2; } $out = fopen($path . ".obj", 'w+'); for($i=0; $if($vert); $i+=3){ fwrite($out, "v " . $vert[$i] . " " . $vert[$i+1] . " " . $vert[$i+2] . "\n"); } for($i=0; $if($uv); $i+=2){ fwrite($out, "vt " . $uv[$i] . " " . (1-$uv[$i+1]) . "\n"); } for($i=0; $if($face); $i+=3){ fwrite($out, "f " . ($face[$i]+1) . "/" . ($face[$i]+1) . " " . ($face[$i+1]+1) . "/" . ($face[$i+1]+1) . " " . ($face[$i+2]+1) . "/" . ($face[$i+2]+1) . "\n"); } fclose($out); echo("Done!\n\n"); ?>
How can I f="https://forum.tuteehub.com/tag/use">use this?
You need to save the script as a file named script.php(or anything with .php). Copy everything, paste it into a text editor of your choice. Place it somewhere, probably best in /Users/your-username/script.php, or any other folder you like.
script.php
.php
/Users/your-username/script.php
Now you can run the script using the php binary which comes with OS X.
php
Open the Terminal.app from Applications → Utilities. Enter the following line
php ~/script.php ~/file.m3
to execute the script. ~ is short for your home directory. Of course, file.m3 needs to exist in your home directory as well and be the StarCraft file you want to convert.
~
file.m3
The resulting .obj file will probably be placed in the same folder as the m3 file.
.obj
m3
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 10 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 9 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.