Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Ebil · May 13, 2013 at 06:06 PM · texturematerialproceduraltessellation

Change Material settings through script

Hello

I procdurally generate a tessellation material

 p.renderer.material = new Material(Shader.Find("Tessellation/Bumped Specular (displacement)"));
 p.renderer.material.mainTexture = heightMap;
 p.renderer.material.SetTexture("_ParallaxMap",heightMap);
 p.renderer.material.SetTexture("_BumpMap",heightMap);

And now I want to change the height and edge length of the tessellation shader/material. How do I do that with a script? I cant find any function for that.

Comment
Add comment · Show 2
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 Fornoreason1000 · May 13, 2013 at 06:14 PM 0
Share

if that's code do you $$anonymous$$ formatting it?

avatar image Ebil · May 13, 2013 at 06:15 PM 0
Share

Edited. Sorry thought I did it already. But the code is not really importent for a solution.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Fornoreason1000 · May 13, 2013 at 06:18 PM

look here :http://docs.unity3d.com/Documentation/ScriptReference/Material.html

there are a set of get functions you can use. I'm assuming you length are height are float so you will use the Material.GetFloat

so:

 render.material.GetFloat("Height")
 render.material.GetFloat("EdgeLength")
 


if your setting parameters you will use the Material.SetFloat so it would be

 render.material.SetFloat("Height", 0.1234f)
 render.material.SetFloat("EdgeLength", 70000f)


you can do this for vector hope it helps

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 Ebil · May 13, 2013 at 06:22 PM 0
Share

Just found it dont know if your code is working, I found it by looking into the tes shader

 p.renderer.material.SetFloat("_Parallax",0f);
 p.renderer.material.SetFloat("_EdgeLength",0f);

Could come have earlier on that idea... thanks anyway :)

//Edit Just saw your EdgeLength 70000f. The max value I found is 50f so dont know where you get the 70000 ^^

avatar image Fornoreason1000 · May 21, 2013 at 07:56 AM 0
Share

Edit Just saw your EdgeLength 70000f. The max value I found is 50f so dont know where you get the 70000

its random.... its just an example my friend

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

15 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

Related Questions

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

How to make an objects texture what a camera is seeing 2 Answers

Loop through textures every half second 2 Answers

How to load and render a sprite in script? 1 Answer

Select colour then change texture 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