Trimesh (displacements Hammer 3.5) Created 11 years ago2013-01-19 17:12:14 UTC by Backup Backup

Created 11 years ago2013-01-19 17:12:14 UTC by Backup Backup

Posted 11 years ago2013-01-19 17:16:01 UTC Post #312264
Hi there,
I created trimesh for hammer 3.5. It is another type of solid which is perfert for creating terrain.
This is how it looks like in hammer:
User posted image
And ingame:
User posted image
It is a replacement for wedge, so you can find it in solids menu between block and cylinder. Faces parameter defines how many splits will be made on each side - for faces=4 a trimesh 4x4 will be created with total of 32 faces (2 triangles for each square).

Editing trimesh with vertex tool is way easier than editing bunch of tetrahedrons. (Only limitation i know - you can't snap or create new vertices)
Under trimesh one extra vertex is created - it defines point from trimesh brushes will be created (after compiling / saving to .map):
User posted image
If you move it too close to trimesh, compilation will fail because of this (twisted tetrahedrons):
User posted image
Installation is easy - just backup your hammer.exe and copy files from hammer_trimesh.zip.
(hammer.exe in archive is already modified by vluzacn's float point coord and 8196 grid enablers)
http://backup.tvorbamap.cz/archiv/hammer_trimesh.zip

Disclaimer:
this is exprimental, use at your own risk
all credits for float point coords and 8196 grid belongs to vluzacnn
Posted 11 years ago2013-01-19 19:21:44 UTC Post #312269
This looks great! Do you have a version without Vluzacn's edits? I'd rather not use his grid hacks and float point thing.
Suparsonik SuparsonikI'm going off the edge to meet my maker.
Posted 11 years ago2013-01-19 20:09:01 UTC Post #312271
here you go: http://backup.tvorbamap.cz/archiv/hammer_nohax.zip
(this is exe only, you still need hammer_trimesh.dll)
Posted 11 years ago2013-01-20 01:02:16 UTC Post #312272
You should release a hacked version of Hammer 3.5 that enabled plugins like this. Great work!
Daubster DaubsterVault Dweller
Posted 11 years ago2013-01-20 16:07:48 UTC Post #312273
I already use a modified Hammer executable. Is there a way to add Trimesh support to my Hammer executable without loosing my modifications?
Posted 11 years ago2013-01-20 16:26:25 UTC Post #312274
Do you have any link to these specific modifications? If these modifications are only cosmetic (changes in resources), a simple diff could be applied.
Posted 11 years ago2013-01-20 18:30:08 UTC Post #312275
Yes it's only cosmetic changes, I resized a couple of controls and dialogs with Resource Hacker.
Posted 11 years ago2013-01-20 21:00:15 UTC Post #312278
Hell yeah! This rocks Backup, thanks!

EDIT: Okay, one issue. I am getting errors during compilation, is there some sort of custom modified compilers I need to use?

EDIT2: Got it to compile, however, Half-Life refuses to read the map.
Suparsonik SuparsonikI'm going off the edge to meet my maker.
Posted 11 years ago2013-01-20 22:08:55 UTC Post #312281
The Mighty Atom:
If you send your version to me, I could try to apply my modifications to it. Or I can create a diff between original and customized hammer.
Suture:
That's weird. Could you provide rmf or bsp?
Posted 11 years ago2013-01-20 22:19:35 UTC Post #312282
Can I still make modifications to it after Trimesh has been added?
Posted 11 years ago2013-01-20 22:38:06 UTC Post #312283
sure
Posted 11 years ago2013-01-21 16:55:00 UTC Post #312285
http://www.mediafire.com/?c86k8ay6cc964w4

Both the RMF and the BSP are enclosed.
Suparsonik SuparsonikI'm going off the edge to meet my maker.
Posted 11 years ago2013-01-21 17:48:06 UTC Post #312286
I don't own ot.wad, but after stripping it from wad list, it loaded ok. (Only walking-in-the-air caused by classic cliptype, no problem after recompile from .rmf with precise cliptype)

Could you specify which compile errors did it give you? Was that the cause for opening saved .map and saving it as .rmf? How specificly did half-life refused to read the map?
Posted 11 years ago2013-01-21 21:19:16 UTC Post #312288
Check your pm.
Posted 11 years ago2013-01-21 21:41:09 UTC Post #312289
Does this patch do anything tricky with RMF files? I mean, would somebody using HLFix or an unpatched build of Hammer be able to edit and compile the RMFs produced by the patched Hammer?
Penguinboy PenguinboyHaha, I died again!
Posted 11 years ago2013-01-22 11:18:51 UTC Post #312290
Literally the only error it gave was "File read failure".
Suparsonik SuparsonikI'm going off the edge to meet my maker.
Posted 11 years ago2013-01-22 13:10:08 UTC Post #312292
Penguinboy:
with unpatched hammer:
you can edit & save rmf
you can't compile or save to map
it will give you a lot of errors in Check for problems
using hlfix works only with -nd -nu -r flags

OT: Is there a purpose for hlfix? Last time I tried to use it, it broke stuff that was ok and didn't fix stuff that was broken.

Suture:
Wasn't that caused just by playing the map while compiler was still writing to it? I don't really know how to solve this since I can't recreate circumstances of this error.
Posted 11 years ago2013-01-22 14:15:26 UTC Post #312293
Thanks for the info. Do you think you could go through the specifics of how your patch detects the invalid solids and converts them into tetrahedrons? Does it just convert all invalid faces when you save to map/compile or does it tag them somehow? Is it just a special case when it finds a solid with a face with just one vertex in it, or is it something more complex? I'm very interested in the details :)

I asked about HLFix because I suspect Suture might be using it, seeing how he doesn't use the floating point hack. I might be wrong.
Penguinboy PenguinboyHaha, I died again!
Posted 11 years ago2013-01-22 14:52:31 UTC Post #312295
Is it just a special case when it finds a solid with a face with just one vertex in it?
Exactly. When i find a solid with face with only one vertex, it has to be trimesh. There is no other way to get one vertex face. I also store it as a first face, so i can easily determine with a few opcodes whether or not it is trimesh.

I "detoured" a call which converts solids to map. If current solid is not trimesh, original function is called. If it is trimesh, my function is called. I pretty much rewrote that whole function, because I didn't want to mess around with adding NULL faces. So in that function i just create a tetrahedron for each face. I could show you a source of that dll (where this function and other function for generating trimesh are stored), but it is wrote pretty messy (a very few comments), contains a lot of magic offsets and it would't tell you much more then I just did.
Posted 11 years ago2013-01-22 23:51:32 UTC Post #312300
Cool, that's pretty neat. As a potential enhancement you could compute the tetrahedron point using the triangle plane normal and place it a few units underneath the center of each triangle, then you could avoid the issues with twisting that you described in the first post. I wrote a tool called Twister that converts VMF displacements into tetrahedrons and found that method worked very well.

I guess the biggest issues with this patch are:
1. It won't work with batch compile tools that accept RMF files (like HLFix) and other applications that can read RMFs (and expect valid solids).
2. It generates invalid solids in the RMF and would be problematic if you wanted to release your map sources, as most people wouldn't have the patch installed.

Do you have any ideas on how to work around these issues? Do you plan to have a tool that will convert from a trimesh RMF into a regular tetrahedron one? If it was a command line tool, that would also make it easy to add into a batch compile script. If you don't want to do it, I think it's something that I could knock together after work, as long as you don't mind it being written in .NET.
Penguinboy PenguinboyHaha, I died again!
Posted 11 years ago2013-01-23 00:52:18 UTC Post #312302
Backup this is pretty neat dude, great work!
Tetsu0 Tetsu0Positive Chaos
Posted 11 years ago2013-01-23 10:06:30 UTC Post #312307
Penguinboy:
It doesn't seem as an improvement to me at all. If every tetrahedron has its own "root" (as i call the point from tetrahedron is created), it is bad for BSP and VIS.

On a small map (trimesh 4x4), I did a comparison:
CSG with no significant differences
BSP run two times slower, 2x more planes, 4x more visleaves
VIS compile time: 1.30 seconds vs. 0.02 seconds.
RAD with no significant differences
Posted 11 years ago2013-01-23 10:15:51 UTC Post #312308
That's a good point, I hadn't thought of that. Though I'm reasonably sure that modern compile tools lets you avoid the issue with extra visleaves, you still have the problem of the longer compile time. I guess it's a trade-off between the quicker compile or allowing more complex/flexible surfaces, and the former is probably more important for the people using this patch.
Penguinboy PenguinboyHaha, I died again!
Posted 11 years ago2013-01-23 11:26:59 UTC Post #312309
Maybe i expressed myself bad... trimesh compiles faster than classic tetrahedrons and editing is easier.
Posted 11 years ago2013-01-23 11:35:00 UTC Post #312310
Yep, I understand. I guess I'm comparing it to Source displacements where you can do a lot of fancy things on top of the terrain geometry they were designed for. Having all the generated tetrahedrons share a vertex wouldn't work in some of the cases I'm thinking of. Definitely not the common use case, and this technique is better for compile times so it's the better choice.
Penguinboy PenguinboyHaha, I died again!
Posted 11 years ago2013-01-24 10:18:38 UTC Post #312316
If anyone wants to patch his own version of hammer, just download:
http://backup.tvorbamap.cz/archiv/trimesh_patch
And then use this patch with bspatch. You can get bsdiff/bspatch here:
http://sites.inka.de/tesla/download/bsdiff4.3-win32.zip
Posted 11 years ago2013-01-24 17:30:29 UTC Post #312319
Thanks, good work, I'll sticky this topic for those who are interested. :)
Posted 11 years ago2013-01-24 18:09:45 UTC Post #312320
just tried this out.

omg...

the grid size...

its...

beautiful... Q_Q
Rimrook RimrookSince 2003
Posted 11 years ago2013-01-27 22:37:53 UTC Post #312338
New version of trimesh!

What's new:
1, Amount of splits is no longer set by Faces parameter

2, Dialog window:
User posted image
3, "Quadmesh" - using squares instead of triangles
Advantages:
+ you can make 1.4x more splits (2x more faces)
Disadvantages:
  • faces disappear in editor when watching from certain angles
  • what you see is not what you get (quadmesh gets cut to trimesh when converting to map by certain rules)
Downloads:
dll
patched hammer
patched hammer with vluzacn's hax
patch for hammer, use bspatch to apply

btw. pity i can't edit my first post
Posted 11 years ago2013-01-28 04:43:01 UTC Post #312346
I wonder how much impact this will have on the current competition. I may use it for the lulz.
Rimrook RimrookSince 2003
Posted 11 years ago2013-01-28 08:42:43 UTC Post #312348
How to use this?
Stojke StojkeUnreal
Posted 11 years ago2013-01-29 21:14:10 UTC Post #312368
Another new version. No major changes, just added an error into Map -> Check for problems for "root misposition".
downloads (see my previous post for installation instructions):
dll
patched hammer
patched hammer with vluzacn's hax
patch for hammer, use bspatch to apply
Posted 11 years ago2013-01-29 21:50:29 UTC Post #312369
It seems that this latest patch fixed my issue!
Suparsonik SuparsonikI'm going off the edge to meet my maker.
Posted 11 years ago2013-01-29 23:13:27 UTC Post #312370
Good work. :)

You can ask a moderator to modify the first post.
Posted 11 years ago2013-01-29 23:58:25 UTC Post #312372
Stojke:
For example like this (if you want quick, but dirty terrain):
http://www.youtube.com/watch?v=mAHziXEcaKI
Posted 11 years ago2013-01-30 10:20:52 UTC Post #312378
I understand how would you use the vertex, but how do i activate this function?
Stojke StojkeUnreal
Posted 11 years ago2013-01-30 18:29:37 UTC Post #312381
Backup i need some Help ;)

somehow this dont work well for me....
i have tons of illegal brushes

check plz and try to help me or explain me what is wrong with that, thx :)

///

Okay found the Problem :) !
Posted 11 years ago2013-01-30 18:45:18 UTC Post #312382
I dont think this program need to make terrain, there is a other way to make good vertex terrain brushwork

I will open new thread about that soon
Posted 11 years ago2013-01-30 19:14:38 UTC Post #312383
Stojke:
Just download that dll and exe and put it to your hammer dir. Then trimesh will apear in solid list between block and cylinder.

Trempler:
(Edit - Aw, too late)
I found problems in those two meshes (and in their copies of course):
User posted image
In that top mesh you were snapping some vertices together which caused discarding the "root". You'll have to recreate that one without snapping any vertices together.

That front mesh suffers from root misposition, but my algorithm failed to recognize it. Just download new version of dll where it should be fixed now.
http://backup.tvorbamap.cz/archiv/trimesh/vhe_trimesh_dll_v3a.zip

platoon:
Something else than common tetrahedrons or wedges?
Posted 11 years ago2013-01-30 19:34:44 UTC Post #312384
Yeah just figured out what i did wrong hehe, but thanks a lot you looked @ it too =)

Just need to say, its great to have guys like you around here. Goldsource still is Nr.1 :D <3
Posted 11 years ago2013-01-30 19:40:07 UTC Post #312385
I seen those but didn't used any of them yet maybe you already know my method, I'm just posted it to tutorial section admin because don't know how to post a new tutorial for now lol

it is just curving a box cross, moving them with arrow keys with vertex and group them togather as much as possible..
Posted 11 years ago2013-02-01 09:19:31 UTC Post #312409
Ahhhh, solid list! Thanks, me blind :)
Stojke StojkeUnreal
You must be logged in to post a response.