Download

Static mesh position changed with camera rotation on low-end android devices?

Hi friends: currently I’ve hard coded a spherical mesh in c++, and call DrawIndexedPrimitiveUP to draw in in Mobile rendering pipeline, just like any other post-processing, eventually it is a spherical mesh around camera so I can make some screen space effect.

however, I found abnormal effect on low-end android devices(direct draw to the back buffer, do not use HDR render texture), so I finally find out the input position of vertex shader is changing when I rotate my camera, this is hard to believe because the mesh is hard coded like this:

  1. VBuf = { FVector(0.00000000f,0.00000000f,100.00000000f),
  2. FVector(-5.49760000f,1.78620000f,99.83279000f),FVector(-3.39760000f,-4.67650000f,99.83279000f),FVector(0.00000000f,5.7…

In order to debug it, I set the position of this sphere be a fixed offset next to the camera in vertex shader:

  1. Output.Position = mul(float4(InPosition + ViewLocation + float3(-200, -200, 200), 1.0f), Unity_VP);

the uniform variables are matrices like below:

  1. SetShaderValue(RHICmdList, GetVertexShader(), Unity_VP, View->ViewMatrices.GetViewProjectionMatrix());
  2. SetShaderValue(RHICmdList, GetVertexShader(), ViewLocation, View->ViewMatrices.GetViewOrigin());

shockingly, on PC platform and high-end android devices(using HDR rendering pipeline), the sphere is always at float3(-200, -200, 200) offset next to the camera:

however, on low-end mobile devices(direct darw to back buffer), the sphere is moving when I rotate my camera !!! it seems that the InPosition (vertex shader input) is changing, I really don’t know why, it looks like there’s a ghost in my code.