GPUOpen-LibrariesAndSDKs / RadeonProRenderSDK

AMD Radeon™ ProRender is a powerful physically-based path traced rendering engine that enables creative professionals to produce stunningly photorealistic images.
https://gpuopen.com/radeon-prorender-suite/
Other
220 stars 46 forks source link

Northstar don't use the texture of materials #22

Open Flamaros opened 3 years ago

Flamaros commented 3 years ago

When I use the hybrid backend to render the matbal of the 63_tutorial I got rusted textures correctly used, but when I render the same scene with the northstar backend texture aren't displayed on the matbal.

        CHECK(rprContextCreateImageFromFile(g_context, "../resources/renderer/textures/amd.png", &uberMat3_img));

        rpr_material_node uberMat3_imgTexture = nullptr;
        CHECK(rprMaterialSystemCreateNode(g_matsys, RPR_MATERIAL_NODE_IMAGE_TEXTURE, &uberMat3_imgTexture));
        CHECK(rprMaterialNodeSetInputImageDataByKey(uberMat3_imgTexture, RPR_MATERIAL_INPUT_DATA, uberMat3_img));

        rpr_material_node uberMat3 = nullptr;
        CHECK(rprMaterialSystemCreateNode(g_matsys, RPR_MATERIAL_NODE_UBERV2, &uberMat3));
        CHECK(rprMaterialNodeSetInputNByKey(uberMat3, RPR_MATERIAL_INPUT_UBER_DIFFUSE_COLOR, uberMat3_imgTexture));

        CHECK(rprShapeSetMaterial(planeShape, uberMat3));

        //
        // Create a new Uber material for the orb model.
        //

        rpr_image uberMat2_img1 = nullptr;
        CHECK(rprContextCreateImageFromFile(g_context, "../resources/renderer/textures/lead_rusted_Base_Color.jpg", &uberMat2_img1));
        rpr_image uberMat2_img2 = nullptr;
        CHECK(rprContextCreateImageFromFile(g_context, "../resources/renderer/textures/lead_rusted_Normal.jpg", &uberMat2_img2));

        rpr_material_node uberMat2_imgTexture1 = nullptr;
        CHECK(rprMaterialSystemCreateNode(g_matsys, RPR_MATERIAL_NODE_IMAGE_TEXTURE, &uberMat2_imgTexture1));
        CHECK(rprMaterialNodeSetInputImageDataByKey(uberMat2_imgTexture1, RPR_MATERIAL_INPUT_DATA, uberMat2_img1));
        rpr_material_node uberMat2_imgTexture2 = nullptr;
        CHECK(rprMaterialSystemCreateNode(g_matsys, RPR_MATERIAL_NODE_IMAGE_TEXTURE, &uberMat2_imgTexture2));
        CHECK(rprMaterialNodeSetInputImageDataByKey(uberMat2_imgTexture2, RPR_MATERIAL_INPUT_DATA, uberMat2_img2));

        rpr_material_node uberMat2 = nullptr;
        CHECK(rprMaterialSystemCreateNode(g_matsys, RPR_MATERIAL_NODE_UBERV2, &uberMat2));

        CHECK(rprMaterialNodeSetInputNByKey(uberMat2, RPR_MATERIAL_INPUT_UBER_DIFFUSE_COLOR, uberMat2_imgTexture1));
        CHECK(rprMaterialNodeSetInputNByKey(uberMat2, RPR_MATERIAL_INPUT_UBER_DIFFUSE_NORMAL, uberMat2_imgTexture2));
        CHECK(rprMaterialNodeSetInputFByKey(uberMat2, RPR_MATERIAL_INPUT_UBER_DIFFUSE_WEIGHT, 1, 1, 1, 1));

        CHECK(rprMaterialNodeSetInputFByKey(uberMat2, RPR_MATERIAL_INPUT_UBER_REFLECTION_COLOR, 1, 1, 1, 1));
        CHECK(rprMaterialNodeSetInputFByKey(uberMat2, RPR_MATERIAL_INPUT_UBER_REFLECTION_WEIGHT, 1, 1, 1, 1));
        CHECK(rprMaterialNodeSetInputFByKey(uberMat2, RPR_MATERIAL_INPUT_UBER_REFLECTION_ROUGHNESS, 0, 0, 0, 0));
        CHECK(rprMaterialNodeSetInputFByKey(uberMat2, RPR_MATERIAL_INPUT_UBER_REFLECTION_ANISOTROPY, 0, 0, 0, 0));
        CHECK(rprMaterialNodeSetInputFByKey(uberMat2, RPR_MATERIAL_INPUT_UBER_REFLECTION_ANISOTROPY_ROTATION, 0, 0, 0, 0));
        CHECK(rprMaterialNodeSetInputUByKey(uberMat2, RPR_MATERIAL_INPUT_UBER_REFLECTION_MODE, RPR_UBER_MATERIAL_IOR_MODE_METALNESS));
        CHECK(rprMaterialNodeSetInputFByKey(uberMat2, RPR_MATERIAL_INPUT_UBER_REFLECTION_IOR, 1.36, 1.36, 1.36, 1.36));

        // Apply this new Uber Material to the shapes
        for (const auto& iShape : matBallShape)
        {
            CHECK(rprShapeSetMaterial(iShape, uberMat2));
        }

Notice that the plane is rendered with the AMD texture with both backends.

bsavery commented 3 years ago

Do you see the same with tiff or png textures?

Flamaros commented 3 years ago

I have the same rendering with png. So I tried to comment some material properties and I found that RPR_MATERIAL_INPUT_UBER_REFLECTION_MODE is the one that remove the rendering of textures when enabled.

The main issue IMO is that the 2 backends doesn't seems to interpret weights factor in the same way.

RichardGe commented 3 years ago

I confirm that in 63_tutorial , the rendering is not the same for Hybrid and Northstar. maybe a difference due to weights, as you are suggesting. We need to investigate that