func_illusionary and clipnodes

Posted 7 months ago2023-12-14 20:04:06 UTC
It has been a while since my last journal. I've mostly just been busy with work and being exhausted and had all my project on hold except for my part in this year's Ragemap (a mapping collab for Sven Co-op).

I brought up the fact that func_illusionary will produce cliphulls came up earlier today when helping Sassy Boy with advice on reducing clipnodes, which came as a surprise to some. Understandable, it's always non-solid so why would func_illusionary need cliphulls for in the first place? I thought a journal might be a tidier format for talking about this.
So the thing is, the CSG compiler that comes with the HL SDK makes no classname checks, it's pretty much entity-agnostic in this regard. So the compiler generates clipnodes on all HULLs for func_illusionary just as it does for any other brush entity. It doesn't become non-solid until it's spawned in-game and the game code gives it pev->solid = SOLID_NOT.

Big waste of clipnodes if you ask me.
Surely those who've worked on ZHLT and VHLT would have thought about this too and made sure to skip cliphull generation for func_illusionary. I opened up the source code for VHLT v34 and searched for "func_illusionary" and just as I expected I found a conditional checking for that classname and flagging those entities as "noclip" (which will make them skip cliphull generation). Though then I remembered I had this habit of adding zhlt_noclip 1 to func_illusionary in my FGDs, and I was pretty sure that even in VHLT the entity will still have cliphulls generated by default.

What better way to check than testing it?
So I set up a basic room. That's 6 faces with a clipnode each, times the 3 clipping HULLs, for a total of 18 clipnodes for the room itself.
A box is created and tied to func_illusionary. 6 faces on that one as well, so we can expect an additional 18 clipnodes if the generation isn't skipped. Run compile, and...
User posted image
We have 36 clipnodes total, what we expected if func_illusionary's cliphull were generated after all.
Doing another test with zhlt_noclip 1 on the func_illusionary, and without the entity at all, as controls we get the total of 18 clipnodes we expected to see if it was skipped.

So this confirms that func_illusionary does produce clipnodes in both the HL SDK CSG and VHLT v34's CSG.
But why?

Unfortunately I do not have that answer yet, but I'm curious about finding that out and so I started looking into it today.
I tested the conditional in VHLT's CSG where it checks the classname in isolation and it worked, so that can be ruled out.

I'll be sure to update this journal if I find out more, and if anyone reading this happens to know anything about it, please let me know!

Oxofemple brought to my attention that the -clipeconomy must be on to skip generating cliphulls for func_illusionary (and similar entities).
This was strange to me as I was sure it should be on by default, which used to be the case for ZHLT. Solokiller helped me confirm that the flag was changed to be off by default for whatever reason somewhere early in the VHLT branch.

So to sum it up it's not a bug but rather a change in default behaviour from earlier versions.


Commented 6 months ago2023-12-16 10:11:06 UTC Comment #105739
Where did hull 0 go? Aren't there four hulls? 0 is point hull, 1 is standing hull, 2 is big monsters, 3 is crouching. I don't get why the amount of clipnodes is 18/36 instead of 24/48.
Commented 6 months ago2023-12-16 14:50:49 UTC Comment #105749
HULL0 doesn't use clipnodes. It's pretty much just the BSP model(s).
Commented 6 months ago2023-12-17 09:23:18 UTC Comment #105756
Thanks for the journal, this helped me. Keep the good work and effort man!
Commented 6 months ago2023-12-26 17:30:41 UTC Comment #105798
I have my own version of func_detail, had it for a long time now. It's basically a func_wall with zhlt_noclip always set to 1, and it's set to SOLID_BSP in the entity code. This way, bullets and other objects will still collide with it. For player/npc collisions, I can just wrap it up in a far simpler CLIP brush(this bruh not being tied to the entity). This has allowed me to save a lot on clipnodes.
Commented 6 months ago2023-12-26 20:11:01 UTC Comment #105799
So it's basically a permanent pointhull-only brush entity. Neat!
Commented 6 months ago2023-12-30 16:14:55 UTC Comment #105813
Thanks for the help with this on Discord too! I was hitting the clipnode limit because I thought func_illusionary brushes didn't count to the clipnode limit. Now that I've applied the noclip flag fix, I'm still at 57.1% on my clipnode budget even as I start hitting some world and model limits :walter:
Commented 6 months ago2023-12-30 18:44:39 UTC Comment #105815
You're welcome! Just glad to help out with these things. Would be a shame if you or someone else had to do severe cuts to their map just because of wasted clipnodes :p

You must log in to post a comment. You can login or register a new account.