Author Topic: Blender Scene Exporter (OpenSource)  (Read 20142 times)

Offline andresjesse

  • byte
  • *
  • Posts: 13
    • View Profile
Blender Scene Exporter (OpenSource)
« on: December 02, 2013, 09:15:05 pm »
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.
« Last Edit: January 03, 2014, 07:47:03 pm by andresjesse »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Blender Scene Exporter (OpenSource)
« Reply #1 on: December 02, 2013, 09:27:06 pm »
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...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Blender Scene Exporter (OpenSource)
« Reply #2 on: December 02, 2013, 09:30:37 pm »
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.

Offline andresjesse

  • byte
  • *
  • Posts: 13
    • View Profile
Re: Blender Scene Exporter (OpenSource)
« Reply #3 on: December 03, 2013, 01:04:33 pm »
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.

Offline Wolf17

  • int
  • **
  • Posts: 77
    • View Profile
Re: Blender Scene Exporter (OpenSource)
« Reply #4 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 ?

Offline andresjesse

  • byte
  • *
  • Posts: 13
    • View Profile
Re: Blender Scene Exporter (OpenSource)
« Reply #5 on: December 12, 2013, 02:07:46 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.

Offline andresjesse

  • byte
  • *
  • Posts: 13
    • View Profile

Offline juan

  • byte
  • *
  • Posts: 3
    • View Profile
Re: Blender Scene Exporter (OpenSource)
« Reply #7 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.



Offline andresjesse

  • byte
  • *
  • Posts: 13
    • View Profile
Re: Blender Scene Exporter (OpenSource)
« Reply #8 on: March 13, 2014, 02:21:27 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]

Offline MessyAnt

  • byte
  • *
  • Posts: 6
    • View Profile
Re: Blender Scene Exporter (OpenSource)
« Reply #9 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!
« Last Edit: March 18, 2014, 10:52:45 am by MessyAnt »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Blender Scene Exporter (OpenSource)
« Reply #10 on: March 18, 2014, 08:53:59 am »

Offline MessyAnt

  • byte
  • *
  • Posts: 6
    • View Profile
Re: Blender Scene Exporter (OpenSource)
« Reply #11 on: March 18, 2014, 11:47:41 am »
ho , Thanks~

Offline andresjesse

  • byte
  • *
  • Posts: 13
    • View Profile
Re: Blender Scene Exporter (OpenSource)
« Reply #12 on: March 18, 2014, 05:51:57 pm »
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.

Offline MessyAnt

  • byte
  • *
  • Posts: 6
    • View Profile
Re: Blender Scene Exporter (OpenSource)
« Reply #13 on: March 19, 2014, 02:17:02 am »
Thanks! :)

Offline andresjesse

  • byte
  • *
  • Posts: 13
    • View Profile
Re: Blender Scene Exporter (OpenSource)
« Reply #14 on: March 19, 2014, 06:12:22 pm »
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