Jump to content

How do I add a shader effect to the camera?


Yue
 Share

Go to solution Solved by Josh,

Recommended Posts

The idea is that when my character runs out of energy add a grayscale shader. In the editor I know how but I need through scripts. I appreciate an example, because what I have doesn't work for me. 

 

function Script:Start()
    local shader = Shader:Load("Shaders/PostProcess/grayscale.shader")
     self.entity:AddPostEffect(shader )
end

 

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

I don't think you can remove individual shaders.  You have to remove all of them and add back the ones you still want.  Related to this, remember that you can add the same shader more than once so removing them by name would not make sense.  I guess removing them by an index could work but it's not too bad to clear all and re-add.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...