garrysmod
garrysmod copied to clipboard
Outline system for entities (not halo)
Maybe you know that standard halo system greatly reduces FPS if called many times for example for other colors on entities, because of blur. And halo looks like glow. I make other system with better performance and looks like outline, not like glow (and still greatly visible on big distance).
Some screenshots:
I believe 28 fps is gone when drawing models to fill stencil buffer.
Thanks for all the changes, I think this will now be much more efficient than halos. The code style does still need some cleaning up, though: it doesn't match the rest of the codebase. There should be spaces around operators (local List, ListSize = {}, 0
), logical operators should use the C versions ([MODE] = mode || OUTLINE_MODE_BOTH
), and there should be spaces between parentheses and arguments (render.SetStencilPassOperation( STENCIL_REPLACE )
).
How about just adding the PostDrawEffects
hook for the outline drawing if ListSize ~= 0
? This should reduce the number of hooks called. This would just be possible if there is a option to cache the ents instead of adding them every frame. Like I did here. https://github.com/TTT-2/TTT2/blob/master/lua/includes/modules/marks.lua
@Alf21 I don't think that's a good idea. Many hook library replacements put a huge load on hook.Add in order to make hook.Call faster. Calling one extra function and doing a length check is really not going to have any noticeable difference on performance.
@ShadowBonnieRUS Caching global functions/tables at the top of the file instead of using package.seeall will make a difference though.
Would like to see the FPS changes after those optimizations aswell) Compared to your original halo version of course
@UAVXP all this add 1 fps to me.
Can't relate it's significantly faster for me
The only small issue I've had since I've been using this library is the effect is even displayed through the player model (in comparison with the halo library). If players want to use this library as a replacement for better performance, this problem needs to be fixed.
Halo library:
Outline library:
the effect is even displayed through the player model
I'm personally do not think it's a much of a problem
the effect is even displayed through the player model
I personally do not think it's a much of a problem
It would still be nice if it got fixed
the effect is even displayed through the player model
I'm personally do not think it's a much of a problem
It must be fixed if this were to be merged. Better yet, make it a config option if it shows thru players.
the effect is even displayed through the player model
I'm personally do not think it's a much of a problem
It must be fixed if this were to be merged. Better yet, make it a config option if it shows thru players.
The problem is that used IsLineOfSightClear instead of checking the depth buffer. It does not care about where render origin is. I used IsLineOfSightClear because of problems with the depth buffer when I tried to do this first time. I will try again make this with the depth fuffer.
So now it looks like this. Front canister (red) uses OUTLINE_MODE_VISIBLE mode. Other canister (cyan) uses OUTLINE_MODE_NOTVISIBLE mode.
I can't seem to get the outlines to draw for some transparent props. For example:
models/props_building_details/Storefront_Template001a_Bars.mdl
models/props_junk/PlasticCrate01a.mdl
I can't seem to get the outlines to draw for some transparent props. For example:
models/props_building_details/Storefront_Template001a_Bars.mdl
models/props_junk/PlasticCrate01a.mdl
Should be fixed. Seems render.SetBlend (0)
has a bad effect on the depth buffer when rendering transparent objects.
is this going anywhere? the current halo system is just absolutely awful for performance
You can just include this library in your code for now, I have never had a problem in more than a year of use.
Could be a performance option
New to E2, but looking for a way to do this but on MY playermodel to where everyone else can see it too. I've seen other people using one that does a color changing outline on them if anyone knows where something like that is at, because I am too awful to know how.
'Broken' as of the most recent gmod update After using the outline.Add on an entity, the physgun halo effects can be seen through walls https://media.discordapp.net/attachments/589120351238225940/1125558175316312124/image.png
Rubat is inclined to believe it was one of these highlighted changes https://media.discordapp.net/attachments/589120351238225940/1125557605398482974/image.png
Edit: apparently it was caused by render.ClearDepth()
Thickness cannot be changed to be per-outline, because of how the end outline is applied (drawing colored texture with specified offsets, 'thickness' will just increase the offsets). Maybe thickness functionality is unnecessary at all?
For render type, "SetupOutlines" should be called for each render type with parameter indicating the current render type, at the moment, 3 times per frame. It may affect performance. Or use different hook event names for each type.
I'm not sure how it would be more correct to implement this in the halo library, since on the one hand, they do the same thing, and on the other hand, they work differently.
Why was this closed?
Clearly there's an impasse in how I would expect (and I am going to assume everyone else as well) this to work, and how it actually works, in regards to the library's global settings. Given authors inability/unwillingness to conform to requested changes, I see no reason to keep this open. It will not be merged in its current state.