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 /
This question was closed Sep 12, 2015 at 08:09 PM by getyour411 for the following reason:

Other / OP posted solution.

avatar image
0
Question by __mod · Aug 10, 2015 at 12:07 PM · terrainshaderscustom shader

Custom Terrain shader - shader property doesn't update realtime

I'm using a custom terrain material (Unity 5.1.2) that has shader that is based on the built-in Standard terrain shader. I have a custom property that I'm setting each frame. It seems that the value of that property is only assigned once and changing it later on has no effect. I've played around and noticed that the only way to change the property (terrain.templateMaterial.SetMatrix("myMatrix", something) ) is to set the terrain custom material to null at the beginning of the frame and re-apply the material on LateUpdate or something like that. This solves the problem but the performance drops significantly due to reassigning of the material.

Does anyone know why this is happening? I can recall that in the past (Unity 4.x) there was no such problem.

UPDATE:

Even weirder! If the properties that you're setting each frame are matrices (terrain.templateMaterial.SetMatrix(...)) then changes don't get picked. BUT, if you also set a Float (terrain.templateMaterial.SetFloat(...)) then the matrix values AND the float values start getting picked up every frame.

So to anyone who stumbles uppon this: you can fix this issue by defining some random float property in your shader and setting to some random value each frame.

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

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Terrain Tree Billboard have bright outline against dark background 6 Answers

Terrain Trees remain lit up when no light is cast 1 Answer

Is possible to rotate textures of a terrain? 3 Answers

Terrain Trees Ignore Projector 0 Answers

Blood patterns on terrain 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