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

Northstar don't use the texture of materials #22

Open
Flamaros opened this issue Mar 7, 2021 · 3 comments
Open

Northstar don't use the texture of materials #22

Flamaros opened this issue Mar 7, 2021 · 3 comments

Comments

@Flamaros
Copy link

Flamaros commented Mar 7, 2021

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
Copy link

bsavery commented Mar 8, 2021

Do you see the same with tiff or png textures?

@Flamaros
Copy link
Author

Flamaros commented Mar 9, 2021

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
Copy link
Collaborator

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

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

3 participants