We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Render 3D object model using 6 diffirent images to blank scene

Hi everyone, I’m trying to modify a given 3D object model. I have found a demonstration to creating a 3D model for cube (see “RenderSceneIntoCubemapwithsixfaces” class for more information in the example code). Can I wrap these images to a different model? for example: wrap images to grey car 3D model. How to do it? I just using the trial version. Thanks

@nhan_le

Thank you for contacting support.

We are looking into your requirements and will share our findings with you soon.

thanks!!!

@nhan_le

Thank you for being patient.

Technically, it is possible to modify texture coordinates in code but usually this approach is not used because of being related to aesthetics. It relies on human’s perspective of actual requirement to decide how to wrap the texture coordinate, so the artists usually use some tools like 3DS Max, Maya etc. However, we have devised a sample to modify existing texture coordinates with Aspose.3D API but the results may not be aesthetically acceptable because of aforementioned details.

private static void ModifyTextureCoordinates()
{
    //Load a file
    Scene scene = new Scene("test.obj");
    //traversal all meshes
    foreach(Mesh mesh in scene.RootNode.SelectObjects("//<Mesh>"))
    {
        //get the texture coordinate
        var diffuseUV = mesh.GetVertexElementOfUV(TextureMapping.Diffuse);
        //and modify them by flipping the uv
        for (int i = 0; i < diffuseUV.Data.Count; i++)
        {
            var uv = diffuseUV.Data[i];
            diffuseUV.Data[i] = new Vector4(1 - uv.x, 1 - uv.y, 0, 0);
        }
    }
    //re-save to file
    scene.Save("test_flipped.obj", FileFormat.WavefrontOBJ);
}

We hope this will be helpful. Please feel free to contact us if you need any further assistance.