Skip to content

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

@HanetakaChou

Description

@HanetakaChou

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions