Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Cereal_Killa · Feb 05, 2017 at 03:39 AM · shadershadersunity5cel shadingcellshading

How to clamp lighting values for cel-shading post 5.5?

Previously one could just clamp ndotl to different values in a surface shader but as of unity 5.5 ndotl is updated on the fly and the only way to make these adjustments is to modify the standard shader in the cginc files.

I've followed this tutorial: http://gamedev.stackexchange.com/questions/117747/unity-ignoring-the-deferred-shader

But unfortunately it is not working for me (I also corrected past of the code in the gamedev answer - it was missing a closing parenthesis - which leads me to believe the solution proposed hasn't actually been tested).

I also tried downloading: https://gist.github.com/xDavidLeon/38b392700fbec56162ba But this does not seem to work either.

I emailed David and will update if I get a response. In the meantime, does anyone else know how I could get the desired celshading effect?

Ideally I would like 3 shades based on light distance. So up close would be 100%, 50%, 0% and further away would be 50%, 25%, 0% etc.

Excluding shader code the only way I can think to do this is by adjusting the normals of every object to represent a truncated pyramid/cone (they are all flat sprites so this may be the simplest option). This would give an effect similar to rimlighting but only from a designated angle. This would look ok for stationary lights but moving lights that bypass the characters would look strange and players would quickly identify the structure as the rimlight will always be a fixed size.

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 Namey5 · Feb 05, 2017 at 05:01 AM 0
Share

If you are using sprites, is it fully necessary to use the Standard shader? The way I would do it would be to use a custom lighting function similar to that of the Standard shader and modify the lighting in there. If not, what you could always do is follow the tutorial normally and make the changes in the .cginc files. If you don't want to override these files for the whole engine, you can copy them into your project's assets and rename both the file and its reference in the shader.

0 Replies

· Add your reply
  • Sort: 

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

98 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Custom cel shaded Unity shader not casting shadows 1 Answer

Single tone shadows in forward rendering 0 Answers

Weird lighting with cel shader 1 Answer

Build a temporal (unshared) data structure inside a compute shader 0 Answers

Shader error: incorrect number of arguments to numeric-type constructor 2 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