title: How method cross do in HLSL?
body: <p>I want to know how to determine the direction of the method cross in HLSL . I mean in OpenGL, we can use the right-hand rule to get the result and in direct3d we can use the left-hand rule .
  Here is thing , which rule do we use to get the direction of the result in HLSL ?
  
  Thanks everyone . Here is the things,these day i was working on the 3D technique , and when i do exercise with the billboarding in  , i come across a problem. In this book's chapter 12 , there is a exercise about the billboarding , and the writer give an example of vertex shader which implement the billboarding . Here is the code:</p>
  
  <pre><code>  OutputVS AABillBoardVS(
         float3 posL : POSITION0,
         float3 bbOffset : TEXCOORD0, // Offsets to world space position.
         float2 tex0: TEXCOORD1)
    {
        // Zero out our output.
        OutputVS outVS = (OutputVS)0;
  
        // Vertex world position without rotation applied to make
        // face the camera.
        float3 tempPosW = posL + bbOffset;
  
        float3 look = gEyePosW - tempPosW;
        look.y = 0.0f;  // axis-aligned, so keep look in xz-plane.
        look = normalize(look);
        float3 up    = float3(0.0f, 1.0f, 0.0f);
        float3 right = cross(up, look);
  
        // Rotate to make face the camera.
        float3x3 R;
        R[0] = right;
        R[l] = up;
        R[2] = look;
  
        // Offset to world position.
        float3 posW = mul(posL, R) + bbOffset;
  
        // Transform to homogeneous clip space.
        outVS.posH = mul(float4(posW, 1.0f), gViewProj);
  
        // Pass on texture coordinates to be interpolated in
        // rasterization.
       outVS.tex0 = tex0;
  
       // Done--return the output.
       return outVS;
  }
  </code></pre>
  
  <p>When I use the code above , it didnot work . So I checked it , and I change the computation of right vector as <strong>float3 right = cross(look, up);</strong> and the result is good . So , I didnot understand why use the look to cross the up and the result is the right vector .</p>