material-maker/addons/material_maker/nodes/mwf_map.mmg

74 lines
1.6 KiB
Plaintext
Raw Normal View History

{
"name": "mwf_map",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
},
"shader_model": {
"code": "float $(name_uv)_angle = 6.28318530718*($map($uv).y-0.5);\nvec2 $(name_uv)_uv = matmap_uv($uv, $(name_uv)_angle, $map($uv).z);\n",
"global": "vec2 matmap_uv(vec2 uv, float angle, float seed) {\n\tuv -= vec2(0.5);\n\tvec2 rv;\n\trv.x = uv.x*cos(angle)+uv.y*sin(angle);\n\trv.y = -uv.x*sin(angle)+uv.y*cos(angle);\n\treturn fract(rv + rand2(vec2(seed)));\n}\n\nvec3 matmap_rotate_nm(vec3 input, float angle) {\n\tvec2 uv = input.xy - vec2(0.5);\n\tvec2 rv;\n\trv.x = uv.x*cos(angle)+uv.y*sin(angle);\n\trv.y = -uv.x*sin(angle)+uv.y*cos(angle);\n\treturn vec3(rv + vec2(0.5), input.z);\n}\n",
"inputs": [
{
"default": "vec3(0.0)",
"label": "Map",
"name": "map",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "Albedo",
"name": "mat1",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "ORM",
"name": "mat2",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "Emission",
"name": "mat3",
"type": "rgb"
},
{
"default": "vec3(0.5, 0.5, 1.0)",
"label": "Normal",
"name": "mat4",
"type": "rgb"
}
],
"instance": "",
"name": "Apply Map",
"outputs": [
{
"f": "$map($uv).x",
"type": "f"
},
{
"rgb": "$mat1($(name_uv)_uv)",
"type": "rgb"
},
{
"rgb": "$mat2($(name_uv)_uv)",
"type": "rgb"
},
{
"rgb": "$mat3($(name_uv)_uv)",
"type": "rgb"
},
{
"rgb": "matmap_rotate_nm($mat4($(name_uv)_uv), -$(name_uv)_angle)",
"type": "rgb"
}
],
"parameters": [
]
},
"type": "shader"
}