Blender Scene Exporter (OpenSource)

Started by andresjesse, December 02, 2013, 09:15:05 PM

Previous topic - Next topic

andresjesse

Hi JPCT Community,

I'm here to show you a little project i've been working last days. It is a small scene exporter that allows to use Blender as a Sandbox (create/edit Objects, Camera, Lights and Actors).

It is, in fact, a re-build of my old scene exporter (http://www.jpct.net/forum2/index.php/topic,2531.0.html). Unfortunately i lost the source code of the old one, so i decided to re-implement it as an opensource project, this way everyone can test and suggest improvements. I don't think it will be a big tool, but can help to create small 3D scenes for JPCT. I know, there is a lot of tools and ways to create scenes for JPCT, but i like Blender scripts and this will help my students in a University Project that uses JPCT.

How it Works?
1. Create a 3D scene in Blender, add Lights and a Camera, add Some Actors (this is the cool part) and export. The script generates a xml file, exports each object into a 3DS file and collects all textures used in the scene.
2. Create the Actors in Java following a small pattern that i designed ("IActor" interface).
3. Copy&Paste JPCTBlend Core Java classes (the importer) to the JPCT project and load the xml.
4. Run.

Sample Scene in Blender:


Sample Scene in JPCT:


Sample Scene in Android:


Source Code, Javadoc and Tutorials (Wiki) can be found at https://github.com/andresjesse/jpctblend. Any suggestion is welcome.

PS: Some features are not implemented yet (see details in GitHub), but the actual project is fully functional.

EgonOlsen

Really nice! And what a coincidence that i've Blender open ATM to view some .blend files. My problem is, that i've no clue about how to use Blender...

EgonOlsen

I've added a link to the project to the wiki's Tools section, because i think that some people will find this really useful. Thanks for sharing this project.

andresjesse

Thanks, i'll keep this topic updated and if you want you can close the old one. Another suggestion is to move (if necessary) this topic to JPCT (not AE) forum, i've not coded AE support yet.

Wolf17

  THanks for sharing this!!!  :) ;D
I was looking for something like this for ae version ! Any future plans for ae version ?

andresjesse

Quote from: Wolf17 on December 07, 2013, 01:00:03 PM
  THanks for sharing this!!!  :) ;D
I was looking for something like this for ae version ! Any future plans for ae version ?

Thanks for your interest, yes, i'll code AE version next month.


juan

Great Work!. I hope you continue to add more features. I think it's very useful.

One thing I noticed is that the exported scene doesn't look exactly as it does in blender.

After trying out a few things, for a camera in Blender set to 35 (focal length) and 32 (size) if you set the FOV in your code, it will look just like it does in blender.

world.getCamera().setFOV(0.914f);   //this magic number I found empirically, but now that I think about it, it seems too much of a coincidence that is the same as 32/35.



andresjesse

Quote from: juan on February 03, 2014, 05:38:08 AM
Great Work!. I hope you continue to add more features. I think it's very useful.

One thing I noticed is that the exported scene doesn't look exactly as it does in blender.

After trying out a few things, for a camera in Blender set to 35 (focal length) and 32 (size) if you set the FOV in your code, it will look just like it does in blender.

world.getCamera().setFOV(0.914f);   //this magic number I found empirically, but now that I think about it, it seems too much of a coincidence that is the same as 32/35.

Tranks for the tip! I'm working on next release right now, this FOV value makes the scene looks more precise. I've made a lot of improvements and bug fixes, the next version will come soon.


[attachment deleted by admin]

MessyAnt

#9
Very cool !
But my Blender can't export  JpctBlend Scene(.xml) !   how i can to do get it ?  "script_export_v1.py" import  is error!



andresjesse

Quote from: MessyAnt on March 18, 2014, 08:51:40 AM
Very cool !
But my Blender can't export  JpctBlend Scene(.xml) !   how i can to do get it ?  "script_export_v1.py" import  is error!

This will be available on JPCTBlend next release and you'll need to add it by hand from Blender's "properties >> Addons" Menu. Make sure to download last version of blender. Thanks for your comment, next JPCTBlend will be released soon.


andresjesse

project updated! main changes:

--GENERAL
- updated MIT license to current year (2014)
- updated JPCTBlend to version 2
- sample scene moved to media/scenes/sample_scene
- sample actor java class updated to load SampleActor.3ds from media/actors
- changed camera FOV in jpct (forum tip, thanks!)
- added changes.txt file to store updates history
- configured texture loading to set alpha for PNGs (use this format for transparency)
- added some bushes to show texture transparency
- changed updateActors() to update()

--DESKTOP PROJECT
- updated Desktop Project Sample to use jpct library to version 1.28 (last)
- updated Desktop Project Sample to use lwjgl-2.9.1 (comes with jpct 1.28)

--ANDROID PROJECT
- updated Android Project Sample to use jpct-ae library to version 1.28 (last)

--BLENDER EXPORTER
- fixed object and actors rotation issue: -x,y,-z istead of x,y,z (corrects rotation after loading the scene).
- fixed object export without clean rotation (caused double rotation in previous jpctblend version).
- python exporter now available as blender plugin (shown in 'Export' menu. Needs to be enabled in user preferences >> addons >> Import-Export).

https://github.com/andresjesse/jpctblend