I'd love to have him as my teacher.
Your place is valueble for me. Thanks!… https://hotmail0909.weebly.com/blog
You have done an outstanding job. Greetings to Toivo Glumov and Natalie Kayurova.
Marmoset has shared a new tutorial for users of Toolbag 3.03 that focuses on the custom shader system which is currently in beta. Toolbag provides a framework for users to customize the material shader system. This can be a powerful tool for users to extend Toolbag’s rendering capabilities, and for these improvements to be shared with others. The guide provides an introduction to shader development and languages to be used.
First of all, check out a video guide by Chris Perrella:
And here is a small teaser of the written tutorial:
Marmoset Toolbag uses a somewhat customized shader language, which is a kind of union of HLSL and GLSL syntax conventions. In many cases, both sets of keywords work (e.g. both vec3 and float3 are valid), and in other cases custom macros are required. This syntax allows Toolbag shaders to compile and run in Direct3D, OpenGL, and more recently Apple’s Metal. If you follow these conventions, your shader should work correctly on a wide variety of operating systems and hardware.
One common example of this unique syntax, which may seem unusual to those of you used to HLSL, relates to textures. Textures are declared with the USE_TEXTURE2D macro, and are accessed with GLSL-like commands. Here is a simple example of texture usage in a Toolbag shader:
void myFunc( inout FragmentState s )
vec4 val = texture2D( myTexture, s.vertexTexCoord );
A full description of the shading language is beyond the scope of this article. Reading through other files for examples is likely to be the most productive route to learning the ins and outs. Some basic reference for GLSL may also be helpful as Toolbag’s shading language most closely resembles this.
Marmoset material shaders are organized as a collection of subroutines for various predefined ‘slots’, all of which are called from the main shader file, mat.frag. Custom shaders may extend or replace any of these subroutines, and by doing so significantly alter the rendering behavior of the material. For example, a custom shader my supply a new “Surface” subroutine to alter the standard normal mapping functions. The following shader extends the Surface subroutine to adjust the normal to point in a different direction.
You can find the full guide here.