
[ad_1]
I create a mesh in Unity3D primarily based on some extent cloud on this means:
// The customary sequence for making a mesh
Mesh mesh = new Mesh();
Vector3[] factors = new Vector3[numPoints];
int[] indecies = new int[numPoints];
Color[] colours = new Color[numPoints];
// Fill in factors, indecies, colours
mesh.vertices = factors;
mesh.colours = colours;
mesh.SetIndices(indecies, MeshTopology.Points, 0);
I discovered that it’s attainable to set the scale of factors in PSIZE via Vertex Shader. Applied such a Shader, however with out outcome.
Shader "VertexColor"
{
Properties
{
_PointDimension("Point measurement", Float) = 5.0
}
SubShader
{
Pass
{
LOD 200
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
uniform float _PointDimension;
struct VertexEnter
{
float4 vertex: POSITION;
float4 shade: COLOR;
};
struct VertexOutput
{
float4 pos: SV_POSITION;
float4 col: COLOR;
float measurement: PSIZE;
};
VertexOutput vert(VertexEnter v)
{
VertexOutput o;
o.pos = UnityObjectToClipPos(v.vertex);
o.col = v.shade;
o.measurement = _PointDimension;
return o;
}
float4 frag(VertexOutput o) : COLOR
{
return o.col;
}
ENDCG
}
}
}
Tell me, please, set the scale of factors accurately?
[ad_2]