Search the Community
Showing results for tags 'posteffect'.
-
I'm using the default grayscale posteffect shader to make everything black and white, but this doesn't affect anything drawn during Script:PostRender(context) (eg, red text is still red). Is it possible to make a shader apply after drawing takes place? Or any solution easier than manually changing the colour/textures of GUI elements - ideally more advanced shaders could also be used. This script shows my problem. You can put this script on any entity and link it to a camera, you will see everything is greyscale except the text 'Always red'. Script.Camera = nil --entity "Camera" Script.Enabled = true --bool "Enabled" function Script:Start() self.WasEnabled = -1 end function Script:_Enable() self.Camera:AddPostEffect("Shaders/PostEffects/grayscale.shader") end function Script:_Disable() self.Camera:ClearPostEffects() end function Script:UpdateWorld() if self.Enabled~=self.WasEnabled then if self.Enabled then self:_Enable() else self._Disable() end end self.WasEnabled = self.Enabled end function Script:PostRender(context) context:SetBlendMode(Blend.Solid) context:SetColor(1,0,0,1) context:DrawText("Always red", 5, 5) end EDIT: Right after posting this I found context:SetShader, it sounds like what I want. And the forum ruined my code indentation
- 4 replies
-
- posteffect
- shader
-
(and 1 more)
Tagged with: