Home Forums Programming Multiple shaders on single objects

Welcome to our forums. These forums were active from 2003-2014. We have now decided to close them down, but will leave them here as an archive.

Remember you can send us feedback, news, jobs and content ideas by clicking here.

If you're really stuck for time, email news@gamedevelopers.ie.

You can also follow us on Twitter @gamedev_ie 

 

 

This topic contains 7 replies, has 5 voices, and was last updated by  philippe_j 11 years, 4 months ago.

  • Author
    Posts
  • #4826

    CodeMasterMike
    Participant

    Hi good people!

    Im sitting here and writing on my game engine, and now I want to
    do my shadermanager part of the engine more efficient and more advanced. 8)

    My intention was to have a shadermanager that allows to have multiple
    shaders on every object from a list. (shadows and such).

    Now to my problem. Is there a “right” way to do this?
    Every shader needs different inparameters to different objects and so on.
    Is there a way to make this, or any good page with information about this?

    So far, Im only using one shader, and it feels to pathetic to fill one shader with all kinds of PS, so that is not really an option. :roll:

  • #27711

    peter_b
    Participant

    i would say theres no right or wrong way. try to gather all your types of shaders your going to have as well as a list of what objects will use which then try to write as generic a manager which works for all these. then if you need additional functionality just extend this manager.
    dunno if that helps. just the way i would do it.

  • #27738

    CodeMasterMike
    Participant

    That is a good idea, having specific functions for different shaders.

    But the main thought was, that I want to have a dynamic manager.
    So if I add a new shader, I dont have to add another function to my lib.
    Dont know if that is possible, unless I add the function in the game logic,
    instead of the lib. :?

    In the meantime, I will take your advice, and make specific functions :)

  • #27739

    maniacrobot
    Participant

    How about adding a scripting language as well, like python or lua to enable the addition of extraneous functions without having to go back into the core code.

  • #27740

    peter_b
    Participant

    How about adding a scripting language as well, like python or lua to enable the addition of extraneous functions without having to go back into the core code.[/quote:e080830801]

    thats actually a good idea. probably a good way to go.

  • #28264

    Destructor!!!
    Participant

    For ease of asset creation, you could try pinning the shader values to virtual textures, which could be applied to the object using a stand-in bitmap in the modelling programme.

    The UVW coordinates of the virtual textures then define what part of the object is to be shaded.

    I’m not exactly au-fait with shaders, so please don’t berate me if I’m spouting gibberish.

  • #28474

    CodeMasterMike
    Participant

    How about adding a scripting language as well, like python or lua to enable the addition of extraneous functions without having to go back into the core code.[/quote:8b2ca6aa5e]

    That would be the best way to go, but I think it is a little bit too much for me to develop right now. But still a good idea.

    For ease of asset creation, you could try pinning the shader values to virtual textures, which could be applied to the object using a stand-in bitmap in the modelling programme.
    The UVW coordinates of the virtual textures then define what part of the object is to be shaded. [/quote:8b2ca6aa5e]

    Hmm.. Interesting, that could work for using multiple shaders.
    Im going to try that one as soon as I am done with the animationsystem :)

    But how do I practically run several shaders on a single object, is it just as simple as adding a additional iPass in the shader render function?

  • #30943

    philippe_j
    Participant

    you could check out how Valve did it on Source? They had this _huge_ Powerpoint presentation about their shader technology.
    It’s a PDF file called D3DTutorial10 half life 2 shading, dating from 22nd of March 2004. Very interesting, even for me who is only a beginner with shaders.
    Hope this helps

The forum ‘Programming’ is closed to new topics and replies.