Support for geometry and tesselation shaders (diff)

Hello,

Since JME3 has still no support for hw tesselation, I decided to do it myself.



Here’s the patch : http://pastebin.com/mNQnTv5z

It’s based on today’s nightly builds (jME3_2012-05-20)



What’s new:

–add com.jme3.renderer.Caps enums : OpenGL40, GLSL400 andTesselationShade.

–add Geometry, TesselationControl and TesselationEvaluation enums to com.jme3.shader.Shader.ShaderType

–add GeometryShader, TessControlShader and TessEvaluationShader as usable shader types in j3md (they of course are optional)

–add Patches to Mesh.Mode and patchVertices to Mesh.

–makes some changes to DesktopAssetManager, ShaderKey, Technique and TechniqueDef to load every shaders.

–change LwjglRenderer to add specific OpenGL enums



How to use:

To have use geometry shader, simply add

GLSL150 GeometryShader : MatDefs/…/shader.geom

inside a technique definition of your j3md. TessControlShader and TessEvaluationShader works the same. The file extension I used is .geom, .tsctrl and .tseval (you can change it in Desktop.cfg)



Hardware requirement:

Geometry shaders needs openGL 3.2 whereas tesselation need openGL 4.0.



Notes that tesselation requires meshes to be drawn using the Patches mode.

If your not familiar with the openGL 4.0 pipeline, read this : http://prideout.net/blog/?p=48



There is two small tests. The first show some basic geomerty shaders, and the second is about tesselation (it’s actually based on the link given above). http://www.4shared.com/zip/OabGW8M2/test.html



PS: I’m not very skilled in english so please forgive my poor speaking.



EDIT: edited the patch, as it missed the ‘com/’ of every file path)

17 Likes

Wohaaa puking rainbows and stuff ^^ Really cool, cant wait to try a few things to improve my terrain material with this.

1 Like

Cool, thanks very much! Our shader wizards will have to take a look at this but I hope it can be integrated :slight_smile:

hooo thanks!!

a very nice contribution!

This is really sweet :slight_smile: bad thing is that It can’t be used on a mac… but that’s another story… grrrrr

Hm apples does not support them? Or is there no compatible graficcard?

Its OpenGL 4 afaik, only OpenGL 3 is fully supported on osx atm. OpenGL cards on OSX are always a bit special as they have their own hardware extensions and Apple provides the driver in the OS.

@normen said:
Its OpenGL 4 afaik, only OpenGL 3 is fully supported on osx atm. OpenGL cards on OSX are always a bit special as they have their own hardware extensions and Apple provides the driver in the OS.


That's the perfect example of why I've never trusted and will never trust Apple. They HAVE to have a hand on everything. Like they were the only ones who can make perfect software. Oh wait... No such thing.

No flame wars please. Just stating a fact.

Peace. :)
4 Likes
@madjack said:
No flame wars please. Just stating a fact.

lol..."i just dropped a bomb but please don't be childish enough to retaliate..."

I’m not opposed to healthy discussion or exchange, just no flame wars. :slight_smile:

@normen said:
Its OpenGL 4 afaik, only OpenGL 3 is fully supported on osx atm. OpenGL cards on OSX are always a bit special as they have their own hardware extensions and Apple provides the driver in the OS.


AFAIK they only support OpenGL 2, but almost all extensions needed for OGL 3 is available..

awww poor mac owners

ah well luckily the rest of us can sleep happy tonight :slight_smile:

3 Likes
@wezrule said:
ah well luckily the rest of us can sleep happy tonight :)

Don't cheer too soon, the shadow lord says this contribution needs a lot of work to be integrated :/

@madjack said:
That's the perfect example of why I've never trusted and will never trust Apple. They HAVE to have a hand on everything.

Its exactly why I do trust them :) I understand why they do or don't do things. We're the same, we also say "use the SDK, do everything like we tell you to and if you wanna do something we don't have an answer to then don't hope for much help from us for now". With 3rd party software you see bad threading and such things much more often, its clear the OS developers can make the best software and drivers for their OS. Windows gets unstable because of all the 3rd party drivers thats why I look for devices using standards and the default OS drivers for mac first. Latest example is a new MIDI driver from MOTU (which is a company that develops for MacOS for a loong time now) I recently installed on a theater mac, they basically fucked up the threading so that some messages get dropped. Nice, thanks very much!

