Archived

This topic is now archived and is closed to further replies.

Multiple vertex shaders?

This topic is 5507 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, all! I am making a FPS, and had planned on making it Cel-shaded. But I was wondering, what do you think of having multiple vertex shaders programmed in, possibly in a list, but having an option for the user to select from these vertex shaders. Like membrane shading, hatch shading(?), and cel-shading, among others. Would this work? Ex: SetVertexShader(VertexShaderList[CurrentVertexShader]); VertexShaderList[0] = CelShader; VertexShaderList[1] = HatchShader; ... ??? Any comments would be appreciated!! It is coming...8 years in the making and It is finally coming... -Beavt8r

Share this post


Link to post
Share on other sites
I am not trying to compete with other games and/or companies. I am an indie game programmer just wanting to put his ideas into a game. Besides, it is very hard not to work on something that isn't in development somewhere else, or already out. Like I said, I'm an indie that loves to make games and I just want to have my game idea put into an actual game. It's not like I could compete with anybody anyways...I'm doing everything myself...besides, non-conventional shading/look goes with the game story. So come on, take it easy on me .

Anyway, would function pointers help with this? Like have a list of the SVS functions along with parameters, and have it call the current SVS function?

It is coming...8 years in the making and It is finally coming...

-Beavt8r


[edited by - beavt8r on November 11, 2002 12:47:01 PM]

Share this post


Link to post
Share on other sites
Beavt8r:
No need for a shotgun to kill a fly.
Just have one vertex shader for each effect and select the one you need. That's so simple you shouldn't even need to ask or think about it.

That's like selecting what character to print on screen depending on what the user selected. If he selects 1 just print 1. No function pointers, no polymorphism, no templates... just a plain and boring 'if'.


EDIT:
BTW, what's wrong with the first exemple you gave, it's totally valid (except the order). Why do you want to switch to function pointers all of a sudden?

______________________________
Oooh, you found the horadric cube!

[edited by - Coincoin on November 11, 2002 9:40:33 PM]

Share this post


Link to post
Share on other sites
Good point...Well, what I intended was sort of what''s in NPR Quake, being able to select the "rendering style" but using vertex shaders. I just want it to be fun and I don''t know about the rest of you, but I love to customize games, and I thought it would be cool to give the player an option to change the vertex shader for the game (whether by cheat or whatever...) and thereby changing the "rendering style" of the game and changing the way it looks. I was going to do cel-shading, as I said, but some people don''t like that, and in some ways I can see why...One person said hatching would be cool. I would still get the non-photorealistic effect, but wouldn''t be so plain. And I do like the effect...along with many others. (NVIDIA SDK) I just want the game to be fun for as many people as possible, and I think the look and style of a game (some parts) being customizable would help that. Besides, it is my game and I think it''d be cool, and just maybe more people will play it, too.

It is coming...8 years in the making and It is finally coming...

-Beavt8r

Share this post


Link to post
Share on other sites
Hey.. don''t be mistaken, I didn''t say it''s a bad idea. On the contrary, being able to customize the way things look is always VERY funny.

However, it''s the way you wanted to do it that struck me the most. Sometime, we miss the most obvious solutions. In your case, you wanted to use functions pointers and stuff, while keeping a simple index to a list would be enough (as you pointed out in your first post) Or maybe am I missing something?



______________________________
Oooh, you found the horadric cube!

Share this post


Link to post
Share on other sites
Yes, it is funny. Well, the game is gonna have a lighter tone, so you know...But anyway, when I posted about the function pointers, I wasn't very sure on the details of the shader implementation, thoroughly anyway, and was experimenting. After a little more research, I saw this:

lpD3DDevice->SetVertexShader(&VertexShaderList[CurrentVertexShader]);

...which is basically like my first post...always the simplest as you said. I don't know exactly what I was thinking. But this brings to mind another question: This method would cause everything on the screen to use the vertex shader, so if I used the membrane lighting effect in the NVIDIA SDK (http://developer.nvidia.com/view.asp?IO=membrane_lighting), would that make undesirable effects or is there a way to just give certain objects shaders? (like the character models one shader and everything else another one) I am really just now getting into shaders so I'm still a little fuzzy. I was just wondering, cause some of the effects I want to use might have undesirable effects with the level itself. Thanks!

It is coming...8 years in the making and It is finally coming...

-Beavt8r


[edited by - beavt8r on November 13, 2002 11:53:23 AM]

Share this post


Link to post
Share on other sites
Well...
Couldn''t you have 1 main shader class with the basics create seperate classes that inherit the main class containing all the shader information. At the start of the game, installize a specific class based on what the user wants. Then, call the setshaderstuff function which will use the one specifically made for the class. It is just as easy to do it with an array of shaders though.

Share this post


Link to post
Share on other sites
Well, what I was loosely basing it on was NPR Quake. You bring down the console and can change the rendering style on the fly. That''s sort of what I would like to have, because if you chose one shader and didn''t like it, it would be nice to just be able to implement it without quitting, etc...just do like NPR Quake and bring down the console and change it right there. Of course, I guess you could use the classes like you said...because I don''t know if I like the idea of having all the shaders in memory, and when I change them I could just delete the current one and assemble the new one if the memory was really an issue.

It is coming...8 years in the making and It is finally coming...

-Beavt8r

Share this post


Link to post
Share on other sites
A little off-topic, but:

You could even make the different shading styles ''unlockable secrets.'' Like, if the player completes an area within a certain time, the option for hatch-shading appears in the options menu - a bit like Goldeneye.

Share this post


Link to post
Share on other sites
Yeah, that''s what I''m contemplating now. I''m going to have a ton of codes, and the way I''m leaning is that I should have some of the shaders available at the beginning and having the rest of them available with a code. It has definitely crossed my mind.

It is coming...8 years in the making and It is finally coming...

-Beavt8r

Share this post


Link to post
Share on other sites