Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2 3
  ignore  |  Print  
  Shaders,shaders,shaders...  (Read 11986 times)
0 Members and 1 Guest are viewing this topic.
Offline Spasi
« Posted 2002-11-19 11:41:53 »

Hello guys,

If you haven't already, please take a look at nVidia's new GeForce FX demo screenshots, at http://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  Huh
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #1 - Posted 2002-11-19 12:30:05 »

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.

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #2 - Posted 2002-11-19 12:33:23 »

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?  Grin

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Breakfast

Senior Member




for great justice!


« Reply #3 - Posted 2002-11-19 13:48:07 »

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.
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #4 - Posted 2002-11-19 14:18:18 »

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 Smiley

* "official" coz I'm a project admin Tongue

Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #5 - Posted 2002-11-19 15:07:50 »

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.


I'm pretty sure Sun has something like that below, implementing D3D and OpenGl. Maybe a bit more specific.... Smiley

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...


HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline Spasi
« Reply #6 - Posted 2002-11-19 15:57:07 »

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!).


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.
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #7 - Posted 2002-11-19 17:12:39 »

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 Smiley 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 Cheesy

Cas Smiley

Offline scottw

Junior Newbie





« Reply #8 - Posted 2002-11-20 04:00:22 »

Quote
However using LWJGL means you have to write all your own scenegraph and tools.

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


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.


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
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #9 - Posted 2002-11-20 04:23:37 »

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?

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #10 - Posted 2002-11-20 05:08:43 »

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


<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  Grin

Offline scottw

Junior Newbie





« Reply #11 - Posted 2002-11-20 12:00:06 »

Quote
Why should lwjgl be commercialized?

I wasn't suggesting that.

Quote
if lwjgl hadn't been opensource, I doubt that it would be what it is today...

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


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...


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.


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


Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #12 - Posted 2002-11-20 14:08:34 »

Well it has to be said I'd be reaaaaally grateful for commercial interest in the SPGL Smiley 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 Tongue or have somewhere I can stay.

Cas Smiley

Offline Conzar

Junior Member




There is nothing common about common sense


« Reply #13 - Posted 2002-11-20 17:04:16 »

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

Ubuntu
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #14 - Posted 2002-11-20 19:59:38 »

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

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #15 - Posted 2002-11-20 20:13:43 »

Quote
I wasn't suggesting that.

Doh! - indeed you weren't - I just misread - my bad  :-/

Quote
This sort of commercial approach seems normal to me.

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)?

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...)

Offline elias

Senior Member





« Reply #16 - Posted 2002-11-20 20:30:04 »

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

Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #17 - Posted 2002-11-20 20:48:02 »

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

Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #18 - Posted 2002-11-20 21:38:34 »

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.

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #19 - Posted 2002-11-21 04:04:20 »

Quote
One drawback currently appear to me that shader specs move faster than any other system, and for sure MUCH faster than Java3D.

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 Smiley

Offline elias

Senior Member





« Reply #20 - Posted 2002-11-21 13:36:26 »

Ok to stomp out every doubt that vertex shaders with java/lwjgl is possible, I added a shader demo ported from the Cg shader from

http://www.cgshaders.org/shaders/show.php?id=11

to current lwjgl cvs. If you don't like cvs, you can get it from

http://odense.kollegienet.dk/~naur/grassshader.zip

Because the demo needs some bug fixes in the linux version of lwjgl (hey the linux port is still young!), I added fresh linux libraries to the zip archive. The port should look like the one on the cgshaders.org page*, however the java version does not use the Cg runtime like the original. Partly because the Cg runtime is not nescessary but mostly because the is no Cg runtime bindings in lwjgl (yet). Likewise, the teapot in the original is gone from the java version (it uses glut).

Anyway, if it runs on your machine, you are looking at a vertex shader in java/lwjgl! It runs like crap on my GeForce2 mx (vertex shaders runs in software on those), so make sure you've got something bigger.

* I don't have a windows machine so I might be wrong.

- elias

Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #21 - Posted 2002-11-21 13:36:29 »

As Herkules says it's not really feasible as Java3D is a "closed" system in the sense that it works because it has a known set of capabilities built in to it which is formulates its scenegraphs with. If you went ahead and just stuck in some arbitrary rendering code straight to GL (or even DX should you mysteriously prefer that version!) it would almost certainly screw things up from that point onwards.

The best thing to do with J3D is accept its limitations and code to them as best you can. When a new version comes out with lots of new things in it - and you can bet they won't rest on their laurels forever - start playing with the new stuff.

Cas Smiley

Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #22 - Posted 2002-11-21 13:44:58 »

Quote
Ok to stomp out every doubt that vertex shaders with java/lwjgl is possible, I added a shader demo ported from the Cg shader from


Never was in doubt about that.....

Could you briefly sketch how the information flows from the Cg source code to the OpenGL-binding?

CgSource -> compile -> file??

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline elias

Senior Member





« Reply #23 - Posted 2002-11-21 13:51:32 »

Yes you have a file with Cg source code and run it through a Cg compiler with a selected profile (I.e. which chipset you want to use and what kind of shader - vertex or fragment). From that you get output that can be fed directly to glLoadProgramNV.

Then you need to define all the constant ("uniform" in Cg jargon) parameters to the program through glProgramParameter and you're running. The easy way is to use the Cg runtime API to define the program parameters, because you can use the same symbolic names given in your Cg source code. The slightly more difficult way (used in the shader demo) is to look at the output from the compiler and determine at what addresses each parameter lies in.

- elias

Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #24 - Posted 2002-11-21 14:04:56 »

Ah, saw it.

1.) cg_grass2.cg compiles to cg_grass2.vp
2.) cg_grass2.vp is loaded from file into a ByteBuffer
3.) the ByteBuffer is given to the OpenGL runtime


My idea from above now: have a compiler that generates source for a class cg_grass2.java that does all this? Should be simple!

And a corresponding approach would work for (next release of) Java3D as well.


HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #25 - Posted 2002-11-21 14:12:24 »

Quote
Likewise, the teapot in the original is gone from the java version (it uses glut).


Are there any plans to add Glut to LWJGL? I'll admit that my main reason for this is to get a generated teapot though..   Grin

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #26 - Posted 2002-11-21 14:49:31 »

Ahhh, glutSolidTeapot old friend.  How I miss thee... Grin

Hellomynameis Charlie Dobbie.
Offline zparticle

Senior Member




Thick As A Brick


« Reply #27 - Posted 2002-11-21 15:55:34 »

Am I just being a twit? I can't get the grass demo to run.

using: java -cp .;./lwjgl.jar Grass

I get:
1  
2  
3  
4  
5  
6  
7  
8  
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
        at java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.lang.Runtime.loadLibrary0(Unknown Source)
        at java.lang.System.loadLibrary(Unknown Source)
        at org.lwjgl.Sys.initialize(Sys.java:110)
        at org.lwjgl.Sys.<clinit>(Sys.java:89)
        at org.lwjgl.Display.<clinit>(Display.java:49)
        at Grass.<clinit>(Grass.java:24)

using: java -jar Grass.jar

I get:
1  
2  
Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/Display
        at Grass.<clinit>(Grass.java:24)


Offline elias

Senior Member





« Reply #28 - Posted 2002-11-21 16:12:24 »

You probably need to have the native libraries in place, in your case (windows) lwjgl.dll and OpenAL32.dll in c:\winnt (or similar). The lwjgl.jar is just the java part of the binding.

NOTE: I only included the linux libraries because no linux release exists that can run the demo. For windows you need to get the files from

http://java-game-lib.sourceforge.net

- elias

Offline zparticle

Senior Member




Thick As A Brick


« Reply #29 - Posted 2002-11-21 16:30:33 »

Yeah, I put them in the same directory and added . to the path. Still no go, hmmm.

Pages: [1] 2 3
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

E.R. Fleming (12 views)
2014-07-29 03:07:13

E.R. Fleming (4 views)
2014-07-29 03:06:25

pw (39 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (50 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23

MustardPeter (44 views)
2014-07-16 23:30:00
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!