Just like the jme3 devs probably make the most standards-based AppStates etc., not making any threading or logic mistakes while with some code flying around on the web you find AppStates basically reimplemented worse or totally abused ;). What exactly is untrustworthy about wanting everything to work great? Did you ever look at the API of OSX compared to the abomination Microsoft calls API in windows? Even if the windows devs say "well apple's got it easy, we have to support like a billion possible configurations".. They don't exactly make it easy for themselves with 4 driver models, 6 highlevel APIs (ActiveX, .Net and whatnot) and 20 different ways to plug into the OS. When I look at this I get the feeling theres some pretty good developers working at apple and that if they decide stuff it probably makes a lot of sense.

If its about _trust_ I do trust them more than many other companies in that what they say is what they do (they never used their users data for anything but the product itself, AppStore seems completely logical to me given what I said above and they say about it themselves etc.). I mean jME for example basically works on all macs while the experience on PC can be vastly different even with the same graphics card. So who delivered the properly working system here? If OpenGL 4 support only works on 20% of the 40% of PC's that work without problems its kinda marginalized ;)

@kwando said:
AFAIK they only support OpenGL 2, but almost all extensions needed for OGL 3 is available..

Nah, Lion should support OpenGL3 completely I think.
2 Likes

@normen I do get and understand your point, but free market is about having choices. Not an “overlord” that will do and decide what’s good for you. Apple exemplifies that. They don’t have everything wrong. Just like Microsoft. It could be argued both ways actually. And yes, I do think MS is entirely responsible for the sad mess it put itself into. Look at how dismal IE6/7/8/9 are and were. Their “implementation” of CSS, HTML back in the day, etc. No need to give more examples. But! Microsoft knows that the best persons in the industry to make a device driver for X hardware is its manufacturer. DOS was an abyss of low-level drivers that were hell incarnated. With the advent of win 95 (yes, going far out back) they put their foot down and said they were not making specialized drivers anymore because of the plethora of devices available. It was simply impossible to keep up to date.



At that point the only thing they made were generic drivers. For sure your device would work, but only the most basic of function would. Anything gravy, you could only get from using the manufacturer’s drivers.



With Apple, if it’s not “Apple Certified, approved, paid for, blah blah” you’ll have to wait until it is.



We can push it even farther with their App Store. If you submit something there is has to be approved. Ok, fine. I get what they’re trying to do here, but if you do something like this, you have to go all the way. How many times I have read that an app on the app store was a copy of another game (or app) ported on iOS by someone who didn’t have the rights to do so? Too many times. If they want to control that market (sounds familiar?) they should do it right, not in a half-ass way. It takes them weeks even months, literally, before they do anything. Technically what they’re doing is right (not because I approve that, because it’s what they’re already doing it), their implementation is not though. Of course the fault might be some idiot who don’t give a crap, but there are so many apps slipping through the cracks that it would be hard to believe one man was responsible.



Apple wants the exclusive right to everything. Look at the Amazon eBook scandal where it was, pretty much, proven that Apple started the bandwagon, colluding with the 5 biggest book editors into manipulating book prices because they didn’t want Amazon to lower their prices because they would lose too much in the Bookstore of theirs. It’s even in Steve Jobs biography (which I haven’t and will never read) which was quoted in many places.



Ok… lol Sorry for going on a rant like that. But, those are the main reasons why I really really don’t like Crapple.

3 Likes

Oh and yes. You are totally right about Windows and settings fubared. But you can’t blame MS.



How many times have I had to fix a computer because some airy-head idiot decided to “fix his/her registry”… Or manually changing permissions. Or installing spy-ware or trojans or, you get my point.



I’m sure if I get a Mac and stab at permissions and eff the settings up I’ll get the same deal you’re currently seeing on Windows. But that’s not the OS’s fault, it’s the users’.



Maybe it has to do with these users in the first place. Who knows. Maybe Apple users are simply happy that it works and don’t go on a rampage changing system settings and modifying what’s Apple for “registry”. shrug

2 Likes
@madjack said:
Ok... lol Sorry for going on a rant like that. But, those are the main reasons why I really really don't like Crapple.

