How to use misss_fast_shader_x?

Output, Volumen, Light, etc..

How to use misss_fast_shader_x?

Postby waltherg on Tue Jun 09, 2009 16:46 pm

Hello all

I'm developing shaders for 3dsmax 2010, but I'm not sure my problem is app-specific.

I have a mia_material_x wrapper, essentially copied from versions I found on the net, which works great and lets me save out the various a&d components to separate framebuffers.

I'd like to set up something similar for the outputs from misss_fast_shader_x, but I'm not sure how to go about doing this. Specifically, where my mia_material_x wrapper code has :

mia_material_api_storage mtldata;
mia_material_api_storage* dp;

...what should I be using as storage structures for the sss version?

Many thanks
Rob
waltherg
User
 
Posts: 12
Joined: Tue Jun 17, 2008 16:45 pm

Re: How to use misss_fast_shader_x?

Postby jb_alvarado on Tue Jun 09, 2009 18:41 pm

Hi Rob,
when you don't need a hard coded shader, you can writing a phenomenon. All what you need is the "max_mrStoreElement". The same I make with the mr_matte_shadow shader:

Code: Select all


declare phenomenon material "MattePasses" (
           #--------------------------------------
           # background color handling
           #--------------------------------------
           struct "struct_surface"
        {
           color   "background"     default 0 0 0 0,
            scalar   "opacity"       default 1.0, #: min 0 max 1
            color texture "bump",
            scalar   "bump_amount"
        },

      #--------------------------------------
        # Shadows
        #--------------------------------------
        struct "struct_shadows"
        {
           #------- shadow casting lights
           boolean "catch_shadows"   default on,
           color   "shadows"         default 0 0 0 1,
            scalar  "ambient_intensity" default 0.2,
            color   "ambient"           default 1 1 1,
           boolean "no_self_shadow"  default on,
           boolean "use_dot_nl"      default on,
           scalar  "colored_shadows" default 1.0,    #: min 0 max 1
            array light "lights"
        },
       
      #--------------------------------------
        # Ambient Occlusion
        #--------------------------------------
        struct "struct_ao"
        {
           # AO
           boolean "ao_on"           default on,
           integer "ao_samples"      default 16,     #: min 0
           scalar  "ao_distance"     default 0.0,    #: min 0
           color   "ao_dark"         default 0.0 0.0 0.0
        },
       
        #------------------------------------------------   
        # Reflections
        #------------------------------------------------   
        struct "struct_reflections"
        {
           boolean "catch_reflections" default off,
           color   "refl_color"        default 0.2 0.2 0.2 0.2,
           color   "refl_subtractive"  default 0 0 0 0,
           
           scalar  "refl_glossiness"   default 0.5,  #: min 0.01 softmax 1.0
           integer "refl_samples"      default 0,    #: min 0
           
           scalar  "refl_max_dist"     default 0.0,  #: min 0
           scalar  "refl_falloff"      default 2.0  #: min 0.01 softmax 5.0
            },
            
        #--------------------------------------
        # Indirect Illumination
        #--------------------------------------
        struct "struct_indirect_lighting"
        {
            boolean "catch_indirect"    default off,
            scalar   "indirect"            default 1.0,
            color   "additional_color" default 0 0 0
        },

        #--------------------------------------
        # Direct Illumination
        #--------------------------------------
        struct "struct_lighting"
        {
            #------ illuminating lights
            boolean "catch_illuminators" default off,
            array light "illuminators"
        },
      
      #--------------------------------------
        # Passes
        #--------------------------------------
        struct "struct_Passes"
        {
      boolean      "enable_Passes",
      
      string     "result_Pass",   

      string      "shadows_Pass",      

      string      "ao_Pass",      

      string      "refl_Pass",      

      string      "indirect_Pass",      

      string      "illumination_Pass"      
      },   
           integer     "mode"
    )
           
    shader "intensityshader" "mib_color_mix" (
        "num"  1,
        "color_0"  = interface "struct_surface.background",
        "weight_0" = interface "struct_indirect_lighting.indirect"
    )
   
    shader "ambient_intensity" "mib_color_mix" (
        "num" 1,
        "color_0"  = interface "struct_shadows.ambient",
        "weight_0" = interface "struct_shadows.ambient_intensity"
      )
   
    shader "matteshadow" "mip_matteshadow" (
        "background"        = interface "struct_surface.background",
       
        "catch_shadows"     = interface "struct_shadows.catch_shadows",
        "shadows"           = interface "struct_shadows.shadows",
        "colored_shadows"   = interface "struct_shadows.colored_shadows",
        "ambient"           = "ambient_intensity",
        "no_self_shadow"    = interface "struct_shadows.no_self_shadow",
        "use_dot_nl"        = interface "struct_shadows.use_dot_nl",
       
        "ao_on"             = interface "struct_ao.ao_on",
        "ao_dark"           = interface "struct_ao.ao_dark",
        "ao_samples"        = interface "struct_ao.ao_samples",
        "ao_distance"       = interface "struct_ao.ao_distance",
       
        "catch_reflections" = interface "struct_reflections.catch_reflections",
        "refl_color"        = interface "struct_reflections.refl_color",
        "refl_subtractive"  = interface "struct_reflections.refl_subtractive",
        "refl_samples"      = interface "struct_reflections.refl_samples",
        "refl_glossiness"   = interface "struct_reflections.refl_glossiness",
        "refl_max_dist"     = interface "struct_reflections.refl_max_dist",
        "refl_falloff"      = interface "struct_reflections.refl_falloff",
       
        "catch_indirect"    = interface "struct_indirect_lighting.catch_indirect",
        "indirect"          = "intensityshader",
       
        "multiple_outputs"  = interface "struct_Passes.enable_Passes",

        "catch_illuminators" = interface "struct_lighting.catch_illuminators",
        "illuminators"       = interface "struct_lighting.illuminators",
        "additional_color"   = interface "struct_indirect.additional_color",

        "mode"              = interface "mode",
        "lights"             = interface "struct_shadows.lights"
    )
   
   
    shader "bumpshader" "max_Bump" (
        "Multiplier" = interface "struct_surface.bump_amount",
        "Map"        = interface "struct_surface.bump"
    )
   
   shader   "store_element_result" "max_mrStoreElement" (
      "input"      = "matteshadow.result",
      "label"    = interface "struct_Passes.result_Pass"
   )
   
   shader   "store_element_sh" "max_mrStoreElement" (
      "input"      = "matteshadow.shadows_raw",
      "label"    = interface "struct_Passes.shadows_Pass"
   )

   shader   "store_element_ao" "max_mrStoreElement" (
      "input"      = "matteshadow.ao_raw",
      "label"    = interface "struct_Passes.ao_Pass"
   )

   shader   "store_element_refl" "max_mrStoreElement" (
      "input"      = "matteshadow.refl_raw",
      "label"    = interface "struct_Passes.refl_Pass"
   )

   shader   "store_element_indirect" "max_mrStoreElement" (
      "input"      = "matteshadow.indirect_raw",
      "label"    = interface "struct_Passes.indirect_Pass"
   )
   
   shader   "store_element_illum" "max_mrStoreElement" (
      "input"      = "matteshadow.illumination_raw",
      "label"    = interface "struct_Passes.illumination_Pass"
   )   
   

    shader "cardshader_result" "mip_card_opacity" (
        "input" = "store_element_result",
        "opacity_in_alpha" false,
        "opacity" = interface "struct_surface.opacity",
        "opacity_is_premultiplied" false,
        "opacity_threshold" 0.1
    )
   
