Have some difficulties in export image to UE

#1

as the title tells, i want to export the pics in Sketchup to UE.
I don’t found the image concept in UE. So I try to convert an image into a face with a double-face material.
i define four corner points of the image as (0,0,0) (width,0,0) (width,height,0)(0,height,0), then attach it to the parent group with the image transform.
the transform seems to be wrong.(by the way, i test the code with two components,one is fine, the other is odd)
for some reasons,i cannot show the whole code, sorry for it. if you have question, please email me directly(yueguangxuanyuan@gmail.com)
component in SU
component in UE

su source file

0 Likes

#2

code export image from SU file.(generateImageTriangles is a function which triangulates the image shape and makes it can be used as a face)

SUImageRepRef theImageRep; theImageRep.ptr = 0;
		SUImageRepCreate(&theImageRep);
		SUImageGetImageRep(images[i],&theImageRep);
		size_t width, height;
		width = height = 0;
		SUImageRepGetPixelDimensions(theImageRep, &width, &height);
		SUImageRepRelease(&theImageRep);
		double widthd = width;
		double heightd = height;

		//get transform
		SUTransformation imageTrans{ {0} };
		SUImageGetTransform(images[i], &imageTrans);
		printTransform(imageTrans.values);
		MeshImage theImageInfo;
		theImageInfo.imageName = fileName;
		generateImageTriangles(theImageInfo.triangles, widthd,heightd);
		theImageInfo.setTransform(imageTrans.values);

code in UE to import images

UProceduralMeshComponent* meshComponent = generateMeshComponent(images[i].imageName, images[i].triangles, materialInfos, defaultMaterial,true);
	FMatrix imagematrix;
	FMemory::Memcpy(imagematrix.M, images[i].transform, sizeof(float) * 16);
	FTransform imageTransform(imagematrix);
	meshComponent->SetRelativeTransform(imageTransform);
	meshComponent->AttachToComponent(parentComponent, FAttachmentTransformRules::KeepRelativeTransform);

code in UE to import shapes works fine with component instances and groups. so i assume that the image’s transform may have some difference with them.

can someone give me a guide? thank you so much.

0 Likes

#3

I finally solved it by an odd method. it use the local transform to change the image vertices and normals, then attach the image to parentComponent without setting the image’s transform.
i cannot tell the difference between them. it may refer to much knowledge about UE. Sorry to say it.

So finally, can someone tell me what the transform got from SUImageRef is based on ? official doc don’t give a clear description.

0 Likes

closed #4

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.

0 Likes