Yeah, it always comes down to such strange hate, I feel I talk about macs more because others make me than because I am psyched by their products ^^

Book store I'd maybe give you (being a "fanboy" I can tell myself its another department ;)) but the AppStore? Come on, android app store proved 100 times over what apple predicted, even if theres still loopholes for some things obviously but they also do learn.

For the hardware / driver thing.. I happily give away a bit of "performance" for a stable system, really. Theres no use for performance if you can't perform ;) That it takes longer is also a given, just like the jME3-core-developer solution for some new tech also takes longer than the first people hacking it into their jme3 copies (just like in this example here).

And for the "want control". Apple is happily giving away all areas where they don't have a solution to companies that do (e.g. theres no macs in plain "text based" offices or controlling machinery in a factory) and also the areas where people don't want to pay what apples products cost are given away freely. No tries to make half-assed products to take away part of the share, its either good or they leave the field to others. They just would not do it if it wasn't working like DisneyLand and the AppStore, "closed" OS and own drivers way is the only way to do that, plain and simple. Thats what I hear and see when I look at apple and use their products. I can get it might look very different from "outside" though and that it might induce fear given the experience of years being fooled by Microsoft that PC's have to mean work just to.... work :)

Edit:

@madjack said:
I'm sure if I get a Mac and stab at permissions and eff the settings up I'll get the same deal you're currently seeing on Windows. But that's not the OS's fault, it's the users'.

If the OS is so shitty that it has to make the option public and cannot manage it itself then yes, it is the OS's (manufacturers) fault. There simply is no such "killswitches" on mac.
@normen said:
Yeah, it always comes down to such strange hate, I feel I talk about macs more because others make me than because I am psyched by their products ^^

Yes. I agree. :)

One important note though. I don't have anything against the Apple hardware itself (not anymore though, but years ago, yeah). My huge and main gripe is about Apple's control-freak attitude. But, I guess the company takes after one of its main founder... FYI, if you didn't know, Jobs was a titan as far as control-freakishness is concerned. It's always reflected in the company to be quite frank. So no wonder when you all think about it.


Book store I'd maybe give you (being a "fanboy" I can tell myself its another department ;))

Sadly, this was coming directly from Steve Jobs' office.


but the AppStore? Come on, android app store proved 100 times over what apple predicted, even if theres still loopholes for some things obviously but they also do learn.

I didn't say it was a bad idea. On the contrary. I'm just saying if you are to control it, do it properly. Nothing should slip through. Zero. And, if something did, Apple should apologize and accept the responsibility and pay back any loss. They would expect that if the roles were reversed.


For the hardware / driver thing.. I happily give away a bit of "performance" for a stable system, really.

In the end that's a question of choice. If you have the choice to get different drivers (more stable let's say) then go for it. But if you're stuck because some programmer couldn't figure out what the manufacturer could've done, then you shouldn't be allowed to touch that thing.

Hardware manufacturers that can't support their own crap are gone (mostly) or are barely subsisting if at all. In the end if they had a good idea they were bought. It's as clear as that. Do good hardware but crappy drivers? Say goodbye 'cause you'll soon be gone.


And for the "want control". Apple is happily giving away all areas where they don't have a solution to companies that do.

I'll give them that. They're learning to let go. It's a slow process, but hopefully you guys will harvest the fruit of that.


If the OS is so shitty that it has to make the option public and cannot manage it itself then yes, it is the OS's (manufacturers) fault. There simply is no such "killswitches" on mac.

I'm sure there are countless way to screw up a Mac. I'm sure there are tools and whatnot that can readily cripple any Macs. But, let's not forget one thing here, there's what, 10x more Windows users? If not more. Windows machines are cheaper than Macs. So, everyone can improvise themselves "repairmen" and "fix" their computers. Also, there is a whole lot more resources available to fix (and break) Windows. So, in the end, it comes down to readily available information, and the dissemination of information. In other words, it's a whole lot easier to find info on how to "break" your windows than it is for the Mac. Besides, being more expensive, this means less kids experimenting... Following that logic, I would imagine (most) Mac users are "wiser".
1 Like

Trolls…

@nehon said:
Trolls....


We're not trolls, we're thread hijackers. :P

WoW, I was really wanting to use geometry shaders a while ago, but didn’t have the energy to start from scratch with jME. Big cheers from me!