3D打印机shader特效简单实现
来源:互联网 发布:java简单售票系统 编辑:程序博客网 时间:2024/04/30 00:01
原文链接 : http://www.manew.com/thread-97539-1-1.html
Shader "Custom/3Dprinter" {Properties {_Color("Color", Color) = (1, 1, 1, 1)_MainTex("Adbedo(RGB)", 2D) = "white" {}_Glossiness("Smoothness", Range(0, 1)) = 0.5_Metallic("Metallic", Range(0, 1)) = 0.0_ConstructY("constructY", float) = 0_ConstructGap("constructGap", float) = 1_ConstructColor("constructColor", Color) = (0.5, 0.5, 0.5, 0.5)}SubShader {Tags { "RenderType"="Opaque" }LOD 200Cull Off CGPROGRAM#pragma surface surf Standard fullforwardshadows#pragma target 3.0 sampler2D _MainTex;float _ConstructY;fixed4 _ConstructColor;float _ConstructGap;float3 viewDir;int building;half _Glossiness;half _Metallic;fixed4 _Color;struct Input{float2 uv_MainTex;float3 worldPos;float3 viewDir;};void surf(Input IN, inout SurfaceOutputStandard o){viewDir = IN.viewDir;float s = +sin((IN.worldPos.x * IN.worldPos.z) * 60 + _Time[3] + o.Normal) / 120;if(IN.worldPos.y > _ConstructY){fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;o.Albedo = c.rgb;o.Alpha = c.a;building = 0;}else {o.Albedo = _ConstructColor.rgb;o.Alpha = _ConstructColor.a;building = 1;}o.Metallic = _Metallic;o.Smoothness = _Glossiness;}//inline void LightingCustom_GI(SurfaceOutputStandard s, UnityGIInput data, inout UniI gi)//{//LightingStandard_GI(s, data, gi);//} inline void LightingCustom_GI(SurfaceOutputStandard s, UnityGIInput data,inout UnityGI gi) { LightingStandard_GI(s,data,gi); }inline half4 LightingCustom(SurfaceOutputStandard s, half3 lightDir, UnityGI gi){if(building)return _ConstructColor;if(dot(s.Normal, viewDir) > 0)return _ConstructColor;return LightingStandard(s, lightDir, gi);}ENDCG }FallBack "Diffuse"}
using UnityEngine;using System.Collections;public class _3Dprinter : MonoBehaviour { private Material mat; public float timer = 0; public float value = 1; void Start() { mat = GetComponent<MeshRenderer>().material; } void Update() { timer += Time.deltaTime; if (timer > 0.1f) { if (value <= 3) { mat.SetFloat("_ConstructY", value += 0.05f); timer = 0; } } }}
0 0
- 3D打印机shader特效简单实现
- Unity中使用Shader实现3D打印机效果
- Shader特效——“Simple 3D Raymarch”的实现 【GLSL】
- Shader特效——“Distance 2D”的实现【ShaderToy】
- 3D、描边字体特效的简单实现方法
- Shader特效——实现简单的“FishEye”【GLSL】
- CSS3 实现3D特效
- CSS3 实现3D特效
- 【Unity&2D&Sprite&描边&特效&Shader】2D2.5D像素图片描边特效实现
- WindowsSDK实现3D字体特效
- css3—实现3D特效
- 3D打印机
- 3D巧克力打印机
- 3D打印机!!!
- 3D打印机
- 3d打印机
- 3D打印机杂谈
- Shader相关Mask裁切UI粒子特效或者3D模型
- ROS hydro turtlebotArm相关网址总结
- 【Linux】linux常用基本命令
- day7 part2:JavaScript DOM编程学习笔记01
- 高效搜索
- java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries
- 3D打印机shader特效简单实现
- git config配置文件
- 使用adb命令连接模拟器,在5037端口未被占用情况下仍报端口错误
- Leveldb源码分析--16
- string类(二、常用string函数)
- 1002 【2017.1.17】小X的十滴水
- 337. House Robber III
- Redis单点测试用,安装部署
- 第一次使用java连接mongodb遇到的问题