Unity Custom PBR材质

本文介绍如何在Unity中创建自定义的PBR(基于金属度)材质。内容涉及Albedo、Materialmap(G通道用于表示粗糙度)、NormalMap的使用,并提供了物理材质和非物理材质的代码实现。
摘要由CSDN通过智能技术生成

自定义 PBR(MetallicBased) 材质

说明:

    带有法线贴图,带有metallic based PBR map。基于物理渲染,可完善的使用mixedlighting。
包含三张贴图

Albedo:

  • RGBA

Materialmap:

  • R=预留
  • G=roughness
  • B=预留
  • A=metallic

NormalMap:

  • RGB=NormalMap

代码块:

物理材质:
Shader "WH40K/Static/Static_Metal_200" {
    Properties {
        _Color ("Color", Color) = (1,1,1,1)
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _Glossiness ("Smoothness", Range(0,1)) = 0.7
        _MaterialMap ("Material", 2D) = "white" {}
        _BumpMap ("NormalMap", 2D) ="bump"{}
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        // Physically based Standard lighting model, and enable shadows on all light types
        #pragma surface surf Standard fullforwardshadows

        // Use shader model 3.0 target, to get nicer looking lighting
        #pragma target 3.0

        sampler2D _MainTex;
        sampler2D _MaterialMap;
        sampler2D _BumpMap;

        struct Input {
            float2 uv_MainTex;
            float2 uv_MaterialMap;
            float2 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值