Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by YK9 · Jul 21, 2015 at 08:07 AM · shadershaderspost processingpost-processing

How do you use a shader file once written?

Hello, I need to write custom post-processing shaders for Unity. I'm looking to do this using vertex and fragment shaders in CG and applying the effect over a camera's view. Once I've written a shader file, how do I actually put it to use? Most components in Unity you can simply drag and drop where ever you'd like, but I can't seem to do anything with shader files.

While looking for an answer, I've noticed in some of the imageEffects scripts that Unity has built-in that they use a shader on a material, but I'm looking to apply the shader to a camera's view, not on an object's material. Many of Unity's built-in shaders don't have a matching script, so they must be getting applied in some other manner but I haven't figured out how. The only thing I've been able to find in the documentation is applying the shader to an object's material. I'm sure there's something simple that I'm just not seeing. Does anyone have any experience with shaders in Unity that could help me out? Thank you.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image meat5000 ♦ · Jul 20, 2015 at 05:48 PM 1
Share

I think you are after Image Effects.

Basically you incorporate them through script.

Import Asset -> Effects and look at, say, Antialiasing.cs

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by tanoshimi · Jul 21, 2015 at 08:34 AM

Unity nomenclature is slightly different from that you may have used in other places:

  • A Unity "shader" is assigned to a material which, in turn is applied to one or more meshes in the scene, and determine only how those meshes are rendered. So a metallic surface might use a material with a specular shader, for example, while the hair or a character might use a material with an anisotropic shader.

  • Shaders which alter the way in which a camera renders an entire scene are called "Image Effects" (essentially they are full-screen pixel shaders). Examples might be blur, depth-of-field, or bloom, for example. They too are assigned to a material, but that material is not used in the scene - it is typically used in the Graphics.Blit method of a script that implements OnRenderImage, to intercept and change the image rendered by the camera.

For a worked example of creating an Image Effect, try http://www.alanzucconi.com/2015/07/08/screen-shaders-and-postprocessing-effects-in-unity3d/

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

What is the meaning of a vertex shader for a post-processing shader? 1 Answer

Custom Post process effect creates only a triangle on the screen. 1 Answer

HLSL Post Process Shader Fixing UV/Texcoord 1 Answer

Why doesn't this shader work when using it with as a custom effect on the post processing stack 1 Answer

Custom postprocess white in build 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges