签到

07月13日
尚未签到

共有回帖数 0

    心忧不前

    等级:


    第四章 矩阵和变换















    都是实现uv的平移
    目前进度的全部代码:
    Shader "Custom/test" {
    Properties {
    _Color ("Color", Color) = (1,1,1,1)
    _MainTex ("Albedo (RGB)", 2D) = "white" {}
    _Glossiness ("Smoothness", Range(0,1)) = 0.5
    _Metallic ("Metallic", Range(0,1)) = 0.0
    }
    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;

    struct Input {
    float2 uv_MainTex;
    };

    half _Glossiness;
    half _Metallic;
    fixed4 _Color;

    void surf (Input IN, inout SurfaceOutputStandard o) {

    float2 uv=IN.uv_MainTex;
    float3x3 m=float3x3(
    1,0,-0.5,
    0,1,-0.5,
    0,0,1
    );
    uv=mul(m,float3(uv,1)).xy;

    o.Albedo =1;
    // Metallic and smoothness come from slider variables
    o.Metallic = _Metallic;
    o.Smoothness = _Glossiness;
    o.Alpha = 1;
    }
    ENDCG
    }
    FallBack "Diffuse"
    }

    楼主 2015-10-07 21:51 回复

共有回帖数 0
  • 回 帖
  • 表情 图片 视频
  • 发表

登录直线网账号

Copyright © 2010~2015 直线网 版权所有,All Rights Reserved.沪ICP备10039589号 意见反馈 | 关于直线 | 版权声明 | 会员须知