Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 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
3
Question by Creat0r · Sep 22, 2013 at 06:37 PM · colorgrass

Why does the grass change color by default?

Why does the grass change color by default whithout script attaching? How can I change it?

Comment
Add comment
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

5 Replies

· Add your reply
  • Sort: 
avatar image
12

Answer by WillNelson · Mar 14, 2015 at 01:51 AM

This was a big problem for me for a long time. This behavior is years old and undocumented. (Very frustrating.) After quite a bit of experimentation and guessing at what Unity does internally, I discovered something that works well for me: under the main terrain settings, set "Grass Tint" to a 50% gray value (r=g=b=128).

A little more information: The grass color seems to slowly oscillate between (a) the dry/healthy colors you explicitly set in the grass texture and (b) another color controlled by the Grass Tint color that's derived from the dry/healthy colors. I'll call the first color the "Base Color" and the second the "Derived Color". The Grass Tint color seems to affect the Derived Color independently on the three color channels (red, green, blue). If Grass Tint Red=255, then the Derived Color red is a brighter red than in the Base Color you set in the dry/healthy colors. If Grass Tint Red = 0, the Derived Color red is 0 (black). At Grass Tint Red = 128, the Derived Color red seems to be very close to the Base Color Red. Same with the other channels.

If this was helpful to you, please up vote. I hate having to wait for a moderator to approve my questions!

Comment
Add comment · Show 3 · 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 plindgren · May 05, 2016 at 02:47 PM 0
Share

I want to add that i had to restart Unity for this to take effect, Otherwise this worked.

This was on 5.3

avatar image Treegemmer · May 02, 2019 at 07:27 PM 0
Share

I found that no matter what I did, setting my tint at 50% just made my grass too dark. See giucapan's answer below.

avatar image dynamicvoltagegames · Apr 14, 2020 at 10:16 PM 1
Share

This doesn't fix anything. The issue is that wins causes the grass to change colors. Setting 50% grey on all 3 tint parameters does NOT fix this. The only way to fix it is to completely turn grass wind off

avatar image
4

Answer by giucapan · Jan 11, 2017 at 01:31 PM

I solved the problem:

  • Go to ../Unity/Editor/Data/CGIncludes and copy TerrainEngine.cginc into your Unity Project.

  • Open it with Mono or Visual and go to Line: 120

  • change return fixed4(2 * waveColor * color.rgb, color.a); to return fixed4(color.rgb, color.a);

This fixed it for me. I hope it will fix your problem aswell.

Comment
Add comment · Show 9 · 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 Hellium · Jan 11, 2017 at 01:40 PM 1
Share

The change you have provided is the exact same thing as the original

avatar image giucapan Hellium · Jan 11, 2017 at 01:41 PM 0
Share

thx :). Fixed

avatar image tanoshimi Hellium · Jan 11, 2017 at 01:42 PM 0
Share

I think

 return color;

is probably what was meant.

avatar image malkere · Feb 09, 2017 at 01:51 PM 0
Share

helped me out, thanks!

avatar image Treegemmer · May 02, 2019 at 07:24 PM 0
Share

Yes! Thanks for this! I found my grass was too dark unless I left the 2*:

 return fixed4(2 * color.rbg, color.a);

Also you can also change this line ins$$anonymous$$d:

 fixed3 waveColor = lerp (fixed3(0.5,0.5,0.5), _WavingTint.rgb, fixed3(lighting,lighting,lighting));

to something like this to have a more subtle effect that doesn't go so dark.

 fixed3 waveColor = lerp (fixed3(0.8,0.8,0.8), _WavingTint.rgb, fixed3(lighting,lighting,lighting));



avatar image GeorgeRobson · Apr 17, 2020 at 02:56 PM 1
Share

If youre using URP, go to this folder "yourUnityProjectFolder"\Library\PackageCache\com.unity.render-pipelines.universal@7.1.8\Shaders\Terrain and open WavingGrassInput.hlsl in $$anonymous$$ono or Visual and go to line: 98 and change

 return half4(2 * waveColor * color.rgb, color.a); 

to

 return half4(2 *  _WavingTint.rgb * color.rgb, color.a);

Cheers for wasting my time unity

avatar image M_R_M GeorgeRobson · Jul 15, 2020 at 07:22 AM 0
Share

This did the trick for me, thank you very much! This probably saved me hours of work and who knows how much frustration.

What a ridiculous problem to have in the first place. If we wanted grass to change colors we would fricking tell it to.

avatar image ODINKONG · Nov 10, 2020 at 09:49 PM 0
Share

