SceneEditor course & programming guide



Hello @ll:

For my university project last year I created a WYSIWYG Scene-Editor based on the Particle-Editor provided with the jME. Since my project was finished some months ago I decided to release the source code and documentation for it. It initially was planned as a course with the goal to acquire a certain amount of fundamental practical and theoretical knowledge in the development of contents in virtual reality no matter which game engine one would choose. As a base for the practical part of the course the participant would be guided step-by-step into the implementation of an interactive scene editor in jME. During this guide beginners would also encounter different topics such a game logic, 3D technology, matters of light and shadow etc. in order to combine practise with theory.

Overview of the chapters involved:

1 ) Starting jME in Swing
2 ) Orientation in virtual reality
3 ) Mouse- and Keyboard input
4 ) Structuring a scenegraph
5 ) Adding objects (cube, sphere, .obj files)
6 ) Mousepicking
7 ) Concept and implementation of a gizmo (translation, rotation, scale)
8 ) Manipulation of objects with a gizmo
9 ) Refreshing & changing objectdata in realtime
10) Create lightobjects
11) Specialeffect: shadows
12) Save & Load scenes
13) Extras

Each chapter has its own fully autonomous code and each chapter builds upon its previous chapter. The guide itself is a single PDF-file with text, illustrations, code fragments and covers all chapters. The number of the chapter also determines the number of the sourcecode from the finished chapter. Each chapter starts with a picture giving a hint of what is to be achieved in the current chapter (except c. 4). This way everything is cleanly structured, beginners will not get mixed up or need to do “file hopping” (although this system created spaghetti code…). The sourcecodes were successfully tested on Windows and Linux. So long for the good part…

Now to the bad parts: the step-by-step guide is in German language only (!) and unfortunately I don’t have the time to translate it into English anymore. Still I want to offer this guide to the community, in case some other German speaking people use jME or babelfish translations would be enough to understand. Also the code itself uses English variable names only therefore might be enough to understand while reading through it. While talking about the bad side… on looking back I also think some things could have been implemented in a better way now (e.g. the gizmo is not implemented in a real good way; also an OpenGL GUI would have been much faster than any 2D GUI, though I didn’t use FengGUI because it had some bugs which were disturbing me). There seems to be an additional minor bug when activating shadows (light on object edges). Well, you never learn out, I guess…

Aside from these issues please feel free to hack into the codes and use its guts or part of it for your own purpose without restrictions. I hope it can be a help to others, especially to beginners. The whole application is a mere ~2400 lines of code, so nothing starters would get knocked off.

SceneEditorDemo controls:

W…move forward
S… move backward
A… strafe left
D… strafe right
Space, Q... move up
C, Z... move down
LMB... select objects
RMB... click/hold gizmo to translate/rotate/scale
MMB... 360 degree view
H... activate/deactivate shadow volumes

Using gizmo: select any object and then press the gizmo-button you want
Shadow volumes: activation might take some seconds, DepthPass only

I am not sure if the editor works with the current version of jME, since I used some revision of November or December 2008, using jME 2.0. There shouldn’t be too much errors though. I also packed a single executable Jar-File for Windows users which works out of the box. The size is about ~30mb and is available on rapidshare. The editor also includes a version of Andrew Carter’s “SceneMonitor” which will start at the same time the editor is started (of course I mentioned any 3rd party libraries and sources I used in my project including the specific licenses).
Small note on the side: I didn’t use any code from other World-Editors such as MonkeyWorld3D because at that time my knowledge was simply too low to understand such large projects and its hundreds of classes and therefore built the editor solely from what I’ve learned by the tutorials, sample codes and forum questions.

With that small contribution I hope to give something back and want to thank the community, forum, and people who I don’t even know but have read & learned a lot from their questions as well while digging through the forums.

http://rapidshare.com/files/287709311/Demo.zip.html (~30mb)
http://rapidshare.com/files/287713318/course.zip (~ 3.5mb)

Files in course.zip:
guide.pdf (step-by-step guide in german language)
SceneEditorDemo1-13.java (sourcecodes)
Szene.jme (a prebuilt scene you can load into the editor)
house.obj (a basic house created in blender)
house.mtl
TesselatedBox.obj (a box with additional subdivisions to show proper vertex lighting)
1 Like

AWESOME!



Looks like I will learn german after all.

This appears to be an awesome contribution owaye, many thanks! Too bad I don't have the time nor German savvy to really dive into this.

owaye wrote:
I am not sure if the editor works with the current version of jME, since I used some revision of November or December 2008, using jME 2.0.
Would be great if someone could do some tests to de/-confirm this statement.
erlend_sh said:
owaye wrote:
I am not sure if the editor works with the current version of jME, since I used some revision of November or December 2008, using jME 2.0.
Would be great if someone could do some tests to de/-confirm this statement.
Just tried it, got this in regards to the LWJGL:


Exception in thread "main" java.lang.LinkageError: Version mismatch: jar version is '16', native libary version is '17'
   at org.lwjgl.Sys.<clinit>(Sys.java:103)
   at org.lwjgl.opengl.AWTGLCanvas.<clinit>(AWTGLCanvas.java:85)
   at com.jmex.awt.lwjgl.LWJGLAWTCanvasConstructor.makeCanvas(LWJGLAWTCanvasConstructor.java:45)
   at com.jmex.awt.lwjgl.LWJGLAWTCanvasConstructor.makeCanvas(LWJGLAWTCanvasConstructor.java:1)
   at com.jme.system.lwjgl.LWJGLDisplaySystem.createCanvas(LWJGLDisplaySystem.java:212)
   at com.jme.system.lwjgl.LWJGLDisplaySystem.createCanvas(LWJGLDisplaySystem.java:189)
   at SceneEditorDemo13.getGlCanvas(SceneEditorDemo13.java:600)
   at SceneEditorDemo13.init(SceneEditorDemo13.java:481)
   at SceneEditorDemo13.<init>(SceneEditorDemo13.java:195)
   at SceneEditorDemo13.main(SceneEditorDemo13.java:186)



The code seems compatible with the current iteration of jME2, though the LWJGL seems to be too new..

Does anyone remember what version we were on back around this time?

Hey,…great job! Actually I just read the guide.pdf and it is really cool! Much explanation about jME2 and the 3d-world itself. Quite good to get more than just an overview. After work I will have a look on the editor…keep on rocking

ttrocha said:

Hey,...great job! Actually I just read the guide.pdf and it is really cool! Much explanation about jME2 and the 3d-world itself. Quite good to get more than just an overview. After work I will have a look on the editor....keep on rocking


can you send the zip over to me?  i'm having trouble connecting to rapidshare and would like to put this on the wiki

I greately appreciate your decision to provide such a nice tutorial/guide.



Actually, I am at the very startingpoint to learn about jme. So I am walking throught your guide with fun and pleasure :wink:



I hope I can help sbook a little to translate this guide into (not perfect) english and cut out the images for the jme wiki.

Can you add the other files (java sources) to the wiki too?



a mirror for the files in case rapidshare makes trouble:

http://www.file-upload.net/download-1941100/course.zip.html

http://www.file-upload.net/download-1941141/Demo.zip.html

owaye wrote:
I am not sure if the editor works with the current version of jME, since I used some revision of November or December 2008, using jME 2.0.
I just checked out the current jme from svn and it seems to work perfectly fine.
CrappySnafu said:

I greately appreciate your decision to provide such a nice tutorial/guide.

Actually, I am at the very startingpoint to learn about jme. So I am walking throught your guide with fun and pleasure ;)

I hope I can help sbook a little to translate this guide into (not perfect) english and cut out the images for the jme wiki.
Can you add the other files (java sources) to the wiki too?

a mirror for the files in case rapidshare makes trouble:
http://www.file-upload.net/download-1941100/course.zip.html
http://www.file-upload.net/download-1941141/Demo.zip.html
owaye wrote:
I am not sure if the editor works with the current version of jME, since I used some revision of November or December 2008, using jME 2.0.

I just checked out the current jme from svn and it seems to work perfectly fine.
silly me, I forgot to add the link to that in the wiki :p  the course.zip is up there, but I did not add Demo.zip..

Thanks in advance for any help you can give snafu, I've already got all the pictures covered from chapter 7 to the end..  It may help to know that a good majority of them are selectable in Adobe Acrobat, so you can just right-click and hit "save image as", some others need to be screenshot'd and cropped though..

For everyone’s information, this fantastic guide is currently being translated and reproduced in the wiki here…



The translation’s are coming from Google Translate with grammatical fixes/interpretation coming from as the only german I know is that of the foul mouth :wink:



The .pdf is now hosted on the site and is accessible from the wiki page.  Please take a read and/or help get this extraordinary contribution into the wiki

I felt free to create a new namespace for the images in this tutorial. I hope this will be ok.

I uploaded all images from the beginning to Chapter 6.



I tried to translate a bit too. Ch.1 is almost complete now. I hope my english is not too bad. I tried to translate with  dict.leo.org (babelfish and google are too … weird) feel free to correct me :wink:


great stuff :slight_smile:

Thanks for the feedback  :) But again I want to warn, that my core implementation is not the best. With “core implementation” I mean the implementation of my Translate/Rotate/Scale Handlers:



Issue 1: As you can see the Handler itself is only another 3D Object in the scene which will get smaller the greater the distance from the camera is and the bigger the lesser the distance is. Most gizmos in other 3D applications however manage to display the gizmo in a fixed size no matter how much you zoom in and out of the scene. Unfortunately I don’t know how this is to be done.

Issue 2: If you use the translate and scale gizmo from certain angles sometimes objects seem to move too quickly. The reason for that is, because I did moving/scaling of objects based on the mouse position in the 3D scene rather than on the 2D display screen pixels.

(The rotation gizmo however is based on the 2D window pixels, which should work correctly no matter which angle you choose)



I would be very happy if anyone with greater knowledge could modify the code or at least would add this alternate gizmo behavior as an additional option. The current implementation could lead newbies into a wrong direction, I’m afraid.



In my view creating and using gizmos for an editor covers many topics essential for making games. People who understand these very basics will also more likely to be able to extend other editors as well and therefore help existing projects. Once understood, people would also be able to create their own editor for their own specific purpose in any other engine.

owaye said:

Thanks for the feedback  :) But again I want to warn, that my core implementation is not the best. With "core implementation" I mean the implementation of my Translate/Rotate/Scale Handlers:


I thought this was done pretty well, but a problem that i've experienced myself in the use of these (but didn't read about you encountering the problem) is that the bounding boxes are usually intersection with the model..  For a box shape created by jME this shouldn't be a problem, but it becomes a difficulty when using imported meshes.

That said though, I played with your method of movement and found it to be pretty fluid

@sbook said:

I just checked out the current jme from svn and it seems to work perfectly fine.

[/quote]



How can I run this project in the JMonkeyEngine 3.0… I just put all the classes into a package but it doesn’t work…

@xiaowan said:
How can I run this project in the JMonkeyEngine 3.0.... I just put all the classes into a package but it doesn't work...

Not at all, its a jME2 library.

@normen said:

Not at all, its a jME2 library.



OK, thanks. By the way, whether there is a similar project like this that can accomplish “scene editor” in jmonkeyengine 3.0? Because I met some problems during developing this function.

The jme development pladform thingy? it has a scene editor.

Yeah, afaics the SDK SceneComposer does everything this editor does too, incl particle editors, material editing, placing of models, batching etc…

@EmpirePhoenix said:
The jme development pladform thingy? it has a scene editor.


Can you give me a link? or does there have a code sample?

2 Likes