Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: implementing a material shader system using glSlang

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    17

    implementing a material shader system using glSlang

    ok so quake3 had software shaders through its .shader files, but now that shaders are now implemented in hardware, JC has had to change them to .mtr material files for doom3, but they essentially were the same as .shader files.

    Anyway my question is how exactly would i use glSlang to implement a material script system for my engine. My thoughts are to have the same syntax as .mtrfiles, and for each stage in the .mtr file add a line to the .frag shader like:

    gl_FragColor += sample2d(...

    For each .mtr i would create a new glSlang program, and store it for use later on. Would this work? I am worried that it might be a strain on the system having a hundred different glSlang programs in memory.

    In case you dont know, a 'stage' in a .mtr file defines kinda defines a pass to be added when rendering using hte shader. each stage can have its own texture map.

  2. #2
    Intern Contributor
    Join Date
    Nov 2002
    Location
    Australia
    Posts
    97

    Re: implementing a material shader system using glSlang

    Quake3 and Doom3 shaders have nothing to do with hardware fragment programs (or "pixel shaders"). They are simply text files that tell the engine how a surface should be rendered.

    They pretty much just set blending/alpha modes, modify texture coordinates, and on the rare 'shader', they can modify the vertex positions as well.

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    17

    Re: implementing a material shader system using glSlang

    dopeyfish i know that, im just just brainstorming ideas on how im gonna implement my material system.

    I think ive got a better idea than before. Each material is a text based .mtr file, and it will reference .frag glSlang shaders and .tga texture files, so the engine will load the .glSlang shader assuming some names for the texture objects, which will be filled with the targa files.

    This way i dont have to implement my own script language, just a basic file list format.

  4. #4
    Intern Contributor
    Join Date
    Nov 2002
    Location
    Australia
    Posts
    97

    Re: implementing a material shader system using glSlang

    Originally posted by imr1984:
    dopeyfish i know that
    Insults, no matter how you try to hide them, will get you absolutely nowhere on these forums.

    Your original post didnt say that you understood that, infact it said that JC had to create a new 'material' format because of hardware fragment programs, which is completely untrue and it has nothing to do with fragment programs in the slightest.

  5. #5
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    17

    Re: implementing a material shader system using glSlang

    dont tell me that with a name like dopefish no one has ever called you dopey

    anyway quake3 was released years before hardware shaders were implemented, so he decided to take use .shader file extension. have you had a look at the doom3 alpha? it has 'material' files with .mtr extensions, but they look pretty much the same as the old .shader files from quake3, so what i said was true - JC had to rename em to avoid a naming conflict.

    anyway i was just getting ideas on how i should implement my material system - calm down.

  6. #6
    Intern Contributor
    Join Date
    Nov 2002
    Location
    Australia
    Posts
    97

    Re: implementing a material shader system using glSlang

    Originally posted by imr1984:
    dont tell me that with a name like dopefish no one has ever called you dopey
    However my nick isnt 'dopey', and 'dopey' can easily be regarded as an insult. Ive had people make attacks at me on forums using the name 'dopey' and 'dopeyfish' when theyve had opposing views, so you can hopefully see where I am coming from with that.

    Originally posted by imr1984:
    anyway quake3 was released years before hardware shaders were implemented, so he decided to take use .shader file extension. have you had a look at the doom3 alpha? it has 'material' files with .mtr extensions, but they look pretty much the same as the old .shader files from quake3, so what i said was true - JC had to rename em to avoid a naming conflict.
    Or perhaps he did it because they define more than just the shading settings for Doom3? From what I have read about them, that seems to be more the case. There is no rule that .shader files must refer to hardware vertex/fragment programs, in the same sense that Carmack uses .MD5 filenames for models in Doom3 which doesnt conflict with the MD5 hash algorithm.

    Personally I dont see how there would be a naming conflict. I would see people more likely to use differing extensions depending on the type of gpu program the file contained. For example, vertex programs having a .vp extension and fragment programs having .fp would make more sense than calling them .shader.

    Claiming that JC "had" to change them for that reason, yet offering no proof for it and the "reasons" you gave made, little if, any sense.. sorry but Im just not buying it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •