# unity – Geometry shader vertex position to point at camera

I have a shader that takes an array of points. At each point, a geometry shader creates a quad oriented towards the camera.

This works fine when the camera and point are at around the same Y value, however, looking up/down upon the billboard results in it shrinking to a point the closer the camera approaches being directly above/below.

``````(maxvertexcount(4))
void geom(point v2g IN(1), inout TriangleStream<g2f> triStream) {
// Calculate some vectors
float3 up = float3(0, 1, 0);
float3 look = _WorldSpaceCameraPos - IN(0).position;
look = normalize(look);
float3 right = cross(up, look);

// And how far off-centre our corners are
float halfS = 0.5f * IN(0).colorScale(1) * _Scale;

// Calculate verts
float4 v(4);
v(0) = UnityObjectToClipPos(IN(0).position + float4(+halfS * right - halfS * up, 1.0f));
v(1) = UnityObjectToClipPos(IN(0).position + float4(+halfS * right + halfS * up, 1.0f));
v(2) = UnityObjectToClipPos(IN(0).position + float4(-halfS * right - halfS * up, 1.0f));
v(3) = UnityObjectToClipPos(IN(0).position + float4(-halfS * right + halfS * up, 1.0f));

// pass through color texture lookup
float2 color = float2(IN(0).colorScale(0), .5);

// Start pushing verts
g2f o;
o.position = v(0);
o.color = color;
o.uv = float2(1.0f, 0.0f);
triStream.Append(o);

...
``````

I’m guessing my issue is related to the fact that my `up` and `look` are approaching coincidence, as the forward derives directly from the camera and the up is in world space, however, I’m uncertain of my diagnosis and unclear on how to generate an appropriately rotated `up`?