纳金网

标题: unity水流效果 [打印本页]

作者: 仅有习惯    时间: 2017-7-25 16:50
标题: unity水流效果
请问~怎么实现unity里面谁能从高的地形留下来~能汇聚到一起,改变水下的地形还能让水溢出来,谢谢
reward_7ree
作者: shenyg77    时间: 2017-8-31 08:54
unity水流效果好想法
作者: shenyg77    时间: 2017-11-28 23:40
unity水流效果很多啊
作者: 濮轩    时间: 2018-2-7 15:09
这个太难了,做动画还可以
作者: q453157180    时间: 2018-3-1 18:58
流水一般都是UV滚动加扭曲效果吧
作者: bourne1994    时间: 2018-12-7 18:20
看怎么样的贴图配合shader
作者: bourne1994    时间: 2018-12-7 18:21
找你们程序给你选编程 编个触发条件
作者: yumianhuli1    时间: 2018-12-18 15:17
Shader "Custom/Stream" {
        Properties {
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _MainTint ("Diffuse Tint", Color) = (1,1,1,1)
                _ScrollXSpeed ("X Scroll Speed", Range(0,10)) = 2
                _ScrollYSpeed ("Y Scroll Speed", Range(0,10)) = 2
        }
        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

        // 将类型转换到CG中的可用类型
                sampler2D _MainTex;
        fixed4 _MainTint;
        fixed _ScrollXSpeed;
        fixed _ScrollYSpeed;

        // 读取模型数据的结构体,名字有些迷惑人
                struct Input {
                        float2 uv_MainTex;
                };

        // inout类型是一个输出数据的类型,顶点着色器处理好数据之后传递给片段着色器
        // 就是通过inout修饰的参数来传递的,也就是说inout修饰的类型是提供给片段着色器进一步渲染的     
                void surf (Input IN, inout SurfaceOutputStandard o) {
        
            // 先将UV坐标保存起来(这个值的类型是float2或者fixed2都可以)
            float2 scrolledUV = IN.uv_MainTex;

            // 可以根据自己的需求来决定滚动方向,此处为xy两个方向偏移
            // _Time:是基于Unity的系统内置的时间变量
            fixed xScrollValue = _ScrollXSpeed * _Time;
            fixed yScrollValue = _ScrollYSpeed * _Time;

            // fixed2(x,y):这个就不用过多解释了,将xy合并成一个二元的数据类型
            scrolledUV += fixed2(xScrollValue,yScrollValue);

            // tex2D(sampler2D,fixed2)官方定义叫:二维纹理查询
            // 给出一张图和纹理坐标计算出颜色
                        half4 c = tex2D (_MainTex, scrolledUV)* _MainTint;
                        o.Albedo = c.rgb;
                        o.Alpha = c.a;
                }
                ENDCG
        }
        FallBack "Diffuse"
}

作者: huyi0000    时间: 2019-10-23 15:34
制作一张水的无缝贴图  用粒子系统不知道行不   
作者: Moh999    时间: 2019-11-19 04:13
This is too difficult, you can also do animation .
作者: holmogool    时间: 2021-5-19 00:36
I wish to know else!
作者: holmogool    时间: 2021-5-19 00:37
yumianhuli1 发表于 2018-12-18 15:17
Shader "Custom/Stream" {
        Properties {
        _MainTex ("Albedo (RGB)", 2D) = "white" {}

That sounds difficult




欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5