Ebil
May 13, 2013, 6:06pm
1
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.
look here :Unity - Scripting API: Material
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