Shaders,shaders,shaders...

Hello guys,

If you haven’t already, please take a look at nVidia’s new GeForce FX demo screenshots, at www.nvidia.com. How are we (Java game developers) supposed to compete with THAT?

Besides the new card’s awesome power, what anyone will notice is the trend in new games: Extensive use of pixel/vertex shaders. Even if someone managed to develop a full-blown Java game (I’m sure it’s possible using Java, no matter what some people say…), it’s still going to be at least a generation back, considering the technology used in graphics (GF3-like cards exist for quite some time) and of course it will LOOK a generation back! With the current Java technology (J3D | GL2J | LWGL), we just can’t produce the effects that pixel/vertex shaders produce. We’re still stuck with using old-school tricks & hacks to achieve special effects.

My question is, when can we expect access to such features? And I don’t mean just shaders, but much more (I’d love some real-time shadows in my engine - stencil buffer access PLEASE!). What’s the status of Java3D 1.4? Could anyone give us some info? It promises great stuff in it’s JSR, but it says nothing for sure. What features exactly will it contain? Any release dates? I’m no expert, but I believe that since DirectX 9 and OpenGL 2.0 specifications show the way towards abstraction and high-level game programming, it would be easier to implement a J3D version giving access to all the great stuff in the future…

I’d like to hear what you guys think about this. I’m getting a little disappointed here…

Spasi ???

Don’t even think of trying to compete with the native world when it comes to the point of exploiting latest graphics special effects, sound or input devices.

If you want that, go and get one of the powerful games engines (in C++) and create your content (and your shaders). They are specialized on their task and always on track with latest technology. The companies are small and fast moving.

You could also head for LWJGL and such and add the things you need. I think there is clear path how shaders can be embedded to the Java world. Thats an annoying and boaring task, but you can do it yourself. Again, with LWJGL, you have nothing won (you just have a low-level-API-wrapper - thats nothing. Install DX and you have more!) and still should head for a C++ solution. Most C++ engines are by far better than LWJGL - so why use it?

The only way to go is writing games FOR Java, not only in Java. That means NOT to concentrate on special effects but on modularity, on-line-awareness, extendability, exploit the rich technical environment: web, speech recognition, speech synthesis, scalable multi-purpose 3D engine, multiplatform (mobiles!).
E.g. make a game where the 3D content is THAT rich and FREE that Java3Ds scalability gets profitable and typical BSP game engines fall short. Streaming new 3D content over and over from the net. You can leave out shaders than easily.

Sun provides a broad spectrum of technology. Well integrated, multipurpose. So they cannot be that fast.

The C++ games business is HUGE and OLD and for sure has the better tools. You cannot expect Sun to compete with a very general 3D environment.

I hope to see shader support in Java3D 1.4 as well (which IMHO should not be too difficult to accomplish). But I wouldn’t start a game project now that has to be a jaw-dropper graphics wise…

Making a game in Java just for the sake of programming in Java is foolish. There has to be clear benefit! In main-stream games business (DOOM3, GTA3, UT2003…), there is none.

As far as I am concerned, lwjgl will support all features that OpenGL has to provide, if it is technically possible… But I’ll let Cas step in here and elaborate a bit more, since OpenGL really isn’t my area of expertise…

Cas? ;D

J3d will always be a little further back from the wavefront when it comes to the latest features, but the advantage it offers is that as it encompasses new features it will handle them without developers having to radically change their code.

Remember that most users won’t have this level of hardware for at least 2 years, maybe longer- I don’t know how quickly these things percolate through, but I recall hearing recently that the Riva TNT 2 is currently the commonest video card in circulation.

It is both the PC’s strength and weakness that it can be upgraded so it always does the latest and greatest 3d stuff. You will find existing technology will be pushed far further on the consoles than it ever is on the PC because they are a static platform and you can’t just change the minimum spec for your product.

Here’s the “official”* LWJGL line on this:

LWJGL will support all features of OpenGL and OpenAL within a few weeks of the specifications becoming available or until someone threatens us. We already support pixel shaders and vertex shaders in the full OpenGL 1.4 specification.

LWJGL promises nothing more than 100% efficient access to all the features available, with a certain degree of simplification.

If you’re writing state-of-the-art games we believe that using LWJGL will get you there. Your only limitation will be the performance of Java relative to C, and it’s got to the point where that’s largely irrelevant if you know what you’re doing.

However using LWJGL means you have to write all your own scenegraph and tools. But this scenegraph and tools will be as bug-free as you can make it, and as fast as you can make it, and have as many features in as are exposed by the underlying O/S. Using LWJGL frees you from any ties with a 3rd party such as Sun (we’re BSD licensed).

There is no obligation to write games for Java in LWJGL. You are quite able to produce state-of-the-art graphics. Still no-one has commercially bested my terrain demo written in the cranky precursor to LWJGL, even in C.

