Home Projects Research Misc. Contact

Java .Blend Viewer

Demo Application and Examples for Java .Blend


GPL v3


Holger Machens

This is a collection of examples to demonstrate the use of Java .Blend.

Project Contents

  • gen: Generated Java .Blend DNA lib for Blender v2.79 files.
  • src: Source code of the viewer application.
  • jb-examples: Some examples showing reading and writing of .blend files.
  • resources: Blender files and glsl shaders required by the demo application.


Import in Eclipse

  1. Extract downloaded zip-file
  2. In Eclipse create a new Java project and select the extracted directory as Location
  3. Click on Finish

Java .Blend Viewer

Files: src/*
Main Class: org.cakelab.blender.BlenderViewer

The application reads a given Blender file and displays it. It will start in a Debug View, which shows normals and camera orientation as well as key-bindings (use F1-key to see regular view).

DISCLAIMER: This application and the underlying render engine are WORK IN PROGRESS. Currently, its purpose is to demonstrate how to access data in .blend files through Java .Blend. Its purpose is not to explain rendering of that data in OpenGL.

The application is based on LWJGL, JOML and contains an object-oriented abstraction layer (packages org.cakelab.soapbox and org.cakelab.oge).

The most important part of the application is found in package src/ There is a class BlenderInput, which offers all kinds of methods to retrieve data from an associated blender file using the generated DNA classes for a specific render engine of course. BlenderInput uses a converter class ConvertBlender2OpenGL located in the same package. It converts data of the .blend file in internal representations used by the underlying render engine in org.cakelab.soapbox.

Example: Converting .blend to JSON

File: jb-examples/org/cakelab/blender/io/input/

This example demonstrates how to implement a class which converts the whole Blender file into a JSON representation. The example makes use of the java reflection API to perform its task on top of the generated data model. This approach was just used to further demonstrate the use of the data model.

The conversion allows to easily visualise the content of a Blender file which helps in understanding the meaning of member variables of classes in the generated data model.

Example: Exchanging Data with Blender via Copybuffer

File: jb-examples/org/cakelab/blender/io/output/

Blender provides a clipboard functionality of its own kind. On CTRL+C Blender copies selected objects into a temporary .blend file which is stored in /tmp/copybuffer.blend (I guess it's %APPDATA%/.. on windows). Accordingly, on CTRL+V the content of this file is pasted in the currently selected scene.

The example code in demonstrates how to fill the copybuffer with a mesh (simple cube with texture).

Example: Creating new Blocks

File: jb-examples/org/cakelab/blender/io/output/

The factory class of the generated data model (see gen/org/cakelab/blender/utils/ provides several methods to create new blocks for structs, arrays and pointers. This example provides multiple examples to demonstrate the use of those methods.


This work is published under GPL v3.0.

This work includes a copy of LWJGL 3 which is licensed under "a BSD license".

This work includes a copy of JOML which is published under an "MIT license".

Holger Machens, 20-Oct-2017