Free Support Forum - aspose.com

Exception"The type initializer for ‘Aspose.ThreeD.Render.Vulkan.Vk" on rendering 3D file using Aspose.3D for .NET

Hi,

I am trying to render Duck.zip (123.1 KB) file on 64 bit system (Window Server 2016) and I am getting “The type initializer for ‘Aspose.ThreeD.Render.Vulkan.Vk’ threw an exception.” error message. I am using below code snippet

// Initialize a Scene class object
ThreeD.Scene scene = new ThreeD.Scene();

					// Load an existing 3D document
					scene.Open(filename);

					Camera camera = new Camera();
					scene.RootNode.CreateChildNode("camera", camera);
					camera.ParentNode.Transform.Translation = new ThreeD.Utilities.Vector3(10, 10, 10);
					camera.LookAt = ThreeD.Utilities.Vector3.Origin;

					// Specify the image render option
					ThreeD.ImageRenderOptions opt = new ThreeD.ImageRenderOptions();
					// Set the background color
					opt.BackgroundColor = System.Drawing.Color.AliceBlue;
					// Tells renderer where the it can find textures

					if (!Directory.Exists(AppSettings.OutputDirectory + folderName + "/textures"))
					{
						Directory.CreateDirectory(AppSettings.OutputDirectory + folderName + "/textures");
					}

					opt.AssetDirectories.Add(AppSettings.OutputDirectory + folderName + "/textures");

					// Turn on shadow
					opt.EnableShadows = true;

					// Render the scene in given camera's perspective into specified png file with size 1024x1024
					lstOutput.Add("1");
					scene.Render(camera, imagePath, new Size(1024, 1024), ImageFormat.Png, opt);

Looking forward to hear from you.

Regards,
Naeem

@naeem.akram,

I have worked with source file shared by you and unable to observe any exception. Can you please share which version of Aspose.3D you are using on your end. Also please share complete environment details with us.

@Adnan.Ahmad

I ran the Aspose.3D Github Examples, I got this error too. Please see this image for more help.

The error is thrown on this line as shown in the screenshot.

        var renderer = Aspose.ThreeD.Render.Renderer.CreateRenderer();

@shakeel.faiz

We are looking into it and will get back to you shortly.

@shakeel.faiz,

I have worked with Aspose.3D Github examples and unable to observe the issue which you mentioned. Can you please share complete environment details along with version details which you are using on your end. Please check attachment.Result.zip (27.6 KB)

@Adnan.Ahmad

Hi,
I am trying to render car.zip (300.3 KB)
file to .png file using Aspose.3D Github Examples , and got an error too.

This is the error.
Exception in thread “main” java.lang.NoClassDefFoundError: org/lwjgl/system/Pointer
at com.aspose.threed.Renderer.a(SourceFile:743)

This is my pom.xml file.

<dependency>
  <groupId>com.aspose</groupId>
  <artifactId>aspose-3d</artifactId>
  <version>20.4</version>
</dependency>

Thank you.

@ou_yuki,

Can you please your sample code so that we may further investigate this issue on our end along with environment details so that we may further investigate to help you out.

Thank you for reply.

This is the sample code I tried.

public class RenderToFile extends RenderBase {
public static void run() throws IOException {

    Scene scene = new Scene();
    Camera camera = setupScene(scene);
    String output = RunExamples.getOutputFilePath("render-to-file.png");
    //Scene.render uses ImageIO internally, what output format is supported depends on your JRE.
    scene.render(camera, output, new Dimension(1024, 1024), "png");
}

}

@ou_yuki,

Thank you for the details.

We have logged a ticket with ID THREEDJAVA-73 in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

The issues you have found earlier (filed as THREEDJAVA-73) have been fixed in this update.