A cool move on Sun’s part would be to move J3D on top of LWJGL. I do not expect that there would be a measurable difference in performance. If it’s as well written as it should be the port should be trivial and it would mean that releases of J3D could be made for Win32, Linux, and eventually MacOS, in pure Java.

Cas :slight_smile:

  • “official” coz I’m a project admin :stuck_out_tongue:

[quote]A cool move on Sun’s part would be to move J3D on top of LWJGL. I do not expect that there would be a measurable difference in performance. If it’s as well written as it should be the port should be trivial and it would mean that releases of J3D could be made for Win32, Linux, and eventually MacOS, in pure Java.
[/quote]
I’m pretty sure Sun has something like that below, implementing D3D and OpenGl. Maybe a bit more specific… :slight_smile:

But wouldn’t a port to LWJGL mean a serious restriction concerning the compliance with Swing, which is very important?
Haven’t looked into LWJGL deeply, but I got the impression that only one window is allowed? Quite tough restriction even for games, think of editors and such…

[quote]The only way to go is writing games FOR Java, not only in Java. That means NOT to concentrate on special effects but on modularity, on-line-awareness, extendability, exploit the rich technical environment: web, speech recognition, speech synthesis, scalable multi-purpose 3D engine, multiplatform (mobiles!).
[/quote]
Herkules, that’s why I keep on programming in Java! That’s why I believe that we can make a whole lot of awesome feature-rich games in Java and shake up the gaming industry! And that’s why it’s a shame not to have features that are standard in the C/C++ community. I personally find that J3D is very well implemented. I just can’t come to understand why such features haven’t been added yet. It should be easy enough for those experts in Sun! And I don’t care about the performance. Java3D is more than fast enough for me! And it’s fast enough for someone to make a great game!

Someone must wake them up. We have a great tool here (Java) and we can make so much out of it!

P.S. Cas, keep it up man. This community needs APIs like LWJGL.

It is indeed a fairly harsh restriction to ditch Swing but that’s what the LW & G in LWJGL is all about. Saves so much bother :slight_smile: and it is a sub-goal of the project to entirely divorce the library from the AWT.

As for multiple windows and editors and stuff - well, as Brian knows, that’s not a problem :smiley:

Cas :slight_smile:

[quote]However using LWJGL means you have to write all your own scenegraph and tools.
[/quote]
Indeed. And that’s the main reason Java3D is still lingering for my ‘real soon now’ project (and why I haven’t moved on contributing lwjgl input lib code… sorry).

Cas, you should consider a business model like this Canadian dude:

http://www.powerrender.com/

and formalize your built-upon-lwjgl stuff. Basically its:

** Free to play with a limited library(s)
** Small fee (<$100) to play with full libs and release free game.
** Non-devastating fee ($1500) per title for a commercial game.
** $5500 for full source, includes title fee. Most would probably be fine with the above choice.

He’s been doing it for a while, of course. Just a thought. I’d rather focus on the multiplayer aspects. I find lwjgl very appealling aside from the wheel reinvention part.

[quote]Still no-one has commercially bested my terrain demo written in the cranky precursor to LWJGL, even in C
[/quote]
I’d love to see it… said the guy with the Radeon board. (am I just behind the times?) I’m sure it’s gorgeous!

[quote]A cool move on Sun’s part would be to move J3D on top of LWJGL.
[/quote]
Nah, take my advice and plan on some corporation buying your modest company for an outrageous sum. (Don’t blame you for angling, though).

In the end it is the richness of the java platform that would be your best advertisement.

–Scott

I think to kepe up with the latest hardware trends like this you simply have to write your game using ‘dirty’ Java… that is make some native stub to get at the specific hardware feature… after all isn’t it going to be somewhat platform (graphics card) specific if you depend on such features anyway?

[quote]Cas, you should consider a business model like this Canadian dude:
[/quote]
<edited_out/>

I was typing a rather lengty paragraph about what lwjgl is all about and why it is BSD - but the same question remained:
Why should lwjgl be commercialized?

if lwjgl hadn’t been opensource, I doubt that it would be what it is today…