I think I might be missing a step here. Changing this script seems to have no effect on anything, Even if I do something that would break the compiler it still compiles my project, Is there somewhere specific I should put the TerrainEngine.cginc file inside my project, I'm using unity 2019.4

avatar image Vincent13122 ODINKONG · 18 hours ago 0
Share

I had the same problem. For some reason you can't replace gcinc files globally and a shader will always use a gcinc file thats in the same folder.

What I did was I copied the grass shader from the Builtin Shader archive https://unity3d.com/de/get-unity/download/archive in DefaultResourcesExtra/TerrainShaders/Details and then whichever you're using (WavingGrass.shader or WavingGrassBillboard.shader) and put them inside the same folder (In my case a Shader folder inside my Assets folder) where the new and modified TerrainEngine.cginc is.

Then you might have to right-click reimport on the new grass shader or restart Unity and it should work.

avatar image
2

Answer by TheKusabi · Sep 22, 2013 at 06:53 PM

Explain. When does it change color? How often? What colors?

A stab in the dark would be: try turning billboard distance up way high. Maybe the billboards are messed up.

Comment
Add comment · Show 3 · 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 Creat0r · Sep 23, 2013 at 11:04 AM 1
Share

It changes color when I press "play" button. One cycle takes about 12 seconds. From dark green to yellow-green. I have decreased "billboard start" parameter to it's $$anonymous$$ value - 5, but it has not brought a result.

avatar image Creat0r · Sep 23, 2013 at 11:26 AM 0
Share

Here are a few parameters that can influence this: alt text

And look at the second picture. alt text It is very strange to me that section Wind Settings has the Grass Tint parameter.

edit grass texture.png (18.5 kB)
terrain settings - wind settings.png (14.8 kB)
avatar image NoiseFloorDev · Aug 22, 2017 at 08:22 AM 0
Share

"Explain." isn't an answer, it's just rude.

avatar image
2

Answer by Xydez · Nov 05, 2016 at 09:42 PM

I figured this out for y'all, Here's the solution for you who didn't understand WillNelson's comment' First go to the settings menu in the terrain and find the grass tint in the wind settings. Then set your values to a 50% grey color or set the hex to 808080FF Follow the images EXACTLY or it will look wrong. !alt text

Or this alt text

Well that's about it i guess, approve this answer so this mess gets solved. cya


3.png (16.8 kB)
2.png (56.6 kB)
Comment
Add comment · Show 3 · 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 M_R_M · Jul 16, 2020 at 07:11 AM 0
Share

This doesn't solve anything except keeping the original color value of the grass. The grass still changes colors.

avatar image Dawdlebird · Jul 16, 2021 at 03:03 PM 0
Share

@M_R_M & @dynamicvoltagegames : did you guys actually read the comment properly? He's not talking about the color attributes for the detail mesh/texture; he's talking about the "grass tint" property under "wind settings for grass" which is a terrain property, found under the terrain settings.

Here is the code for how that tint (WavingTint.rgb) is treated in the shader:

 fixed3 waveColor = lerp (fixed3(0.5,0.5,0.5), _WavingTint.rgb, lighting);
 return fixed4(2 * waveColor * color.rgb, color.a);

Color.rgb is whatever color you've assigned to the grass yourselves. And notice the "2 * waveColor" part in there? Guess what happens if you multiply grey (0.5) with 2? Yes, you get 1. What is 1 times color.rgb? Exactly: still color.rgb. Not lighter, not darker, just 1 times color.rgb.

The only downside of setting this to 0.5 is that all these calculations still get done, so if you want this feature disabled, best to just copy the TerrainEngine.cginc like mentioned above and remove the wavecolor variable alltogether. Just have "return color.rgba" at the end there.

Go ahead and try again.

avatar image Dawdlebird Dawdlebird · Aug 01, 2021 at 03:25 PM 0
Share

For those that find that setting this tint to 0.5 doesn't solve things: check what color space you're using. If set to Gamma, 0.5 would do the trick. If set to linear, you need a higher value, somewhere near 0.7 (not sure what exactly, but there is formulas out there you can google)

avatar image
-1

Answer by dynamicvoltagegames · Dec 11, 2020 at 11:05 PM

STOP SAYING SET THE GRASS TINT TO 50% IT DOESNT WORK

The grass is going to change colors no matter what. Its a garbage feature that you can NOT stop from happening.

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

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

grass animation changing color 2 Answers

Material doesn't have a color property '_Color' 4 Answers

Changing two different objects renderer colour 1 Answer

Changing the color/look of a grass textures/grass. Making it look clean. 0 Answers

Hot to create the yard lines on a football field? 1 Answer


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