Help us understand the problem. What is going on with this article?

シェーダーの練習でパーティーボールもどきを作った

More than 1 year has passed since last update.

パーティボールもどきをサーフェースシェーダーで書いてみた(もどきですらないけど)
コードは以下。

    Properties{
        _Diffuse("Diffuse Color", color) = (0, 0, 0, 1)
        _EmissionColor("Emission Color", color) = (1, 1, 1, 1)
    }

    SubShader{

        Tags {"RenderType" = "Opaque"}

        CGPROGRAM
        #pragma surface surf Lambert finalcolor:outemission vertex:yaxis

        struct Input {

            float customData_1;
            float customData_2;
        };

        float4 _Diffuse;
        float4 _EmissionColor;

        void yaxis(inout appdata_full v, out Input data) {

            UNITY_INITIALIZE_OUTPUT(Input, data);
            data.customData_1 = max(0, 0.5 * sin((v.vertex.y + _Time.x * 5) * 3.14159 * 8));
            data.customData_2 = max(0, 0.5 * sin((v.vertex.x + _Time.x * 5) * 3.14159 * 8));
        }

        void outemission(Input IN, SurfaceOutput o, inout fixed4 color) {
            color += (_EmissionColor * IN.customData_1 + _EmissionColor * IN.customData_2);
        }

        void surf(Input IN, inout SurfaceOutput o) {
            o.Albedo = _Diffuse;
        }
        ENDCG
    }
    FallBack "Diffuse"

実行時はこんな感じ。
スクリーンショット (3).png

このクロスした白線が時間に応じて動く感じです。サーフェースシェーダーのモディファイヤーを使って、アウトプットを加工してます。
個人的に、引数に戻り値を定義するところあたり、どうにも不快感があります。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした