Making Blender in Java

General discussion about the development of the open source Blender

Moderators: jesterKing, stiv

an-toni
Posts: 0
Joined: Wed Mar 17, 2004 5:20 pm

Post by an-toni » Wed Dec 27, 2006 8:55 pm

i don't think the current development is ever going to switch to Java, but of course you are free to write things on your favourite platform and it sure would be interesting to test the results :)

i am curious about how heavy the memory footprint would be, as often Java seems to hog there .. though with Arrays afaik there is not that much overhead so perhaps it is doable.

but personally i am still more interested in the cpython+numpy way, i.e. doing the architecture in py and mem&cpu heavy operations with optimized native structures and code utilizing existing c-written libs. then again this too is so far mostly just talk.

~Toni

joeri
Posts: 96
Joined: Fri Jan 10, 2003 6:41 pm
Contact:

Post by joeri » Thu Dec 28, 2006 11:37 am

Seeing it is even to difficult to switch to c++ I don't see any other platform having much merith, other then as a programming excercise.
But who wants to spend hours, days, years of their life into a program that nobody is going to use? I'm only going to switch to a slower, less feature rich other package (or spend time learning parts of it) if it has got unique features I can't find anywhere else. Ease of use could be one of them (step-in version of blender for example). Great game-player connection could be another. (all)Browser Realtime Player could be a good example to.

kid_tripod
Posts: 35
Joined: Sun Dec 15, 2002 10:52 pm

Post by kid_tripod » Fri Dec 29, 2006 8:46 pm

I think one major problem with using too much Python is that Python is about to undergo an enormous overhaul (in 3k) and it's multithreading, which is becoming increasingly important, isn't exactly hot. Sadly Jython appears to be dead in the water as well.

The Java suggestion is one I would take much more seriously than virtually any other. The evidence provided by Sunflow suggested the speed of execution combined with speed of development certainly yielded useful results. The problem here is interfacing Java with an existing C codebase can lose all the benefits of working with it in the first place. Your best bet is to use Twisted (there has to be a better way - it seems to cause instability running inside Blender) to expose Blender's internals via Python and network interface, and then use whatever you want to pass code in (rather like naive PHP building SQL stuff - dyamically make Python, evil but it works).

You could reimplement large bits of the ui this way - at least those which cover functionality accessible from Python. Build over a decent abstraction layer and one day you might be able to swap Blender out for a "pure Java" version.

ascotan
Posts: 0
Joined: Thu May 29, 2003 10:32 pm
Location: Maryland, U.S.

Post by ascotan » Fri Jan 26, 2007 4:38 pm

Java is a clunky application language.

Have you ever run a java desktop application?
a - slow startup times
b - non-native looking interface
c - widget delay times

It's bad enough trying to get artists to figure out how to install python on windows. Think about what it would be like trying to get the correct jvm installed on a windows box before they could run the application? Or configuring the memory requirments of the jvm for large renders?

Java is faster than python clearly. Java is also slower than C. For most things it's not a big deal. The interface could be written in java, but the engine components, translated to java would run slower. At some point you'd have to write JNI wrappers to call C code for bottlenecks in stuff like the renderer. I just don't see the advantage.

If you really want to you could rewrite Blender in Lisp, perl, or D. Because people want to play around with technology is no reason to move the project in that direction. C is clearly the best language for a computationally intensive rendering application like Blender.

Hell, if we are going to rewrite Blender I'd rather see it in Lisp. Lisp is 4x faster than java.

elam
Posts: 8
Joined: Wed Oct 16, 2002 3:02 am

Post by elam » Mon Jan 29, 2007 5:05 pm

Java is plenty fast, in most cases on par with C++ speeds. The canard that Java is clunky and slow is simply not true. And Java is as hard to install as point and click.

Yes Blender will render faster in C that Java, but it would render faster in assembler than C, so on and so forth. The point is that you gain a lot in productivity, developer mindshare, and cross compatibility.

Besides, C Blender will always exist, regardless if anyone develops it in Java.

I propose someone look into porting Ghost to Java via JOGL and go from there.

LetterRip
Posts: 0
Joined: Thu Mar 25, 2004 7:03 am

Post by LetterRip » Tue Jan 30, 2007 6:00 am

"The canard that Java is clunky and slow is simply not true."

The biggest slow part is the time to load the interpreter - which is 10-15 seconds for most applications. Once the interpreter is loaded, the application itself may be reasonably quick (it really depends - performance critical code is still pretty significantly faster in C and C++), however one nice point of blender is that it loads and quits in less than a second - which would be impossible with java.

That said, it is a non issue since there is zero chance in the 'near future' of any significant number of current Blender devs porting Blender to java.

LetterRip

elam
Posts: 8
Joined: Wed Oct 16, 2002 3:02 am

Post by elam » Tue Jan 30, 2007 3:56 pm

The startup times for Java apps are related to class loading for whatever application your running. But that's really only the first time you've started the program. The VM is good about caching and JIT compilation so that consecutive startups are considerably faster. The VM itself starts up rather quickly.

Regardless, the first time I fire up Blender it takes roughly five seconds, after that about one. I really don't think users care much about startup times as 99.9% of their time is spent in the program.

But I agree, the point is moot. :D

elam
Posts: 8
Joined: Wed Oct 16, 2002 3:02 am

Post by elam » Tue Jan 30, 2007 5:51 pm

btw, Ghost is self contained, right? I mean that it in no way depends on Blender, correct?

LetterRip
Posts: 0
Joined: Thu Mar 25, 2004 7:03 am

Post by LetterRip » Wed Jan 31, 2007 5:20 am

To my knowledge ghost is self contained. I think it was once an entirely separate system, but don't know if it is externally maintained anymore.

LetterRip

joeri
Posts: 96
Joined: Fri Jan 10, 2003 6:41 pm
Contact:

Post by joeri » Wed Jan 31, 2007 9:03 am

Ghost was NaN's version of glut.
Developed by Maarten Gribnau: projects.blender.org/users/maarten/

bencal
Posts: 0
Joined: Sat Feb 10, 2007 10:55 am

Post by bencal » Sun Oct 21, 2007 9:24 pm

I am also interested into bridging Blender & Java.

But not blindly.
1 ) Java is not made to do floating point math. So a full rewrite of Blender in Java is just nonsense.
2 ) Speed of a language is not only function of raw number crunching but also function of how structure in memory and objects are managed. In clear, you can write C/C++ code that is faster than Java, but if the complexity is big enough, you have a lot of chance of writing slower code.

I don't want to modify a lot blender. Rather I just want to be able to access Blender structures from Java code (Embedded in Java or Java embedded Blender).
This could be a library able to communicate with a Java App through a pipe (using RMI/IIOP or other language neutral protocol like XML/WEB services) or a JNI library.

I though of making a library from the Blender core, allowing every one to write Wrappers for any languages with tools like SWIG.

Having Blender formed of Library like blocks could be benefic for Blender.
If so, One could write very rapidly a Java interface for Blender

Anyway, I don't have a lot of time to spend on that, so I only give here my support to make Blender Java enabled

[/list]

el_diablo
Posts: 0
Joined: Sat Oct 20, 2007 2:49 pm

Post by el_diablo » Mon Oct 22, 2007 4:16 pm

I use only one desktop aplication written in Java, and that is OpenOffice. Based on its performance, I really wouldnt like to see Blender go Java route. The startup time is about 10X MS Office, UI drawing is noticably slower, and generally it seems a bit slugish.

Someone mentioned Lisp. One of the most revolutionary 3D applications was written in Lisp, the application called Mirai. The main reasons cited were: it was easy to maintain, debug and add functionality in a way that doesnt break older stuff. The speed of developement seemed impressive. God knows what would become of Mirai was it developed further.

The main drawback is of course lack of developers familiar with Lisp. Performance wise it will never be as fast as optimized C, but its not far for most things.

As far as reprogramming some parts of Blender in python. I am all for it. For example, let API provide basic windowing framework but let python have its own event queue (or interface the main event queue) as well as instantiate UI controls or do openGL calls. This way python script could interact with any pane in Blender and I guess most of the panes could be controlled from python scripts. This would make Blender fully customizable as far as functionality is concerned. Think of this. Someone doesnt like how node editor looks (lets say me) i could make my own controls and hook them up to events and draw the lot in a pane.

I didnt quite go over the blender source yet, but I guess blender event system is still pretty hardcoded and python scripts dont have access to every part of scene data blender makes. If this changes, it would be nice if its refactored so previous paragraph is possible to do.

kAinStein
Posts: 63
Joined: Wed Oct 16, 2002 3:08 pm

Post by kAinStein » Mon Oct 22, 2007 6:24 pm

el_diablo wrote:I use only one desktop aplication written in Java, and that is OpenOffice. Based on its performance, I really wouldnt like to see Blender go Java route. The startup time is about 10X MS Office, UI drawing is noticably slower, and generally it seems a bit slugish.
OO isn't written in Java...
Someone mentioned Lisp. One of the most revolutionary 3D applications was written in Lisp, the application called Mirai. The main reasons cited were: it was easy to maintain, debug and add functionality in a way that doesnt break older stuff.
*coughs* Easy to maintain? Compared to what?
The speed of developement seemed impressive. God knows what would become of Mirai was it developed further.
They probably would have had rewritten everything in some other language. ;)

Sorry, but I really doubt that any Lisp dialect is suitable for large projects - unless you are an Emacs-professional who eats brackets for breakfast!

el_diablo
Posts: 0
Joined: Sat Oct 20, 2007 2:49 pm

Post by el_diablo » Mon Oct 22, 2007 8:06 pm

Jeez, just going through "About" section of OO.org it clearly states its written in C++.

I really dont know why I was sure it was Java app, other than awfull performance. And yes I know Java isnt slow by it self...

I still think Lisp like language might be a nice choice when changes are concerned.

Me, I like assembler. And not the x86 one, 680x0 one. That was a really simple way to program.

Briggs
Posts: 0
Joined: Tue Feb 13, 2007 10:37 pm

Post by Briggs » Mon Oct 22, 2007 10:31 pm

[quote="kAinStein"][quote="el_diablo"]I use only one desktop aplication written in Java, and that is OpenOffice. Based on its performance, I really wouldnt like to see Blender go Java route. The startup time is about 10X MS Office, UI drawing is noticably slower, and generally it seems a bit slugish.[/quote]

OO isn't written in Java...

[quote]Someone mentioned Lisp. One of the most revolutionary 3D applications was written in Lisp, the application called Mirai. The main reasons cited were: it was easy to maintain, debug and add functionality in a way that doesnt break older stuff. [/quote]

*coughs* Easy to maintain? Compared to what?

[quote]The speed of developement seemed impressive. God knows what would become of Mirai was it developed further.[/quote]

They probably would have had rewritten everything in some other language. ;)

Sorry, but I really doubt that any Lisp dialect is suitable for large projects - unless you are an Emacs-professional who eats brackets for breakfast![/quote]

I havn't ever coded in Lisp, but I have written code in another functional language (Erlang) and I don't see the great difficulty in using such languages for large projects. As a matter of fact I see quite a few advantages. What is it about lisp that makes you doubt its suitability for large projects?

Regardless, the reason Mirai was written in Lisp probably has a lot to do with the fact that it actually started as a product of Symbolics Corporations graphic division called S-World (their whole bussiness was lisp machines). Given that it's code survived as Lisp for over 15 years I really doubt that Larry Malone (Mirai's chief architect and who, from what I hear, is still working on it, albeit only for private clients these days) will be rewriting it any time soon.

Cheers

Post Reply