Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
1
Question by RayJr · Nov 19, 2014 at 02:19 PM · 2dspriteslightshadow

Making Sprites Darker / Shadowed?

I have a 2d game made of sprites (made of PNG files). I have no light sources, just the natural color of the sprite image files.

I would like to make everything darker evenly as the sun goes down but I don't see how I can do that. I also want to add light sources light torches that light up a small area.

Right now, I can't get any light sources to do anything in my 2d sprite world.

Thanks!

RJ

Comment
Add comment · Show 4
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 Burki_07 · Nov 19, 2014 at 02:36 PM 0
Share

if you slide the color property towards black in the sprite renderer, The sprite should get dark I think. Have you Tried it?

avatar image RayJr · Nov 19, 2014 at 02:43 PM 0
Share

Hi, yeah I tried that, but i can only set the red green blue alpha settings. technically I can make it darker using this, but the shade changes a little. there is no slider to make it lighter or darker while staying on the same shade - such as they have in photoshop, or even $$anonymous$$S Paint.

alt text

untitled.png (35.0 kB)
avatar image spiceboy9994 · Nov 19, 2014 at 03:00 PM 0
Share

But that color editor has an alfa channel, doesn't it?. Have you tried select the black color rgb(0, 0, 0) and just move the alpha to reflect opacity?.

avatar image RayJr · Nov 19, 2014 at 03:05 PM 0
Share

Wouldn't that create a semi-transparent all black silouette of my sprite?

1 Reply

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

Answer by RayJr · Feb 06, 2015 at 04:21 PM

For future readers - I solved this and it's pretty simple.

Any sprite you load into Unity has RGB values of 1,1,1, which technically is white. But for a png sprite for example, 1,1,1 translates to displaying the sprite the way it was imported.

So to change that, you simply need to adjust the RBG values EQUALLY between 0 and 1 - not the normal 0 to 255 that we have in other programs.

To make a sprite black, set RGB to 0f,0f,0f. To make a sprite slightly shadded, Set RGB to 0.8f,0.8f,0.8f To make a sprite almost black, set RGB to 0.2f,0.2f,0.2f

You get the idea. When you do it this way, the multi-colored sprite will evenly change to darker shades. All numbers between 0 and 1 will work but they have to be equal across all three RGB values, otherwise you will change the hue.

Good luck!

Comment
Add comment · Show 2 · 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
avatar image Pnvanol · May 22, 2016 at 02:15 PM 0
Share

Thank you this just helped me solve a similar problem

avatar image Ayoub007 · Jun 14, 2020 at 12:42 PM 0
Share

thank you :)

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

30 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

Related Questions

Casting sharp 2D shadows side on 0 Answers

Point light shadows broken? 0 Answers

Get sprites from a Texture2D 1 Answer

Shader Sprite/diffuse add shadow on spotlight 0 Answers

1px Gap Between 2D Sprites 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