p_MegaTK - universal material shader. The shader was writen for production purposes and have many build-in shading models (such as phong, blinn, ward, wet, fur, reflection, refraction, occlusion and more...)
Shader can split out passes for one render without considerable time overhead (please view tutorial about rendering passes with p_MegaTK). But p_MegaTK is not for passes only, you may use it as your common shader.
Main surface(diffuse) color
Opacity texture
Conversion for 'Opacity' texture
'R' |
(0) - R component from 'Opacity' texture used |
'G' |
(1) - G component from 'Opacity' texture used |
'B' |
(2) - B component from 'Opacity' texture used |
'A' |
(3) - A component from 'Opacity' texture used |
'Average' |
(4) - Average value of RGB from 'Opacity' texture used ((R + G + B)/3) |
'Luminosity' |
(5) - Luminosity value of RGB from 'Opacity' texture used (R*0.299f + G*0.587f + B*0.114f) |
Enable Constant model for diffuse. It's just a flat shader. Lighting has no effect to constant shader at all.
Constant shading it's like self-illumination.
Coefficient of 'Constant' model, for example if you want to mix several models together.
Constant Color
Enable simple diffuse lambert model
Coefficient of 'Simple Diffuse' model, for example if you want to mix several models together.
Coefficient Diffuse = 0.5 | Coefficient Diffuse = 1.0 |
Light Category are used for restriction of influence of light sources on the certain models of illumination.
For example you have a light source that should effect only to blinn specular, but not to diffuse and not to velvet specular. You just enter to 'Light Category' some word like "blinn_spec" and same word to 'Light Category' of you light shader. As result you get this light will be influences only to blinn specular.
Enable Fur Diffuse model. Together with Fur Specular it give you Fake Fur shading.
This part of shader based on gg_fakefur shader by Gonzalo Garramuno with some modifications. Implementation of Dan Goldman's Fake Fur rendering, a probabilistic lighting model for thin coats of fur over skin.
See http://www.cs.washington.edu/homes/dgoldman/fakefur/
Fur Diffuse | Fur Diffuse + Fur Specular |
Coefficient of 'Fur Diffuse' model, for example if you want to mix several models together.
Angle for rotating of U and V axises of anisotropic affect
See previous description of 'Light Category'(sd_light_category)
Enable Phong Specular
Phong Specular
Coefficient of 'Phong Specular' model, for example if you want to mix several specular models together.
Phong specular color
Controls the width of the specular highlight. Smaller values increase the size
See previous description of 'Light Category'(sd_light_category)
Enable Blinn Specular.
Classic Blinn specular model based on Pixar Renderman Blinn shader.
Blinn Specular
Coefficient of 'Blinn Specular' model, for example if you want to mix several specular models together.
Blinn specular color
Controls the spread of the specular highlight
Controls the intensity profile of the specular highlight
See previous description of 'Light Category'(sd_light_category)
Enable Velvet Specular.
This part of shader based on gg_velvet shader by Gonzalo Garramuno. Originally written by Stephen H. Westin, Ford Motor Company this version written by Miguel Garcao (mgarcao@netcabo.pt)
Velvet Specular
Coefficient of 'Velvet Specular' model, for example if you want to mix several specular models together.
Sheen Color (like specular color). Color of retroreflective lobe and horizon scattering
Scattering near the horizon, regardless of incident direction
Shininess of fabric (controls retro-reflection only)
See previous description of 'Light Category'(sd_light_category)
Enable Wet Specular.
Wet specular model for creating wet specular or emulate sharp reflection.
Wet Specular
Coefficient of 'Wet Specular' model, for example if you want to mix several specular models together.
Wet specular color
Controls the spread of the specular highlight
Sharpness of specular
See previous description of 'Light Category'(sd_light_category)
Enable Ward(Anisotropic) Specular.
Ward Specular
Coefficient of 'Ward Specular' model, for example if you want to mix several specular models together.
Ward specular color.
Controls the width of the specular highlight for U direction. Smaller values increase the size. Parameter works like Phong Exponent
Controls the width of the specular highlight for V direction. Smaller values increase the size. Parameter works like Phong Exponent
Use surface derivative. If enabled used U and V from NURBS surface direction. If polygon object used you should generate UV derivatives from maping with shader like "Deriver" by by Daniel "thebigMuh" Rind, elsewise anisotropic will not work. In any case NURBS object more better for anisotropic effect.
Maybe I'll support automatic generation of UV derivateves on polygon objects in future versions...
If you don't use 'Surface Deriv' you should specify direction for anisotropic specular manually with mib_texture_rotate and mib_texture_vector shaders.
Connect U and V of mib_texture_rotate texture shader to U and V value of p_MegaTK, then connect mib_texture_vector to 'Input' parameter of mib_texture_rotate.
This options works on NURBS and Polygon object too.
See previous description of 'Light Category'(sd_light_category)
Enable Fur Specular model. It's second part of fake fur shading model (see Fur Diffuse).
Fur Specular + Diffuse Specular
Angle for rotating of U and V axises of anisotropic affect
)
See previous description of 'Light Category'(sd_light_category)
Enable recieve Indirect Illumination (GI, Caustics and Final Gathering)
Color of Indirect Illumination, for example if you want tint or decrease Indirect Illumination effect. This value will be multiplied to Indirect Illumination.
Saturation of Indirect Illumination effect. This simple mean of overcome Color Bleeding.
This option enable computing Path Indirect Diffuse like in path_material shader instead of Final Gather, Global Illumination and Caustics. Path Indirect Diffuse works like Final Gather, but without interpolation(blur). It give more accurate result, but need more samples and time. Good case using this option if you have only one or some objects in scene that need Indirect Illumination.
Number of samples for Path Indirect Diffuse. Set more value for this parameter if you need more accurate and smoothed result.
Max Depth(indirect reflections or bounces) for Path Indirect Diffuse. In most case it should be 1-3.
If enabled p_MegaTK ignore bump(onlly bump connected directly to 'Input Normal', not any external) during computing Final Gather. This option speedup render and remove final gather flicking on animation.
Warning! mental ray 3.5 and newer versions in 'auto' final gather mode always ignore bump. 'Ignore Bump' option will take effect only in '3.4' or 'strict3.4' mode(radius controled) or mental ray 3.4
Enable Ambient effect.
Coefficient Ambient value
Ambient Color value
Enable Occlusion effect.
This part of shader based on shader based on "Dirtmap" shader by Daniel "thebigMuh" Rind with some modifications.
Pure Occlusion
Base(Bright) Color used if no occluding objects found
Dirt(Dark) Color used if occluding objects found. Dirt Color gets overlaid on the Base Color
Angle Spread of occlusion rays. The spread parameter sets the half-angle of the opening above the point that gets sampled. A value of 90 produces a hemisphere, while 0 results in completely sharp normal-reflections, and 180 samples a complete sphere (with about 50% of the samples normally hitting the mesh directly below the sample point).
Sets the number of samples that get cast for each point. If you set this to 0, you effectively disable computing occlusion, always be used Custom Occlusion value.
Sets the minimum range of a ray. For each ray that gets cast, if the distance to the first hit is below the Near Falloff distance, full dirt color gets applied.
Sets the maximum range of a ray. Every ray that doesn't hit an obstacle in less than the distance defined by Far Falloff causes full base color to be applied.
This controls the falloff that gets applied if a ray hits an object in a distance between the near and far falloff. At 1, a linear falloff gets applied, while at 0.5 it is square (effectively reducing dirt density), and at 2 it is square-root (effectively increasing dirt density). Note that this gets applied per ray, and therefore might not yield the amount of change you want. To dramatically increase the dirt strength, either lower the dirt color to a value with negative luminance, or use a color correct node with negative gamma to modify the result value.
Gamma correction for occlusion. For example if you render your image with gamma 2.2 and want that your occlusion looks like with gamma 1.0 set occlusion Gamma to 1/2.2 = 0.45
This lets you specify an arbitrary vector that gets used to send samples in. This serves as the base for the cone that samples get shot in. The angle of the opening of that cone can be modified via the spread parameter.
This controls the amount of mixing that occurs between the standard vector that gets used (the interpolated surface normal), and the basis vector. At 0, the surface normal is used, and at 1, only the basis vector gets used.
This option controls how to use opacity during computing occlusion effect.
'Opaque' |
(0) - full opaque, any object transparency or shaders ignored |
'Material Shader' |
(1) - material shader called for computing opacity by alpha component of returned result |
'Shadow Shader' |
(2) - shadow shader called for computing opacity (if material have shadow shader connected). This mode may be a little bit faster than 'Material Shader'. Current limitation of this mode is that only first trasparent object taked into account (this limitation may be removed in next version of shaders_p) |
Occlusion without opacity('Opaque' mode) and with opacity
Toggles if the base/dirt colors are output directly, or if they get multiplied with the environment color first. To get any visible results, you should first apply some kind of color or texture to the environment. Relatively open areas of the mesh, that aren't occluded, return the unmodified environment color, and "dirty" areas return black, therefore pulling ambience in those areas towards zero.
If On the shader will not do any sampling when hit by any secondary illumination rays, no matter if GI or Caustic photons, or Final Gather rays. Use this to greatly speed up Final Gathering in scenes where you are using occlusion. The visual difference is normally not noticable, the speed difference can be huge.
If On the shader will not do any sampling when hit by reflection rays. It mean that occlusion will not be visible in reflection. Use this to speed up reflection, for example if you don't see any difference in reflections.
If On the shader will not do any sampling when hit by refraction rays. It mean that occlusion will not be visible in refraction. Use this to speed up refraction, for example if you don't see any difference in refractions.
A bent normal is a vector that points in the average unoccluded direction above a point. If you have a completely unoccluded surface, this will be equal to the surface normal (if you use enough samples), or the basis vector if it is in use. Bent Normals pass used for Compositing effects.
Vector Space that bent Normals be returned.
'World / Internal'(0)
'Object'(1)
'Camera'(2)
Amount of effect Occluison to Diffuse component (sometimes called Dirt). If 0 - no effect, if 1 - full effect and Occlusion multiplied to Diffuse.
Amount of effect Occluison to Specilar component If 0 - no effect, if 1 - full effect and Occlusion multiplied to Specular.
Amount of effect Occluison to Indirect Illumination component If 0 - no effect, if 1 - full effect and Occlusion multiplied to Indirect Illumination. For example if you want sharp or detail your indirect illumination.
Amount of effect Occluison to Ambient component (called Ambient Occlusion). If 0 - no effect, if 1 - full effect and Occlusion multiplied to Ambient.
If "Internal" occlusion not suit you, you may use any occlusion shader you want, for example mib_amb_occlusion, just connect it to this slot. But don't forget to set 'Samples' to 0 in p_MegaTK internal occlusion(for disable it) to avoid computing occlusion effect twice.
Enable computing reflection.
Coefficient of Reflection.
Reflection Color.
Shiny Reflection or reflection bluring. If 'Shiny' = 0 no bluring, ideal specular reflection. If 'Shiny' > 0 produce blured reflection, less value of 'Shiny' produce more strong bluring.
Enable Anisotropic Reflection effect. Anisotropic Reflection works only on nurbs objects.
Shiny value for U direction.
Shiny value for V direction.
Samples for blured reflection. More value produce more smooth result. Less value produce more noise result, but more fast. If no bluring reflection used always compute only one sample.
Amount of Fresnel mask. Fresnel shape computed on basis of 'IOR in' and 'IOR out' value.
Coefficient Reflection = 1 Fresnel = 1 | Coefficient Reflection = 1 Fresnel = 0.5 | Coefficient Reflection = 1 Fresnel = 0 |
Distance where reflection begin falloff(attenuate) to environment color. Falloff is linear. If 'Falloff Start' and 'Falloff Stop' equal to 0 no reflection falloff used.
Distance where reflection stop falloff(attenuate) to environment color. After this distance no reflection computed.
Reduce this value for optimize rendering of large scenes with reflection.
Falloff to 'Reflection Falloff Color' instead of environment color.
Color for reflection falloff if 'Falloff to Color' enabled.
Amount of Reflection value will be subtracted from Diffuse. If 'Diffuse Minus Reflection' = 0 no subtract computed. If 'Diffuse Minus Reflection' = 1 whole reflection will be substracted from Diffuse.
Enable computing refraction.
Coefficient of Refraction.
Refraction Color.
Shiny Refraction or refraction bluring. If 'Shiny' = 0 no bluring, ideal specular refraction. If 'Shiny' > 0 produce blured refraction, less value of 'Shiny' produce more strong bluring.
Enable Anisotropic Refraction effect. Anisotropic Refraction works only on nurbs objects.
Shiny value for U direction.
Shiny value for V direction.
Samples for blured refraction. More value produce more smooth result. Less value produce more noise result, but more fast. If no bluring refraction used always compute only one sample.
'IOR in' - Index of Refraction of the dielectric material for entering object.
'Absorption In' is the "persistence" coefficient which corresponds to the fraction of light which is left after traversing one unit of material. Thus 0.9 means that 10% of the light is absorbed per unit length of the material. Lengths are measured in world coordinates. This color used if ray enter to surface.
'IOR out' - Index of Refraction of the dielectric material for outside object. For example ray may hit water surface with IOR 1.333(IOR in) from air with IOR 1.0(IOR out).
'Absorption In' is the "persistence" coefficient which corresponds to the fraction of light which is left after traversing one unit of material. Thus 0.9 means that 10% of the light is absorbed per unit length of the material. Lengths are measured in world coordinates. This color used if ray out of surface.
Amount of Fresnel mask. Fresnel shape computed on basis of 'IOR in' and 'IOR out' value.
Distance where refraction begin falloff(attenuate) to environment color. Falloff is linear. If 'Falloff Start' and 'Falloff Stop' equal to 0 no refraction falloff used.
Distance where refraction stop falloff(attenuate) to environment color. After this distance no refraction computed.
Reduce this value for optimize rendering of large scenes with refraction.
Falloff to 'Refraction Falloff Color' instead of environment color.
Color for refraction falloff if 'Falloff to Color' enabled.
Amount of Refraction value will be subtracted from Diffuse. If 'Diffuse Minus Refraction' = 0 no subtract computed. If 'Diffuse Minus Refraction' = 1 whole refraction will be substracted from Diffuse.
Use Russian Roulette Optimization for Reflect/Refract. If enabled and current trace depth > 3 computed only reflection or only refraction ray depending on fresnel mask.
'Samples Decrease Factor' divide Reflection and Refraction Samples to 2 for every one value. For example if you have 16 samples for reflection and 'Samples Decrease Factor' = 1 in first reflection or refraction samples will be divided to 2 and result reflection samples will be 8. If 'Samples Decrease Factor' = 2 in first reflection or refraction samples will be 4. And if 'Samples Decrease Factor' = 3 samples will be 2. Set 'Samples Decrease Factor' to more value for fast rendering.
If more than 0 that this value override 'Reflection Depth' in render options for current shader.
If more than 0 that this value override 'Refraction Depth' in render options for current shader.
Use Incandescence produce effect like self illumination. Incandescence color will be added to shader.
Coefficient of Incandescence color.
Incandescence color.
Use Input Normal from node like maya's bump2d(bump3d) or 3dsmax's Bump for generating bump effect.
Add Input Normal to original normal(max default value on). If this option disabled normal will be replaced with Input Normal(maya default value off).
Connect to Input Normal your bump node.
Enable SpecialC1 channel. SpecialC channels not visibale in common(beuaty) pass. You may use SpecilaC channels for any other passes you want, for example for rendering additional masks. You may also connect any shaders you want(shader should return color) to SpecialC channels for spliting it to separate pass. SpecialC pass have no alpha channel only rgb.
Enable computing Z pass. p_MegaTK can compute it own Z pass with trasparency, reflection and refraction.
Z value near than 'Near Clip Plane' will be cliped. You should compute and set this value for your scene, depending on your scene size and camera position.
Z value far than 'Far Clip Plane' will be cliped. You should compute and set this value for your scene, depending on your scene size and camera position.
Enable computing Z with opacity.
Enable computing Z with reflection.
Enable computing Z with Refraction.
If this option disabled z will be normalized to 0-1 range. If enabled z will be float point value.
Inverting Z.
Mode and Light Array is common mental ray mechanism for lightlinking. Mode controls the meaning of the light list: all, inclusive, or exclusive.