Non-photorealistic shaders
Moderators: Omega, tillias, Mod Contributor
-
- Trader
- Posts: 17
- Joined: Sat May 17, 2008 8:13 am
Non-photorealistic shaders
Rainy day, so I ported some NPR shaders for fun.
1. Cell shader
2. Hatching shader, as per the orange book
To install & try out just backup the original files from the 'programs' dir and copy over the vertex shader and one of the fragment shaders. Copy them over the 'highend' shaders or whatever your configuration uses.
Questions for developers (i.e. someone who knows where to look, what to change):
1. Seems some objects don't seem to be using shaders at all (mostly Ox vessels)?
2. These NPR shaders would be nicely supplemented by thick outlines - this requires that the z-buffer queue objects be drawn twice - any directions where the relevant code is?
3. The cell shader needs just flat color models (i.e. no textures). It seems the default color (gl_color or so) is not the right choice, so I took just one fixed point from the diffuse color texture - any better way to do it?
1. Cell shader
2. Hatching shader, as per the orange book
To install & try out just backup the original files from the 'programs' dir and copy over the vertex shader and one of the fragment shaders. Copy them over the 'highend' shaders or whatever your configuration uses.
Questions for developers (i.e. someone who knows where to look, what to change):
1. Seems some objects don't seem to be using shaders at all (mostly Ox vessels)?
2. These NPR shaders would be nicely supplemented by thick outlines - this requires that the z-buffer queue objects be drawn twice - any directions where the relevant code is?
3. The cell shader needs just flat color models (i.e. no textures). It seems the default color (gl_color or so) is not the right choice, so I took just one fixed point from the diffuse color texture - any better way to do it?
You do not have the required permissions to view the files attached to this post.
-
- Elite
- Posts: 7243
- Joined: Mon Apr 18, 2005 2:40 pm
- Location: LS87, Buenos Aires, República Argentina
-
- Trader
- Posts: 17
- Joined: Sat May 17, 2008 8:13 am
-
- Elite
- Posts: 7243
- Joined: Mon Apr 18, 2005 2:40 pm
- Location: LS87, Buenos Aires, República Argentina
-
- Trader
- Posts: 17
- Joined: Sat May 17, 2008 8:13 am
I looked at the code and the sample xml files. It seems quite powerful, but unfortunately there are some things I can't control from the xml.klauss wrote: The code that implements that is spread over src/gfx/{techniques,mesh_gfx,mesh_xml}.{h,cpp}
The outlining algorithm I use works as follows --
1. set wireframe mode ... glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
2. set thick lines ... glLineWidth(4.f);
3. set front face culling ... glCullFace(GL_FRONT);
4. set '<' for z-buffer ... glDepthFunc(GL_LESS);
5. draw the model.
6. set polygon mode ... glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
7. set back face culling ... glCullFace(GL_BACK);
8. set '<=' for z-buffer ... glDepthFunc(GL_LEQUAL);
9. draw the model again.
If you wish & give some further advice I can add that kind of control into the techniques model... or just wait till someone does.
-
- Lead Network Developer
- Posts: 2560
- Joined: Sun Jan 12, 2003 9:13 am
- Location: Palo Alto CA
- Contact:
-
- Elite
- Posts: 7243
- Joined: Mon Apr 18, 2005 2:40 pm
- Location: LS87, Buenos Aires, República Argentina
-
- Elite
- Posts: 8014
- Joined: Fri Sep 05, 2003 4:03 am
- Location: Montreal
- Contact:
Wouldn't 3D textures be useful, anyways, for things like volumetric effects, and perhaps object-to-object (such as ship-to-landing pad) ambient shadowing? I known nothing about them; just asking.
Latest version of Cinemut Opaque
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
-
- Elite
- Posts: 7243
- Joined: Mon Apr 18, 2005 2:40 pm
- Location: LS87, Buenos Aires, República Argentina
-
- Trader
- Posts: 17
- Joined: Sat May 17, 2008 8:13 am
The Perlin noise is exactly what I need. Alternatively, it can be easily generated on program start instead of loading from file. 64^3 floats take just about 1 mb of RAM if i count correctly. Maybe it would be also useful for natural phenomena like clouds (space, atmospheric) or engine jets flow.klauss wrote:3D textures are falling out of use. Thing is, the memory requirements for them are enormous. Up to now, the only useful thing they provide is for 3D noise, but that can also be faked with perlin noise (all you need is 3 1D textures - or 1 2D with Nx3 - and a ps3.0 capable card).
-
- Elite
- Posts: 7243
- Joined: Mon Apr 18, 2005 2:40 pm
- Location: LS87, Buenos Aires, República Argentina
There was a way to implement perlin noise computing half on the CPU or offline, put that into a random Nx3 (N can be whatever you want) texture, and then using the three textures in sequence in a shader to finish off the calculation. If you ask me, that's far superior than a 3D texture, because it's actual perlin noise (and not a repeating pattern based on perlin noise).
Let me google it up again.
Let me google it up again.
-
- Elite
- Posts: 7243
- Joined: Mon Apr 18, 2005 2:40 pm
- Location: LS87, Buenos Aires, República Argentina
-
- Developer
- Posts: 2150
- Joined: Mon Apr 23, 2007 1:17 am
- Location: Pennsylvania
- Contact:
Now that has me happy. We need a shader that does this cartoon effect but with much more of a flat look to things for the Retro mode.
We can tone down detail, use low res mipmaps as the base for loading textures, but the lighting still makes the game look too advanced, even with shaders disabled. It would be ideal to have a shader that can make the game look cartoony like that but with like a pallette (if at all possible), or at least a nullification of lighting effects. It's too bad we cant pixelize things, no matter what i tried to reduce the smoothing of edges, it never approached the look of old non-3d accelled games.
That would look kick ass.
BTW, retro mode isn't for crappy video cards and such. It's a way to play the game through the emulated look of old releases of privateer and wing commander.
This cartoon mode could make the game look extremely close to wing commander 3. Which would be amazing as right now, it looks like crap.
We can tone down detail, use low res mipmaps as the base for loading textures, but the lighting still makes the game look too advanced, even with shaders disabled. It would be ideal to have a shader that can make the game look cartoony like that but with like a pallette (if at all possible), or at least a nullification of lighting effects. It's too bad we cant pixelize things, no matter what i tried to reduce the smoothing of edges, it never approached the look of old non-3d accelled games.
That would look kick ass.
BTW, retro mode isn't for crappy video cards and such. It's a way to play the game through the emulated look of old releases of privateer and wing commander.
This cartoon mode could make the game look extremely close to wing commander 3. Which would be amazing as right now, it looks like crap.
Ed Sweetman endorses this message.
-
- Elite
- Posts: 8014
- Joined: Fri Sep 05, 2003 4:03 am
- Location: Montreal
- Contact:
I want to inject a contrarian post, here; and a dire warning.
I noticed this thread earlier and refused to get involved, as Vegastrike is not my mod, and you can do anything you want; but because of this thread, today PU was attacked, at our own forum, by the viral idea of toon shading. We're fighting back and I think we will succeed; --and no; I'm not accusing anyone of evil intentions; I know people want to do "cool things". But it's highly disruptive and unwelcome stuff. And I'm saying this in the name of WC mods; yes: You want toon shading? Then do your own mod; leave us alone!
My dire warning is that if you guys (Vegastrike) even just experiment with this stuff in a public way, the virus will take hold. If you offer toon-shading, even as an option, there will be players who will like it and insist on having that option for all time to come. So, it's a one-way street, IMO.
And what's wrong with having a toon-shading option for all time to come?
It will dilute Vegastrike. A gaming news site or a reviewer wanting to show a screenshot won't be able to decide what's the look of Vegastrike, so he or she will either show plain-Vegastrike AND toon-Vegastrike side by side, or, more likely, neither one. It would be a statement like saying "we don't know how we want our game to look, so we're letting the users choose".
Mighty BAD policy, if you ask me.
A disruptive thread.
I noticed this thread earlier and refused to get involved, as Vegastrike is not my mod, and you can do anything you want; but because of this thread, today PU was attacked, at our own forum, by the viral idea of toon shading. We're fighting back and I think we will succeed; --and no; I'm not accusing anyone of evil intentions; I know people want to do "cool things". But it's highly disruptive and unwelcome stuff. And I'm saying this in the name of WC mods; yes: You want toon shading? Then do your own mod; leave us alone!
My dire warning is that if you guys (Vegastrike) even just experiment with this stuff in a public way, the virus will take hold. If you offer toon-shading, even as an option, there will be players who will like it and insist on having that option for all time to come. So, it's a one-way street, IMO.
And what's wrong with having a toon-shading option for all time to come?
It will dilute Vegastrike. A gaming news site or a reviewer wanting to show a screenshot won't be able to decide what's the look of Vegastrike, so he or she will either show plain-Vegastrike AND toon-Vegastrike side by side, or, more likely, neither one. It would be a statement like saying "we don't know how we want our game to look, so we're letting the users choose".
Mighty BAD policy, if you ask me.
A disruptive thread.
Last edited by chuck_starchaser on Fri May 23, 2008 5:52 pm, edited 1 time in total.
Latest version of Cinemut Opaque
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
-
- ISO Party Member
- Posts: 387
- Joined: Tue Mar 21, 2006 2:37 pm
- Location: Netherlands
- Contact:
I think your overreacting big time Chuck.
Very odd to see toon shading as a virus.
Since when are options and choice seen as bad things?
I knew console games were getting dumber all the time, but I must have missed the latest trend of, we must remove all options and choice from our games or people won't understand and die of a severe case of too many possibilities.
Before making these statements do a search on reviews with games that offer multiple shading options and than try to find ONE that confirms your fears.
Very odd to see toon shading as a virus.
Since when are options and choice seen as bad things?
I knew console games were getting dumber all the time, but I must have missed the latest trend of, we must remove all options and choice from our games or people won't understand and die of a severe case of too many possibilities.
Before making these statements do a search on reviews with games that offer multiple shading options and than try to find ONE that confirms your fears.
-
- Trader
- Posts: 17
- Joined: Sat May 17, 2008 8:13 am
For these shaders the pattern is more than enough. But would you have a link describing that technique?klauss wrote:There was a way to implement perlin noise computing half on the CPU or offline, put that into a random Nx3 (N can be whatever you want) texture, and then using the three textures in sequence in a shader to finish off the calculation. If you ask me, that's far superior than a 3D texture, because it's actual perlin noise (and not a repeating pattern based on perlin noise).
Let me google it up again.
Glad you all like the NPR shaders. I'll play with them some more and post the achievements.
Could you elaborate that a little?safemode wrote:We can tone down detail, use low res mipmaps as the base for loading textures, but the lighting still makes the game look too advanced, even with shaders disabled. It would be ideal to have a shader that can make the game look cartoony like that but with like a pallette (if at all possible), or at least a nullification of lighting effects. It's too bad we cant pixelize things, no matter what i tried to reduce the smoothing of edges, it never approached the look of old non-3d accelled games.
-
- Elite
- Posts: 8014
- Joined: Fri Sep 05, 2003 4:03 am
- Location: Montreal
- Contact:
I'm not overreacting at all. Under-reacting if anything. Remember I'm a modeler AND a texturer, as well as a shader programmer. And as an artist I have to have a clear goal of what I want a ship to look like. And what IS the goal, if there are choices of shaders?DualJoe wrote:I think your overreacting big time Chuck.
Very odd to see toon shading as a virus.
Since when are options and choice seen as bad things?
I knew console games were getting dumber all the time, but I must have missed the latest trend of, we must remove all options and choice from our games or people won't understand and die of a severe case of too many possibilities.
Before making these statements do a search on reviews with games that offer multiple shading options and than try to find ONE that confirms your fears.
Choice is not a good thing by definition under all circumstances. That's a fallacy.
That's like you make a statue or piece of art, and then anyone is given the choice to paint it differently.
I want MY ships to look the way I intended for them.
Choice my ass!
And this is also part of my dire warning:
Have shader choices, and all self-respecting artists will leave. I know I would.
Latest version of Cinemut Opaque
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
-
- ISO Party Member
- Posts: 387
- Joined: Tue Mar 21, 2006 2:37 pm
- Location: Netherlands
- Contact:
First you describe a perfectly reasonable shader option for a large part of the WC-universe as a disease and now you threaten to leave if people ever get the option?chuck_starchaser wrote:That's like you make a statue or piece of art, and then anyone is given the choice to paint it differently.
I want MY ships to look the way I intended for them.
Choice my ass!
And this is also part of my dire warning:
Have shader choices, and all self-respecting artists will leave. I know I would.
Since you mention fallacies you probably know that you just put up two. The latter being an ad baculum and not a very convincing one at that.
You don't have to explain to me what you are doing. I'm currently the only other active artist and I'm not leaving over something as trivial as an optional shader.
If this isn't overreacting I wonder what you consider is.
-
- Elite
- Posts: 8014
- Joined: Fri Sep 05, 2003 4:03 am
- Location: Montreal
- Contact:
Sure, attack me personally; that's going to go far.DualJoe wrote:First you describe a perfectly reasonable shader option for a large part of the WC-universe as a disease and now you threaten to leave if people ever get the option?
Since you mention fallacies you probably know that you just put up two. The latter being an ad baculum and not a very convincing one at that.
It's an overly late reaction. People offering disruptive ideas shouldn't get a pat in the back. There's been gazillions of really good ideas offered in these forums, that were ignored. But like I said, Vegastrike is not my mod, and I stayed out of it earlier; perhaps I shouldn't have. But like it was in my nightmare scenario, the toon shader virus idea appeared at the PU board.If this isn't overreacting I wonder what you consider is.
Latest version of Cinemut Opaque
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
-
- Expert Mercenary
- Posts: 988
- Joined: Thu Jun 15, 2006 1:02 am
- Location: Somewhere in the vastness of space
- Contact:
It surprises me how many times people are fighting over different points of view even when they are compatible. If I place a jar behind a glass between me and you, then the jar is behind the glass, period, no point discussing, even if you insist that the glass is behind the jar. You're getting me, I guess.
VS is a strange kind of animal, being at the same time a game and a modding engine. Putting myself in the different shoes, I can only agree to both views expressed in this thread. Supporting mods is a good choice and any shader (even if it's maccaroni) should be provided as an option to those willing to engage in this kind of extraordinary endeavors. However, when speaking about VS The Game, there is NO WAY I would EVER like to neither develop nor play "Toons In Space".
Hugh.
VS is a strange kind of animal, being at the same time a game and a modding engine. Putting myself in the different shoes, I can only agree to both views expressed in this thread. Supporting mods is a good choice and any shader (even if it's maccaroni) should be provided as an option to those willing to engage in this kind of extraordinary endeavors. However, when speaking about VS The Game, there is NO WAY I would EVER like to neither develop nor play "Toons In Space".
Hugh.
-
- Developer
- Posts: 2150
- Joined: Mon Apr 23, 2007 1:17 am
- Location: Pennsylvania
- Contact:
ok, wow. I wasn't aware that you had to choose one over the other. (/sarcasm) If the developers are "misguided" enough to replace regular gameplay with this type of shader as a normal option, then maybe it's time to come over to the dark side of vegastrike and work for us
"Toon shading" wouldn't be an option to play in VS with any mode other than Retro. This means really bad looking everything, as is intended to emulate the paletted look of pre WC3 games. It would not be something the user could easily make use of to play in High Quality mode but with crazy "toon" shader. Additionally, I wasn't suggesting using the shader as displayed in the forum, but modified to give the old pre-WC3 look, rather than it's current hand painted look.
Important:
I see this non-realistic shader as a tool to turn back the graphics quality clock without heavily recoding and modifying the source code for the Retro Mode (a mode which has always existed, but until now always broken). It would not be a shader that would be independently selectable.
You just have to realize that there are some users who want to play the game a little with the look of those old games. It's not a large group of people, and they usually dont play around for very long in that mode, but hey, if you can give a group of users what they want with minimal impact on the rest of the users, why not? There is no chance of it ever becoming the preferred way to play the game.
"Toon shading" wouldn't be an option to play in VS with any mode other than Retro. This means really bad looking everything, as is intended to emulate the paletted look of pre WC3 games. It would not be something the user could easily make use of to play in High Quality mode but with crazy "toon" shader. Additionally, I wasn't suggesting using the shader as displayed in the forum, but modified to give the old pre-WC3 look, rather than it's current hand painted look.
Important:
I see this non-realistic shader as a tool to turn back the graphics quality clock without heavily recoding and modifying the source code for the Retro Mode (a mode which has always existed, but until now always broken). It would not be a shader that would be independently selectable.
You just have to realize that there are some users who want to play the game a little with the look of those old games. It's not a large group of people, and they usually dont play around for very long in that mode, but hey, if you can give a group of users what they want with minimal impact on the rest of the users, why not? There is no chance of it ever becoming the preferred way to play the game.
Ed Sweetman endorses this message.
-
- Elite
- Posts: 8014
- Joined: Fri Sep 05, 2003 4:03 am
- Location: Montreal
- Contact:
@Pyramid:
Ah, I can agree to that POV, completely. No harm at all with VS the Engine offering toon shaders. I thought that toon shaders were being proposed and even welcomed for VS the Game. At the PU board, the suggestion came as a suggestion for our *game*. If what's being discussed is a shader to offer with the engine, then my dire warnings and paranoia were not justified.
My apologies.
Ah, I can agree to that POV, completely. No harm at all with VS the Engine offering toon shaders. I thought that toon shaders were being proposed and even welcomed for VS the Game. At the PU board, the suggestion came as a suggestion for our *game*. If what's being discussed is a shader to offer with the engine, then my dire warnings and paranoia were not justified.
My apologies.
Latest version of Cinemut Opaque
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
-
- Developer
- Posts: 2150
- Joined: Mon Apr 23, 2007 1:17 am
- Location: Pennsylvania
- Contact:
Chuck, you're always gonna get initial interest in stuff like this. It's like when HDR images got big online. Every kiddie with a digital cam started making attempts at HDR images of everything. It dies down.
I think you'll see non realistic shaders in VS for Retro mode. Not looking like what you see in this forum, but this thread has proven to me that what i want to see in Retro mode can be done by the shader, where as it can't be easily done any other way.
It's a promising tool that we'll use where it's supposed to be used. Anyone hoping to see it in a drop down alongside the other shaders will be left holding their breath.
I think you'll see non realistic shaders in VS for Retro mode. Not looking like what you see in this forum, but this thread has proven to me that what i want to see in Retro mode can be done by the shader, where as it can't be easily done any other way.
It's a promising tool that we'll use where it's supposed to be used. Anyone hoping to see it in a drop down alongside the other shaders will be left holding their breath.
Ed Sweetman endorses this message.