Update halo.lua (Returns for PreDrawHalos)#2388
Open
Akabenko wants to merge 1 commit intoFacepunch:masterfrom
Open
Update halo.lua (Returns for PreDrawHalos)#2388Akabenko wants to merge 1 commit intoFacepunch:masterfrom
Akabenko wants to merge 1 commit intoFacepunch:masterfrom
Conversation
Returning return true in the PreDrawHalos hook will avoid rendering the Halos effect and expand the use of PreDrawHalos to avoid artifacts when working with stencils. Returns 1 boolean Return true to disable Hallos effect https://wiki.facepunch.com/gmod/GM:PreDrawHalos
Collaborator
|
You should be able to use https://wiki.facepunch.com/gmod/halo.RenderedEntity for that purpose? |
Contributor
Author
Collaborator
hook.Add( "OnEntityCreated", "SSR", function( ent )
if ent:GetClass() != "lvs_wheeldrive_regal" then return end
ent.RenderOverride = function(self, flags)
if halo.RenderedEntity() == self then self:DrawModel(flags) return end
render.SetStencilEnable( true )
render.SetStencilWriteMask(0xFF)
render.SetStencilTestMask(0xFF)
render.SetStencilReferenceValue(STENCIL_SSR)
render.SetStencilCompareFunction(STENCIL_ALWAYS)
render.SetStencilPassOperation(STENCIL_REPLACE)
render.SetStencilFailOperation(STENCIL_KEEP)
render.SetStencilZFailOperation(STENCIL_KEEP)
self:DrawModel(flags)
render.SetStencilEnable( false )
end
end )Try this. The idea is that for the halo pass, you would not use any stencils and just render the model itself. |
Contributor
Author
|
But there are cases when you need to remove Halos in one of the hook.Add("PreRender", "ShadowMap", function()
bDrawShadowMap = true
-- material override, some code
render.RenderView(viewSetup)
bDrawShadowMap = false
end)
hook.Add("PreDrawHalos", "ShadowMap", function()
if bDrawShadowMap then return true end
end) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Returning return true in the PreDrawHalos hook will avoid rendering the Halos effect and expand the use of
PreDrawHalosto avoid artifacts when working with stencils.Returns
1 boolean
Return true to disable Hallos effect