Hi pkind:
thanks reply.
My goal was pack pbr texture to there tga map.first set up is albedo and ao map, second set up is specular metal mask. the third set up is Normal.x roughness Normal.z。
So i can save most momery for render big or large scene.
here is my code:
mdl 1.5;
import ::adobe::util::vector_texture;
import ::anno::author;
import ::anno::copyright_notice;
import ::anno::description;
import ::anno::display_name;
import ::anno::in_group;
import ::anno::unused;
import ::anno::usage;
import ::base::file_texture;
import ::base::mono_mode;
import ::base::tangent_space_normal_texture;
import ::base::texture_coordinate_info;
import ::base::texture_return;
import ::df::custom_curve_layer;
import ::df::diffuse_reflection_bsdf;
import ::df::directional_factor;
import ::df::microfacet_ggx_smith_bsdf;
import ::df::scatter_mode;
import ::df::weighted_layer;
import ::math::dot;
import ::state::normal;
import ::state::texture_coordinate;
import ::state::texture_tangent_u;
import ::state::texture_tangent_v;
import ::tex::gamma_mode;
import ::tex::lookup_float3;
import ::tex::wrap_mode;
export material PBR_Albedo_Normal_(
uniform texture_2d Specular_Metal_Mask_Map = texture_2d() [[
anno::description(“Red channel is Specular\nGreen channel is Metal\nBlue channel is Mask\n”),
anno::display_name(“SMM_Map”),
anno::in_group(“Map”, “”, “”),
anno::usage(“”),
anno::unused(“BA_OjphbGc6OmJhc2U6OmFubm90YXRpb25zOjpnYW1tYV90eXBlKDo6dGV4OjpnYW1tYV9kZWZhdWx0KQ==”)
]],
color basecolor = base::file_texture(texture_2d(), color(0.f, 0.f, 0.f), color(1.f, 1.f, 1.f), base::mono_alpha, base::texture_coordinate_info(state::texture_coordinate(0), state::texture_tangent_u(0), state::texture_tangent_v(0)), float2(0.f, 1.f), float2(0.f, 1.f), tex::wrap_repeat, tex::wrap_repeat, false).tint [[
anno::description(“”),
anno::display_name(“Base Color”),
anno::in_group(“Base Color”, “”, “”),
anno::usage(“baseColor”),
anno::unused(“BA_OjphbGc6OmJhc2U6OmFubm90YXRpb25zOjpnYW1tYV90eXBlKDo6dGV4OjpnYW1tYV9zcmdiKQ==”),
anno::unused(“BA_OjphbGc6OmJhc2U6OmFubm90YXRpb25zOjp2aXNpYmxlX2J5X2RlZmF1bHQodHJ1ZSk=”)
]],
uniform texture_2d Albedo_Ao_Map = texture_2d() [[
anno::description(“Albedo with bake ao.”),
anno::display_name(“Albedo_Map”),
anno::in_group(“”, “”, “”),
anno::usage(“”),
anno::unused(“BA_OjphbGc6OmJhc2U6OmFubm90YXRpb25zOjpnYW1tYV90eXBlKDo6dGV4OjpnYW1tYV9kZWZhdWx0KQ==”)
]],
float3 normal = float3(base::tangent_space_normal_texture(texture_2d(), 1.f, true, true, base::texture_coordinate_info(state::texture_coordinate(0), state::texture_tangent_u(0), state::texture_tangent_v(0)), float2(0.f, 1.f), float2(0.f, 1.f), tex::wrap_repeat, tex::wrap_repeat, false, 1.f, 0.f).x, math::dot(base::tangent_space_normal_texture(texture_2d(), 1.f, true, true, base::texture_coordinate_info(state::texture_coordinate(0), state::texture_tangent_u(0), state::texture_tangent_v(0)), float2(0.f, 1.f), float2(0.f, 1.f), tex::wrap_repeat, tex::wrap_repeat, false, 1.f, 0.f).x, base::tangent_space_normal_texture(texture_2d(), 1.f, true, true, base::texture_coordinate_info(state::texture_coordinate(0), state::texture_tangent_u(0), state::texture_tangent_v(0)), float2(0.f, 1.f), float2(0.f, 1.f), tex::wrap_repeat, tex::wrap_repeat, false, 1.f, 0.f).z), base::tangent_space_normal_texture(texture_2d(), 1.f, true, true, base::texture_coordinate_info(state::texture_coordinate(0), state::texture_tangent_u(0), state::texture_tangent_v(0)), float2(0.f, 1.f), float2(0.f, 1.f), tex::wrap_repeat, tex::wrap_repeat, false, 1.f, 0.f).z) [[
anno::description(“”),
anno::display_name(“Normal”),
anno::in_group(“Normal”, “”, “”),
anno::usage(“normal”),
anno::unused(“BA_OjphbGc6OmJhc2U6OmFubm90YXRpb25zOjpnYW1tYV90eXBlKDo6dGV4OjpnYW1tYV9saW5lYXIp”),
anno::unused(“BA_OjphbGc6OmJhc2U6OmFubm90YXRpb25zOjp2aXNpYmxlX2J5X2RlZmF1bHQodHJ1ZSk=”)
]],
uniform texture_2d Normal_Roughness_Map = texture_2d() [[
anno::description(“Normal.x with Normal.z dot then combine to Normal Map.\nG channel is Roughness\n”),
anno::display_name(“Normal_Roughness_Map”),
anno::in_group(“Map”, “”, “”),
anno::usage(“”),
anno::unused(“BA_OjphbGc6OmJhc2U6OmFubm90YXRpb25zOjpnYW1tYV90eXBlKDo6dGV4OjpnYW1tYV9kZWZhdWx0KQ==”)
]])
[[
anno::description(“”),
anno::in_group(“”, “”, “”),
anno::display_name(“”),
anno::unused(“BA_Ojphbm5vOjprZXlfd29yZHMoc3RyaW5nW10oKSk=”),
anno::copyright_notice(“”),
anno::author(“”)
]]
let {
bool tmp0 = false;
material_surface tmp1(df::weighted_layer(tex::lookup_float3(Specular_Metal_Mask_Map, float2(0.f), tex::wrap_repeat, tex::wrap_repeat, float2(0.f, 1.f), float2(0.f, 1.f)).x, df::directional_factor(basecolor, color(1.f, 1.f, 1.f), 3.f, df::microfacet_ggx_smith_bsdf(tex::lookup_float3(Normal_Roughness_Map, float2(0.f), tex::wrap_repeat, tex::wrap_repeat, float2(0.f, 1.f), float2(0.f, 1.f)).y * tex::lookup_float3(Normal_Roughness_Map, float2(0.f), tex::wrap_repeat, tex::wrap_repeat, float2(0.f, 1.f), float2(0.f, 1.f)).y, tex::lookup_float3(Normal_Roughness_Map, float2(0.f), tex::wrap_repeat, tex::wrap_repeat, float2(0.f, 1.f), float2(0.f, 1.f)).y * tex::lookup_float3(Normal_Roughness_Map, float2(0.f), tex::wrap_repeat, tex::wrap_repeat, float2(0.f, 1.f), float2(0.f, 1.f)).y, color(1.f, 1.f, 1.f), state::texture_tangent_u(0), df::scatter_reflect, "")), df::custom_curve_layer(tex::lookup_float3(Specular_Metal_Mask_Map, float2(0.f), tex::wrap_repeat, tex::wrap_repeat, float2(0.f, 1.f), float2(0.f, 1.f)).y, 1.f, 5.f, 1.f, df::microfacet_ggx_smith_bsdf(tex::lookup_float3(Normal_Roughness_Map, float2(0.f), tex::wrap_repeat, tex::wrap_repeat, float2(0.f, 1.f), float2(0.f, 1.f)).y * tex::lookup_float3(Normal_Roughness_Map, float2(0.f), tex::wrap_repeat, tex::wrap_repeat, float2(0.f, 1.f), float2(0.f, 1.f)).y, tex::lookup_float3(Normal_Roughness_Map, float2(0.f), tex::wrap_repeat, tex::wrap_repeat, float2(0.f, 1.f), float2(0.f, 1.f)).y * tex::lookup_float3(Normal_Roughness_Map, float2(0.f), tex::wrap_repeat, tex::wrap_repeat, float2(0.f, 1.f), float2(0.f, 1.f)).y, color(1.f, 1.f, 1.f), state::texture_tangent_u(0), df::scatter_reflect, ""), df::diffuse_reflection_bsdf(basecolor, 0.f, ""), state::normal()), state::normal()), material_emission(emission: edf(), intensity: color(0.f, 0.f, 0.f), mode: intensity_radiant_exitance));
material_surface tmp2 = material_surface(scattering: bsdf(), emission: material_emission(emission: edf(), intensity: color(0.f, 0.f, 0.f), mode: intensity_radiant_exitance));
color tmp3 = color(1.f, 1.f, 1.f);
material_volume tmp4 = material_volume(scattering: vdf(), absorption_coefficient: color(0.f, 0.f, 0.f), scattering_coefficient: color(0.f, 0.f, 0.f));
material_geometry tmp5(float3(0.f), adobe::util::vector_texture(Specular_Metal_Mask_Map).z, normal);
hair_bsdf tmp6 = hair_bsdf();
} in
material(
thin_walled: tmp0,
surface: tmp1,
backface: tmp2,
ior: tmp3,
volume: tmp4,
geometry: tmp5,
hair: tmp6);