- Home /
Uneven mesh yet heights are all equal to one.
I have a mesh that has been normalised by unity. I am trying to write a shader that applies different textures at different heights but because of it being normalised when I import the object all the heights within the mesh appear to be equal to one? Is there any way I can not have unity normalise my mesh when I import it or even if it is normalised still be able to differiate between the different heights. The mesh I am importing is a .Obj file. Also I don't want to apply the texture in a 3D modelling tool and reimport it.
Code:-
void surf(Input IN, inout SurfaceOutput o) {
if(IN.vertexHeight > -1.0 && IN.vertexHeight < 2)
o.Albedo = tex2D (_WaterTex, IN.uv_WaterTex).rgb;
if(IN.vertexHeight > -2.0 && IN.vertexHeight < 4.0)
o.Albedo = tex2D (_SandTex, IN.uv_SandTex).rgb;
if(IN.vertexHeight > 4.0 && IN.vertexHeight < 6.0)
o.Albedo = tex2D (_GrassTex, IN.uv_GrassTex).rgb;
}
Thanks
Also I am using a surface shader, should I perhaps use a vertex shader?
Your answer
Follow this Question
Related Questions
How do change the material on ONE object, not all of them? 1 Answer
Creating a point cloud engine using shaders/meshes 0 Answers
Cancel out mesh alpha 1 Answer
how to shade a mesh created in unity 2 Answers
What are normals? 1 Answer