shader "mixer" "mib_color_mix" (
   "num" 6,
   "weight_0" 0,
   "weight_1" 0,
   "weight_2" 0,
   "weight_3" 0,
   "weight_4" 0,
   "weight_5" 1,
   "color_0"  = "store_element_illum",
   "color_1"  = "store_element_indirect",
   "color_2"  = "store_element_refl",
   "color_3"  = "store_element_ao",
   "color_4"  = "store_element_sh",
   "color_5"  = "cardshader_result",
   )
      
   
shader "store_elements" "max_mrStoreElements" (
   "main_input"  = "mixer",
   "main_label" "buffmaindb",
   "apply_render_elements" = interface "struct_Passes.enable_Passes"
   
   )
   
    material "matte"
        = "bumpshader" = "store_elements"
        shadow = "matteshadow"
        photon = "matteshadow"
    end material

    root material "matte"   

    gui "gui_MattePasses" {
        control "Global"  "Global" (
            "uiName"      "Matte Passes Phen"
        )
       
          control "struct_surface" "struct" ("uiName" "Matte/Shadow/Reflection Parameters")
          {
            control "background" "color" ("uiName" "Camera Mapped Background","value"   0 0 0 0)
           control "opacity" "scalar"                   ("uiName" "Mask/Opacity","range" 0 1, "value"   1)
            control "bump_amount" "scalar"                   ("uiName" "Bump Amount","range" -10 11, "value"   0.3)
            control "bump" "vector texture" ("uiName" "Bump", "textureInfo" "max_texmap")
        }
        control "struct_shadows" "struct" ("uiName" "Shadows")
          {
          control "catch_shadows" "boolean"       ("uiName" "Catch Shadows","value"  1,"nonConnectable")
          control "lights" "array light"             ("uiName" "Shadow Casting Lights","nonConnectable")
          control "colored_shadows" "scalar"       ("uiName" "Colored Shadows","value" 1,"range" 0 1,"hidden" )
            control "shadows" "color"                   ("uiName" "Shadow Color","value"  0 0 0 1, "hidden")
            control "ambient" "color"                   ("uiName" "Ambient Color","value"  1 1 1 )
            control "ambient_intensity" "scalar"                   ("uiName" "Ambient Intensity (affected by AO)","value"  0.2 )
          control "no_self_shadow" "boolean"       ("uiName" "No Self-shadow","value"  1,"nonConnectable","hidden")
          control "use_dot_nl" "boolean"             ("uiName" "  Attenuate by Light Angle", "value" 1,"nonConnectable","hidden")
        }
      
        control "struct_lighting" "struct" ("uiName" "Direct Illumination","openstate" "false")
        {
          control "catch_illuminators" "boolean"("uiName" "Catch Direct Illumination","value"   0,"nonConnectable")
          control "illuminators" "array lights" ("uiName" " Illuminating Lights")
      }
   
      control "struct_ao" "struct" ("uiName" "Ambient Occlusion")
        {    
            control "ao_on" "boolean"                ("uiName" "use Ambient Occlusion","value"  0 ,"nonConnectable")
         control "ao_samples" "integer"             ("uiName" "AO Sampling", "value" 16,"nonConnectable")         
            control "ao_distance" "integer"          ("uiName" "AO Max Distance","value"   0,"nonConnectable", "units" "world")
          control "ao_dark" "integer"             ("uiName" "AO Strength","value"   0.0 0.0 0.0 )
           }   
            
      control "struct_indirect_lighting" "struct" ("uiName" "Indirect Illumination", "openstate" "false")
         {
          control "catch_indirect" "boolean"       ("uiName" "Catch Indirect Illumination","value"   0,"nonConnectable" )
          control "indirect" "scalar"                ("uiName" "Indirect Multiplier", "value"   1.0,"range" 0.0 1000000000000000.0 )
          control "additional_color" "color"       ("uiName" "Additional Color","value"   0 0 0,"hidden")
           }
   

           
      control "struct_reflections" "struct" ("uiName" "Reflections")
          {
          control "catch_reflections" "boolean" ("uiName" "Catch Reflections", "value"  0,"nonConnectable" )
          control "refl_color" "color"                ("uiName" "Reflection Color","value"   .5 .5 .5 1 )
          control "refl_subtractive" "color"       ("uiName" "Reflections Subtractive Color","value" 1 1 1 1 )
          control "refl_glossiness" "scalar"       ("uiName" "Glossiness", "range"  0.0 1.0, "value"  1.0 )
          control "refl_samples" "integer"          ("uiName" "Glossy Samples", "range" 0 1024, "value"   8,"nonConnectable" )
          control "refl_max_dist" "scalar"          ("uiName" "Max Distance", "range"  0.0 1000000000000000.0, "value"   0,"units" "world","nonConnectable")
         control "refl_falloff" "scalar"          ("uiName" "Distance Falloff", "range"  0.0 1000000000000000.0, "value"   2.0,"nonConnectable")
            }
            

      control "struct_Passes" "struct" ("uiName" "Multiple Outputs")
         {
          control "enable_Passes" "boolean"       ("uiName" "Enable Multiple Outputs","value"   0,"nonConnectable" )
          control "result_Pass" "string"          ("uiName" "Result",  "nonConnectable" )
          control "shadows_Pass" "string"       ("uiName" "Shadows",  "nonConnectable" )
         control "ao_Pass" "string"          ("uiName" "AO", "nonConnectable" )
         control "refl_Pass" "string"          ("uiName" "Reflection", "nonConnectable" )
         control "indirect_Pass" "string"          ("uiName" "Indirect", "nonConnectable" )
         control "illumination_Pass" "string"          ("uiName" "Illumination", "nonConnectable" )
           }         
            
        control "mode" "null" ("uiName" "Mode", "value" 0, "hidden")
      
      
      
      
      
    }
 end declare
 
 
User avatar
jb_alvarado
Moderator
 
Posts: 2021
Joined: Sun Nov 12, 2006 20:16 pm
Location: Dornbirn

Re: How to use misss_fast_shader_x?

Postby waltherg on Wed Jun 10, 2009 13:11 pm

All I can say is - :D

A big thank you from Slide. What would we all do without gmrf?

This new skin shader will find it's way into our SlideShaders very soon!
waltherg
User
 
Posts: 12
Joined: Tue Jun 17, 2008 16:45 pm

Return to Shader general

Who is online

Users browsing this forum: No registered users and 1 guest

cron