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 EarlyFeelings · Jul 26, 2019 at 08:09 AM · shaderspriteshaderssprites

Grass shader sprite 2D

Hello community, I've been searching for quite some time and I can't seem to find an answer.

What I want: Shader for grass wind/sway for a sprite in 2D game. Shaders are not easy to start with so I'm looking for a written script. All I've found renders my sprite completely black.

Any idea how to fix it?

Example: https://gist.github.com/jaycelq/a137666f95e2abe3e713730ec21953f3 I understand that this is a surface shader and it works with lighting which sprites don't have.

Any ideas how to achieves this windy effect? Thanks!

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 EarlyFeelings · Jul 29, 2019 at 11:34 AM 0
Share

EDIT: I solved the problem by going to Window > Rendering > Lighting Settings and setting Ambient Color to white.

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by rufopufo · Jul 26, 2019 at 08:46 AM

Hi there,

Have you consider making an animation for the windy effect on the grass? This is not as complex as the shader, and personally I think it gives a pretty decent effect.

If you want to change the speed of the wind, you can just change the speed of the animation, and it could be dynamic with random wind zones.

I think that for 2D is the best way to go. Simple animations. You can do two or three, for right wind, left wind or even wind going straight down. And as I said, playing around with the animation's speed, will get really nice effects, as if wind was real.

Hope it helps.

Comment
Add comment · Show 1 · 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 EarlyFeelings · Jul 26, 2019 at 09:09 AM 0
Share

Hi, thanks for suggestions. I did. The thing is that I will have a bunch of different sprites that should have this animation throughout the game. This shader would be an universal solution as I would just put it on the sprite. This method you're suggesting can it be one "universal" animation that could be assigned to all sprites or it would need to be created manually for each sprite? The last thing is performace - but here I have no idea, aren't animations more heavy?

avatar image
0

Answer by Fred-Koa · Jul 29, 2019 at 01:46 AM

https://unity3d.com/get-unity/download/archive In the drop-down buttons you can download the built-in shaders. The grass shaders are in DefaultResourcesExtra/TerrainShaders/Details/. Just modify one of them and put it anywhere in your project without changing its name. You can also find these shaders on github: https://github.com/TwoTailsGames/Unity-Built-in-Shaders

Comment
Add comment · Show 1 · 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 EarlyFeelings · Jul 29, 2019 at 08:41 AM 0
Share

Hi, thanks for the links. Interesting that there's a grass shader created directly by Unity but I didn't find it when I was searching for these shaders. What do you mean by "modify" ? This shader doesn't render my sprite at all. With a current understanding of how shaders works I'm not able to make big changes at this moment.

avatar image
0

Answer by DawidNorasDev · Jul 26, 2019 at 11:24 AM

What I've done in my game: (see the short video) https://www.hedgehogsoft.com/spring-is-in-the-air/ It's a simple sprite shader with vertex offsets which are greater, further you are from pivot point.

You can achieve this effect by following Brackeys tutorial: https://www.youtube.com/watch?v=L_Bzcw9tqTc It's in SRP, but the concept stays the same.

Good luck!

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

215 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 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 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

Skew a sprite at runtime while preserving the pixel shape? 1 Answer

Are shaders more efficient than manual pixel replacement? 0 Answers

Shader on 3D model not seen over 2D sprites 0 Answers

Allow 2D sprite to receive light from any direction and show on both sides 0 Answers

Shaders - offset texture coordinates by a single pixel 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