theanine3D / source-engine-collision-tools

Blender addon for generating and optimizing collision models for use in Source Engine
GNU General Public License v3.0
29 stars 1 forks source link

source doesnt use the custom collision mesh #7

Closed shadept-GitHub closed 2 months ago

shadept-GitHub commented 2 months ago

this tool doesnt work. im trying to port a map from another game and every time i try to import a model into source thats a chunk of the map the collision mesh is discarded and i tried using crowbar to see the log manually and it still wont work. its a map from minecraft but since the creator of that one tool that converts minecraft worlds to source has abandoned their project and the tool doesnt work i have to resort to making the map into models. i tried adding a solidify modifier to the map geometry and then making a collision mesh based on that but it wouldnt work either, source just disregards the collision mesh and makes its own without any reason why in the log. image image

theanine3D commented 2 months ago

Please post the QC file that you're compiling, and possibly the Blender file, so I can see what the problem is.

Note that Source will always, by default, try to merge all hulls together into a single convex hull, unless you have set up the QC file correctly. This is normal, expected behavior on the compiler's part. It doesn't mean the Blender addon isn't working. You need to make sure you have $concave in your $collisionmodel command in the QC file, like in the example below, to force the compiler to not merge the hulls into a single one.,

$collisionmodel "_name_of_collision_mesh_.smd" { $concave $automass }

However, if you have more than 32 hulls in that single collision mesh, the compiler will still merge them all into one anyway, even if you included $concave in the QC file. In that case, you will need to split up the mesh into multiple parts. The addon has a button that will do it for you.

shadept-GitHub commented 2 months ago

If you have more than 32 hulls in that single mesh, the compiler will merge them all anyway, even if you included $concave in the QC file. In that case, you will need to split up the mesh into multiple parts. The addon has a button that will do it for you.

see, this is my problem. when i try to split the collision mesh my blender freezes and it takes 2 hours to split the collision mesh. and even then, how am i supposed to use that? use them as separate static props?

theanine3D commented 2 months ago

Looking at your screenshot above I can see a ton of hulls that should be merged together. Your mesh is likely just too complex if the Split Up button is freezing Blender. Please post the Blender file so I can see exactly what's going on. When you press the Force Convex button, what is the amount of hulls that it tells you?

And as for the split-up parts, the Generate QC button will generate QC files for all of the split up parts, and then you can compile all of them easily with Crowbar. Then after compiling them, you can use the Update VMF button to add them automatically to your VMF. However, the first part (part_000) needs to be added first, manually, by you in Hammer. The Update VMF button will look for any entity (ie. prop_static) that has part_000 assigned to it, and it will insert all of the other parts in the same position as part_000 (with the same entity settings.)

shadept-GitHub commented 2 months ago

heres the .blend file maptest.zip im not sure about force convex hull because it also freezes up blender for a while and i always glanced over it unfortunately. i also cant make my map one big model as there are more than 32 materials for every part but if i can at least automate the collision then i could handle the map reference mesh myself i suppose. i use sourceops for compiling models by the way but i do also have crowbar. its just more convient to use sourceops for me.

theanine3D commented 2 months ago

The Force Convex Hull operator is probably the fastest operator in the whole addon. If even this button is making Blender lag for you, you definitely need to reduce the complexity of the collision mesh first.

I opened up your Blender file, and sure enough, after running Force Convex Hulls on it, I got this result: image

That is an extremely excessive amount of hulls. You should not be going above 100-300 (even 300 is excessive, but still technically usable if you split it up first.) Note that my addon is meant to be used as a starting point - you should still be cleaning up the resulting generated collision afterward. And this mesh direly needs it. Up until I opened your Blender file I had never encountered a situation where the Force Convex Button actually lagged, but it lagged on your collision. So your collision needs fixing.

You can easily merge a ton of these together, very quickly, manually, in Edit Mode. Follow these steps: 1) Go into Edit Mode with the Tab key 2) Press the Z key to go into Wireframe mode 3) Use the C key to enable circle select mode, then start highlighting sections of hulls that could be merged together without changing the overall shape of the whole collision. See example below:

image

After highlighting these faces, press Ctrl + L to highlight the entire hull pieces connected to those faces. Then, use the Convex Hull operator, which you can find in the Mesh menu (or press F3/Spacebar and search for "Convex Hull").

image

After doing that, all of those hulls will be merged together, forming only a single hull and significantly reducing the hull count.

image

Repeat these steps for the rest of the collision mesh, and try to get the collision mesh to a total of under 100 hulls. Given how simple the shapes in your scene are (they're just a bunch of blocks and very flat pieces of ground), you can definitely reduce this to something well below 100 hulls. Use the Force Convex button to keep counting how many you have so far. When you reach the point where the Force Convex button no longer freezes Blender, you've probably got something usable. However, remember that any hull count above 32 will still require splitting up the mesh first, via the Split Up Collision Mesh button. As long as your hull count is above 32, Source will keep merging all hulls into a single one.

I will be closing this now as I've confirmed the issue is not a bug or issue with the addon itself, but an issue with your collision.

shadept-GitHub commented 2 months ago

im not sure how to really approach this. it seems tedious and force convex ends up messing up all my work from when i merged some parts of it.