However Cas has taken lwjgl and build an awesome library on top (http://sourceforge.net/projects/spgl), which eases much of the work with lwjgl! - Which is exactly what we wanted - people to build on top of our foundation. Think of lwjgl as the community edition of a game toolkit, the pro version has just yet to be build :wink:

3 edits in 5 minutes sigh - need to think through before committing… hmm did that sound like some cvs thing ;D

[quote]Why should lwjgl be commercialized?
[/quote]
I wasn’t suggesting that.

[quote]if lwjgl hadn’t been opensource, I doubt that it would be what it is today…
[/quote]
I agree! It would probably be non-existent (unfunded) or better (funded). By ‘better’, I mean further evolved.

[quote]However Cas has taken lwjgl and build an awesome library on top (http://sourceforge.net/projects/spgl), which eases much of the work with lwjgl! - Which is exactly what we wanted - people to build on top of our foundation. Think of lwjgl as the community edition of a game toolkit, the pro version has just yet to be build :wink:
[/quote]
I’m not sure if you’re agreeing with me here or not I have no problem with paying for professional grade tools and/or libraries. (in fact, I’m ready to talk numbers about that terrain engine…) Btw, this is how he announced the spgl:

[quote]…SPGL sits on top of LWJGL.

All it is, is the continuously evolving set of helper classes that I’m actually using to write my game. Some of them are broken. Some of them never did work right. Some of them are obsolete. Most of them are just hacks. All of them are badly commented and undocumented…
[/quote]
Don’t get me wrong, this generous donation is a reaffirmation about what’s right with the open source philosophy. If only there was open source electricity, housing & food. blah blah blah. Seriously, it’s all about time. I would pay to have the docs, features and bug-fixes be in 2 months where they’d be in 12-18 months for free. He continues…

[quote]Please note that SPGL’s license is still “in the air”; I don’t intend to give it away to commercial developers but I would like it to be used by hobbyists. But most importantly, it’s in the open so everyone can see.
[/quote]
Again, it’s all about time. You could do what ID does, charge for the newest stuff then release it later. Whatever… I live in the same town as NDL, and a few miles from Epic games. In my game dev. life we’d pay serious $ for top-notch tools. This sort of commercial approach seems normal to me. Say hi to Snowball and Napoleon for me (kidding).

Well, maybe I should do some real work now (JNDI anyone?)

–Scott

Well it has to be said I’d be reaaaaally grateful for commercial interest in the SPGL :slight_smile: And even that terrain engine (there’s more going on in there than you can see in the demo, like pluggable materials and such)…

SPGL is slowly, slowly, slowly coming together to be a genuinely useful bunch of stuff but it does rather need some proper tools and testing, docco, tutorials, etc. etc. but if anyone’s interested in hiring me with a view to getting it used in a proper game, I’ll be your bitch. Provided you live somewhere in the Southwest of England :stuck_out_tongue: or have somewhere I can stay.

Cas :slight_smile:

So can’t you use JNI to do your shader stuff as someone suggested above (aka dirty Java)?

Not so easy (impossible?) in conjunction with Java3D!

[quote] I wasn’t suggesting that.
[/quote]
Doh! - indeed you weren’t - I just misread - my bad :-/

[quote]This sort of commercial approach seems normal to me.
[/quote]
Ahh and it is! But this is exactly why it is so great that lwjgl is so “lightweight” and that it is free. It gives the hobbyist (and pro if you want to) to use a relatively powerfull library (relative to what j2se has to offer) - and for the developers it is also a convinient way to develop the library without having users that expect a toll free number for support.

However a library like spgl could easily be commercialized, even though Cas would then have to support it’s users…

@Conzar

[quote]So can’t you use JNI to do your shader stuff as someone suggested above (aka dirty Java)?
[/quote]
Nope - you would have to use the gl extensions exposed by lwjgl. But theoretically anything you can do with ordinary OpenGL, is possible from lwjgl. Even cg (though I have no idea how to do that…)

Cg is nothing special really, API-wise that is. I use vertex programs written in Cg and compile them to GPU assembler or whatever it’s called and use it directly with the vertex program extension (ARB extension from opengl 1.4). With the Cg runtime API you have a more convenient interface to your compiled programs and parameter passing, but you really don’t need it. The Cg language is by far the most useful.

(Yes, I use vertex programs from java. Of some strange reason people can’t believe that is possible)

  • elias

Did I just hear someone voluntering for a small shader demo using lwjgl? ;D

I imagine that one nice way to go to integrate shader programs with java, either if it is Java3D, LWJGLWL or whatever, could be to have a small compiler (we already have some if these for XML, SOAP, RMI,…) that converts the readily build shader program into a nice Java class, maybe as a source file. The class just incorporates the binary data for the shader.

For Java3D, this could be derived from NodeComponent or Appearance, whatever,…

For other libs accordingly.

One drawback currently appear to me that shader specs move faster than any other system, and for sure MUCH faster than Java3D. Sun is well advised to schedule their shader integration to a point where a real shader standard exists.

[quote] One drawback currently appear to me that shader specs move faster than any other system, and for sure MUCH faster than Java3D.
[/quote]
This isn’t a problem for lwjgl, since the intentions is to release a new version rather quickly, when ever changes occurs to either OpenGL or OpenAL. I’d imagine the vector package won’t need updates due to changes in Math theory :slight_smile: