Author Topic: jBrush - A World and Animation Editor and a Serializer tool  (Read 17292 times)

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
jBrush - A World and Animation Editor and a Serializer tool
« on: October 21, 2011, 01:27:47 pm »
UPDATED ON 12/02/2012 - Version 0.3

Hello all,

This is a JPCT software I have created as part of a student project. It started as an exercise on the use of JPCT and it developed into this fairly complex toolkit that I used to create most part of an Android game currently available on the Android Market. I developed it a way that it could hopefully be of use to other JPCT users in their projects. While a number of versions were released, correcting a number of bugs reported, the software may still contain bugs (for which reports are appreciated!).

jBrush is a World and Animation editor. It allows you to import 3DS, OBJ and MD2 models, do the usual scale, rotate and translate operations. It has a 3DSMax-like interface where you can navigate the camera through the environment, rotate it around an object, position it front, side or on top of the scene.

World Editor:
In jBrush you can assign textures, most of the Object3D properties (name, collision, transparency, culling, emissive color, bumpMap, parent/child). You can also set up point lights, ambient light. The tool lets you export the scene as an instruction file which can be imported with two to three lines of code inside your JPCT/AE project with the aid of the library that comes with it. The library creates Object3Ds for all the models in the scene and it lets you fetch any of the them by the name given in the editor so that they can be used for further game actions.

Animation Editor:
jBrush is also a keyframe animation viewer and editor. It allows you to playback MD2 animations and to create your own animations out of 3DS keyframe meshes for a model (e.g. the 3-4 main stances of a walk-cycle) and set name and speed to the sequence created.
When linked to your project the library will take care of all the animation routines so that for any Object3D you can start or stop an animation with just one line of code. You can play animations continuously or play them once, at the same speed set up in the editor.

Serializer Tool:
Finally jBrush works as an interface to JPCT's Serializer facility, so it lets you export any supported model in serialized format (.ser) for more efficient processing on the Android.

An example use of this tool for instance is to create a scene with the environment models, create keyframe animations for an enemy, place the enemies inside the map and export the entire scene. The library will let you import the scene and fetch all models whose name contain a given parameter (e.g. "enemy") and with one line of code you can play their "moving" animations and execute further game code on them.

ADDITIONAL FEATURES FOR Version 0.25:
  • Triggers and GUI editors. Create trigger volumes and place them in the map. Use the library functions to have the engine check for collisions between triggers and game objects in order to trigger behaviour (opening of doors, elevators, activation of enemies, starting a cutscene et cetera.)
  • Create GUIs and Heads Up Display icons from image files, edit them and position them in the in-game screen. Use the library functions to dynamically turn GUIs on or off, change their position and size in-game.

ADDITIONAL FEATURES FOR Version 0.26:
  • Playback MD2 animations in the editor.
  • Serialize, reduce and export both MD2 animated models and Animations created in jBrush out of 3DS meshes (higher memory optimization for Android with the latter).
ADDITIONAL FEATURES FOR Version 0.28:
  • Set culling and collision properties
  • Set objects' parent/child dependencies and preview parented movements in editor
  • Get position and orientation of editor camera (useful for recreating a specific view angle in game)
  • Wireframe view mode (Useful when scene gets complex and you need to see through objects)

ADDITIONAL FEATURES FOR Version 0.3:
  • Adjust visibility of objects
  • Several bug fixes
  • Methods for loading level file from URL document base (for JPCT applets)
  • Optimized loading of serialized objects and animations for AE
  • Improved documentation

Download the software:

jBrush (v0.3)


Video previews/tutorials on how to use the library:

World Editor preview and project setup

Animation Editor preview and lib usage

NEW:

Triggers and GUI editor preview and lib usage



Place 3DS, OBJ and MD2 models in the scene. Edit their texture and properties.



Set up point lights and ambient light.



View MD2 animations or create animation sequences from 3DS keyframe meshes.



Place collision volumes (triggers) in the scene and create GUIs and Heads Up Display icons.


« Last Edit: June 18, 2012, 07:53:52 pm by neo187 »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11624
    • View Profile
    • http://www.jpct.net
Re: jBrush - A World and Animation Editor/Library and Serializer tool
« Reply #1 on: October 21, 2011, 10:52:20 pm »
Nice one! I really like the tutorial videos...well done. I have two remarks...it looks like as if you are using the software renderer in legacy mode (which is default, but maybe shouldn't be any longer...). This means that the lighting calculations are totally different from what you get on Android/OpenGL. Just add a

Code: [Select]
buffer.enableRenderer(IRenderer.RENDERER_SOFTWARE);

after creating the FrameBuffer and you'll get one in OpenGL-look-alike-mode.

The second thing is, that your method naming in the library differs from the standard Java conventions in some parts, where methods start with a lower case letter. Personally, i find this confusing.

Other than that, great work. I will add it to the projects page if you don't mind...!?

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Re: jBrush - A World and Animation Editor/Library and Serializer tool
« Reply #2 on: October 22, 2011, 09:19:31 pm »
it looks like as if you are using the software renderer in legacy mode (which is default, but maybe shouldn't be any longer...). This means that the lighting calculations are totally different from what you get on Android/OpenGL. Just add a

Code: [Select]
buffer.enableRenderer(IRenderer.RENDERER_SOFTWARE);

after creating the FrameBuffer and you'll get one in OpenGL-look-alike-mode.

The second thing is, that your method naming in the library differs from the standard Java conventions in some parts, where methods start with a lower case letter. Personally, i find this confusing.

Thanks for the feedback. I amended the buffer bit and re-uploaded, I can actually tell the difference! Yeah the capitalised methods must be confusing, I must have had Unity in mind when I wrote them as Unity has Animation.Play and Animation.PlayOnce methods.... changing those will require modifying the video tutorials, which I will do as soon as I have time...

Quote
Other than that, great work. I will add it to the projects page if you don't mind...!?
Of course! I'd love it if you put it in the 3rd party download section, along with Devkit and those other apps.... I put a lot of extra work in making sure this could be useful to other users in the community other than just for my game.

I am currently working on expanding it with a GUI editor and in-game library for displaying and receiving events from them. I'll also try and implement a "trigger" placement facility like the one Unity has, whereby you can place wireframe boxes in the map which are invisible in game but trigger events when collided with (like opening doors or elevators). I could actually use your input on that Egon, how would you go about the wireframe rendering of meshes in the editor? I am sure I have seen it in some sample code...and what do you think would be the best way of having them as invisible trigger objects in the scene?

Thank you.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11624
    • View Profile
    • http://www.jpct.net
Re: jBrush - A World and Animation Editor/Library and Serializer tool
« Reply #3 on: October 27, 2011, 08:24:10 pm »
I've added it to the projects page as well as to the download page. I'm not linking to the dropbox version but to a local copy instead. Let me know when i should update it with a newer version.

About the wireframe rendering: It's not easy to mix the normal scene with wireframe rendered objects. You could do this by rendering two worlds or by rendering different objects in different mode in two passes...but that doesn't solve the problem that the wireframe object doesn't care for the zbuffer, i.e. they will either be painted over everything of everything will be painted over them (depending on draw order). The best solution might be to fake it by using a transparent object with the wireframe baked into the texture.

About how to do the triggers...i'm not sure. Maybe just a SimpleVector with a dimension and some method that checks if something is within this bound?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11624
    • View Profile
    • http://www.jpct.net
Re: jBrush - A World and Animation Editor/Library and Serializer tool
« Reply #4 on: October 27, 2011, 08:25:41 pm »
BTW: I've noticed two things while taking the screen shots for the projects page. The mouse navigation somehow feels wrong to me. At times, it moves in a different direction than i thought that it actually should. And you should increase Config.maxPolysVisible. The current limit is too low for more complex objects.

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Re: jBrush - A World and Animation Editor/Library and Serializer tool
« Reply #5 on: October 29, 2011, 09:12:51 pm »
Thanks for the feature! Really appreciate it  ;)

Have set maxPolys to 250000, have seen that in a few examples in the forum, that seems plenty....

And yeah, i realised there was a small bug in the mouse/camera mapping...have added a fix for it though the camera still lags a bit in changing direction if you quickly change the mouse movement direction while dragging it.... have sent you a PM with the incriminated code snippet, maybe you have a better solution for that....

Have re-uploaded the package.

Will update this thread when the new features are ready!
« Last Edit: October 29, 2011, 09:29:47 pm by neo187 »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11624
    • View Profile
    • http://www.jpct.net
Re: jBrush - A World and Animation Editor/Library and Serializer tool
« Reply #6 on: October 29, 2011, 10:42:04 pm »
I don't see a change in behaviour...is it still the same link? I'm not sure if we are talking about the same thing...what i mean is, that if you drag into one direction and then change direction, the scene continues to move into the former direction. You have to release the button and then drag again to actually change direction. The version that i've downloaded right now this shows this behaviour. What i would expect is a behaviour like in this example: http://www.jpct.net/forum2/index.php/topic,977.msg6207.html#msg6207

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Re: jBrush - A World and Animation Editor/Library and Serializer tool
« Reply #7 on: December 19, 2011, 12:22:08 am »
A new version of jBrush has just been uploaded. New features in v0.2:

-Create and place trigger volumes (with library functions to listen for trigger collisions)
-Create and edit GUI and Heads Up Display icons (with library function to modify them in-game)

Video:
Trigger and GUIs editor preview and lib usage.

-Preview and play MD2 animations in the editor (with library functions to play MD2 animations with one line of code)

The editor now lets you serialize and export both an MD2 animated model and an animation created in the editor out of 3DS keyframe meshes. The latter option is particularly good for Android, as an MD2 model uploads geometry data for every single frame of the animation, which can result in running out of memory with complex meshes. 3DS animations from jBrush only export the main keyframes (e.g. the 3-4 stances of a walk cycle), all in serialized form, and calculate the ones in between at runtime (via JPCT), resulting in a lot less memory usage.


The download link is in the original post!
« Last Edit: December 23, 2011, 04:53:04 pm by neo187 »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11624
    • View Profile
    • http://www.jpct.net
Re: jBrush - A World and Animation Editor/Library and Serializer tool
« Reply #8 on: December 19, 2011, 07:50:34 pm »
Cool. I've updated the download in the download section.

Offline AGP

  • quad
  • ******
  • Posts: 1463
    • View Profile
Re: jBrush - A World and Animation Editor/Library and Serializer tool
« Reply #9 on: December 27, 2011, 07:18:34 am »
Awesome job, man. May I suggest integration with Raft's bones for Ogre files? That would be great.

And a couple more suggestions: you should be able to bitwise or Check Others with Check Self. And Set Object Properties could have a button for setCulling (I was testing jBrush with a caped model, which is why I came upon this one). Thanks for the great job.
« Last Edit: December 27, 2011, 08:02:53 am by AGP »

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Re: jBrush - A World and Animation Editor/Library and Serializer tool
« Reply #10 on: December 28, 2011, 08:46:21 pm »
Awesome job, man. May I suggest integration with Raft's bones for Ogre files? That would be great.

And a couple more suggestions: you should be able to bitwise or Check Others with Check Self. And Set Object Properties could have a button for setCulling (I was testing jBrush with a caped model, which is why I came upon this one). Thanks for the great job.

Thank you very much. I should be able to fix the collision setting and add an option for Culling in the next release soon.

Being able to preview skeletal animations with Raft's Bones would be a nifty feature, maybe be able to mix animations by assigning different sequences to different groups of bones.... but it'd be quite a bit of work, for which I don't really have the time at present, but maybe later on!

Thanks again for the feedback.

EDIT:
Have just uploaded v0.27with an option to set the object's culling and to bitwise Check Others and Check Self.
« Last Edit: December 29, 2011, 11:02:17 pm by neo187 »

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: jBrush - A World and Animation Editor/Library and Serializer tool
« Reply #11 on: March 13, 2012, 12:23:38 am »
Found moving the camera a little annoying, but good serializer tool.

Question how do I load the mtl file for a obj model?

Offline robert

  • byte
  • *
  • Posts: 40
    • View Profile
Re: jBrush - A World and Animation Editor/Library and Serializer tool
« Reply #12 on: April 09, 2012, 02:17:14 pm »
Please, allow the use of degrees in rotation, otherwise we have to use a calculator.

P.D: Nice program  :)

