
[ad_1]
i am virtually utilizing this code precisely: https://docs.unity3d.com/ScriptReference/Graphics.DrawMeshInstancedOblique.html
the second shader “Instanced/InstancedShader”.
i have been making an attempt to mix it with a billboard shader instance so the instanced quads face the digicam always. however not the entire group (cloud) i nonetheless need to have the ability to rotate the digicam across the cloud.
i attempted this: (https://stackoverflow.com/questions/57204343/can-a-shader-rotate-shapes-to-face-camera).
o.pos = mul(UNITY_MATRIX_P,
mul(UNITY_MATRIX_MV, float4(0.0, 0.0, 0.0, 1.0))
+ float4(v.vertex.x, v.vertex.y, 0.0, 0.0)
* float4(knowledge.w, knowledge.w, 1.0, 1.0)
+ float4(knowledge.xyz, 0.0)
);
this appears to make the entire cloud of factors face the digicam and never simply the quads.
ive additionally tried one thing like this:
float3 ahead = normalize(ObjSpaceViewDir (v.vertex)); // or pre-normalize it in c#
float3 proper = normalize(cross(ahead, float3(0,1,0)));
float3 up = cross(proper, ahead); // doesn't have to be normalized
float3x3 rotationMatrix = float3x3(proper, up, ahead);
float3 worldPosition = mul(localPosition, rotationMatrix) + positionBuffer[instanceID];
this additionally did not work as anticipated.
[ad_2]