This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader"QQ/RimLight"{ | |
Properties{ | |
_Color("Color",Color)=(1,1,1,1) | |
_MainTex("纹理",2D)="white"{} | |
<spanstyle="white-space:pre"> </span>_LightColor("灯颜色",Color)=(1,1,1,1) | |
_LightDir("灯方向",Vector)=(0,1,0,1) | |
_OutLine("描边颜色",Color)=(1,1,1,1) | |
_EdgeChange("描边大小",Range(0,.1))=.05 | |
_FlickerTime("闪烁时间,0为关闭",Range(0,2))=1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//给小骨模型做了一个御剑的动画,剑贴图所在的面片layer调整的也和主角模型一样的时候,发现居然还是看不到剑的阴影。 | |
//这个时候还对专门针对map(显示阴影的面片)材质写一个Shader,就不能用默认的Transparent/Diffuse了,并且最终剑这种透明贴图的还需要使用Unlit/Transparent,新添加的Shader详细代码如下: | |
///作为带Alpha通道的模型贴图的shader | |
Shader “MyShader/AlphaSkinShader” | |
{ | |
Properties | |
{ | |
_Color(“Main Color”,Color)=(1,1,1,1) | |
_MainTex (“Base (RGB)”, 2D) = “white” {} | |
_Cutoff(“Base Alpha cutoff”,Range(0,0.9))=0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ComputeShader代码: | |
#pragma kernel Init | |
#pragma kernel Emit | |
#pragma kernel Update | |
#include "./ComputeBuffer.cginc" | |
RWStructuredBuffer<Particle> _Particles; | |
int _xMod, _yMod, _zMod; | |
float4 _Scale; | |
float4 _Pos; | |
float _Time; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//PHP注册代码,每次访问都需要开关一次数据库,可以借助数据库连接池来解决此问题。 | |
<?php | |
include 'Common.php';//引用包含Check方法的php文件,这个是自己写的,一种检测非法手段,可以百度下,也可以不写 | |
$name=Check($_POST["name"]);//PHP获取form内容的方法,$name=$_POST["name"]; | |
$pass=Check($_POST["pass"]); | |
$con=mysql_connect("127.0.0.1","root","");//连接mysql | |
if(!$con) | |
die("Could not connect:".mysql_error());//如果连接失败则结束 | |
mysql_select_db("CreateData",$con);//选择数据库 | |
mysql_query("set names utf8");//设置utf8,否则中文会乱码噢 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Image Sequence Animation" { | |
Properties { | |
_Color ("Color Tint", Color) = (1, 1, 1, 1) | |
_MainTex ("Image Sequence", 2D) = "white" {} | |
_HorizontalAmount ("Horizontal Amount", Float) = 4 | |
_VerticalAmount ("Vertical Amount", Float) = 4 | |
_Speed ("Speed", Range(1, 100)) = 30 | |
} | |
SubShader { | |
// 设置成透明是希望画面特效能在其他物体都绘制完之后再显示 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//原理 | |
//1. 利用灯光投射范围 | |
//2. 利用法线RG偏移贴图 | |
Shader "QQ/LightWave" | |
{ | |
Properties | |
{ | |
_Color("Color",Color) = (0,0,0,1) | |
_MainTex("Texture", 2D) = "white" {} | |
_WaveTex("Wave",2D) = "white" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//摄像机脚本 | |
using UnityEngine; | |
[RequireComponent(typeof(Camera))] | |
public class WaterConfig : MonoBehaviour | |
{ | |
private Camera cam; | |
[ContextMenu("Depth")] | |
void Start() | |
{ | |
if (!cam) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//思路: | |
//1.为了投影出体积阴影,我们多用一个pass来渲染网格。 | |
//2.网格延伸的方向是灯光的方向。 | |
//3.我们将顶点转换到模型空间,然后计算和灯光的角度进行顶点的偏移。 | |
//4.因为根据顶点偏移,所以不能对断开的顶点进行平滑的过度。 | |
//5.通过点乘插值我们来决定颜色的插值。 | |
//6.该shader不仅可以用来做体积投影,也可以在灯光下做体积光。 | |
//源代码: | |
Shader"QQ/LightTrail" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//思路 | |
//1.绘制网格(使用Mesh网格生成圆柱网格https://gist.github.com/stilllisisi/fdd2c9b0035b6180c95573193038806a) | |
//2.使用B曲线平滑连接和排序网格 | |
//3.销毁网格 | |
//4.彩虹滚动使用shader实现 | |
//实现 | |
//1. 连接的网格 | |
//先生成了一系列小网格搭配BOX碰撞,为了让我们后期能对他进行裁剪和逐步消失功能。 | |
//因为我们知道网格每个顶点的序号,所以只需要根据鼠标方向生成下个网格,旧网格的结束顶点的坐标改成新网格起始顶点的坐标,就可以实现网格连接。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//一个顶点,可以分配一个UV信息,也就是说如果生成一个6边的圆柱,你需要7个边的顶点,第一边和最后一边重合,来生成0-1之间的UV值,包括法线,切线,颜色等,如果你需要一个顶点有3个法线面向,那就需要在这个位置生成3个顶点。 | |
//源代码: | |
public Mesh CreateMesh(int edg_x, int edg_y, float rad, float len) | |
{ | |
edg_x = Mathf.Max(2, edg_x);//保证最低2个边 | |
edg_y = Mathf.Max(2, edg_y); | |
int _deglen = edg_x * edg_y + edg_y; | |
normals = new Vector3[_deglen]; | |
verts = new Vector3[_deglen]; |
NewerOlder