Thank you.

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Re: jBrush - A World and Animation Editor/Library and Serializer tool
« Reply #13 on: April 10, 2012, 10:58:43 pm »
Thanks all for the feedback.

Zambbi, the .mtl file is by default assumed to be of the same name as the .obj one and to be located in the same directory! Could you elaborate on how you think the camera could work better than it does? What exactly did you find unsatisfactory?

Robert, the rotation dialogue is simply feeding your input values into the JPCT's Object3D.rotate... function, which, as per JavaDoc:

Quote
Rotates the object's rotation matrix around the y-axis by the given angle w (radian, clockwise for positive values). This rotation is then applied to the object when it's rendered the next time.

Is this not what you need?

Offline robert

  • byte
  • *
  • Posts: 40
    • View Profile
Re: jBrush - A World and Animation Editor/Library and Serializer tool
« Reply #14 on: April 11, 2012, 12:54:38 pm »
Thanks all for the feedback.

Zambbi, the .mtl file is by default assumed to be of the same name as the .obj one and to be located in the same directory! Could you elaborate on how you think the camera could work better than it does? What exactly did you find unsatisfactory?

Robert, the rotation dialogue is simply feeding your input values into the JPCT's Object3D.rotate... function, which, as per JavaDoc:

Quote
Rotates the object's rotation matrix around the y-axis by the given angle w (radian, clockwise for positive values). This rotation is then applied to the object when it's rendered the next time.

Is this not what you need?

Hello there,

Yeah, I know jpct uses radians, it's just that for humans is much easier to work with degrees. Well, at least for me, because I'm used to using degress in Blender. You could simply put a radio widget to select degrees or radians in a quick way and do the conversion from degrees to radians in the former case.

Thanks.