Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It seems we forget to transform the object space normal or tangent to world space for SPIRV version #30

Open
HanetakaChou opened this issue Nov 19, 2024 · 0 comments

Comments

@HanetakaChou
Copy link

The following code is from ps_main of RasterizedGBuffer.hlsl

#ifdef SPIRV
    GeometrySample gs = (GeometrySample)0;
    gs.instance = t_InstanceData[g_Instance.instance];
    gs.geometry = t_GeometryData[gs.instance.firstGeometryIndex + g_Instance.geometryIndex];
    gs.material = t_MaterialConstants[gs.geometry.materialIndex];

    gs.texcoord = i_texcoord;
    gs.objectSpacePosition = i_objectPos;
    gs.prevObjectSpacePosition = i_prevObjectPos;
    gs.geometryNormal = normalize(i_normal);
    gs.tangent.xyz = normalize(i_tangent.xyz);
    gs.tangent.w = i_tangent.w;
#else
    GeometrySample gs = getGeometryFromHit(g_Instance.instance, g_Instance.geometryIndex, i_primitiveID, i_bary.yz,
        GeomAttr_All, t_InstanceData, t_GeometryData, t_MaterialConstants);
#endif

Within the getGeometryFromHit, we transform the normal and tangent from object space to world space. But for SPIRV version, we keep using the object space normal and tangent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant