- 博客(21)
- 收藏
- 关注
原创 球面UV坐标
1. 如图2. 公式3. 坐标, 假设是单位球,r = 1φ = arctan(x / z)θ = arccos(y)根据 arctan的定义 : 定义域R , 值域(-π / 2,π / 2)根据 arccos的定义 : 定义域[-1, 1] , 值域[0,π]所以,得到φ = arctan(x / z) --- (-π / 2...
2016-09-30 14:12:17 5801 1
原创 Shader 好的网址
1. Shadertoyhttps://www.shadertoy.com/results?query=Water&sort=hot&filter=
2016-09-23 18:02:52 565
原创 Unity3D的渲染排序思路
主要的思路就是:场景中有各种各样的物体要渲染,那么渲染排序的意思就是,哪一些物体是先渲染,哪一些跟着渲染,哪一些最后渲染,等等。1.在材质上声明这个物体是什么时候渲染的。例如:enum RenderQueue { RQ_UNKNOW = 0, RQ_BACKGROUND = 1000, RQ_OPAQUE = 3000, RQ_ALPHATEST =
2016-09-22 16:28:48 2437
原创 Unity Shader Example 20 (Soft particle)
Shader "Particles/Additive (Soft)" {Properties { _MainTex ("Particle Texture", 2D) = "white" {} _InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0}Category { Tags { "Queue"="Transparent"
2016-09-21 21:23:05 1619
转载 Unity Shader Example 19 (fog)
参考:http://tgerm.org/Fog/游戏里对雾的模拟就是根据物体距离摄像机的远近来混合雾和物体本身的颜色。u3d中内置的雾效的渲染有三种模式:Linear,Exponential,Exp2 ,三种模式使用不同的公式计算雾的影响因子:Linear:f=dmax−|z|dmax−dmin f=dmax−|z|dmax−dmindmax受雾影响的
2016-09-21 20:41:14 536
转载 The Law of Refraction
参考:https://www.math.ubc.ca/~cass/courses/m309-01a/chu/Fundamentals/snell.htmWhen light travels from one medium to another, it generally bends, or refracts. The law of refraction gives us a w
2016-09-21 20:38:29 817
转载 Blinn–Phong Shading Model
参考:http://www.cnblogs.com/bruce81/p/3175721.htmlAlso called Blinn–Phong reflection model or modified Phong reflection model. Trade visual precision for computing efficiency.Default shadin
2016-09-21 20:36:53 1159
转载 Lighting with GLSL Phong Model
参考:http://www.ozone3d.net/tutorials/glsl_lighting_phong.php#part_11 - Summary of the Phong Lighting EquationThe final color of the pixel displayed is given by the following equation:If
2016-09-21 20:35:50 389
原创 Create Normal map from grayscale map
desTex = new Texture2D(tex.width, tex.height, TextureFormat.RGB24, false); for (int i = 0; i < tex.height; i++) { for(int j = 0; j < tex.width; j++) {
2016-09-19 14:57:44 1112
原创 球的体积微分公式
公式:dV=(r^2)sinθdθdφdr 弧长的计算公式:弧长=θ*r,θ是弧度r是半径其实就是 长 * 宽 * 高长 * 宽 * 高 = rdθ * rsinθdφ * dr
2016-09-19 14:51:16 11158
原创 Unity Shader Example 18 (Fresnel)
Shader "Fresnel/Test" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _Fresnel0 ("fresnel0", Float) = 0.1 _Color ("Rim Color", Color) = (1.0, 1.0, 1.0, 1.0) } SubShader { Pass
2016-09-18 17:41:28 674
转载 The Basics of Fresnel Shading
I recently stumbled on the awesome article: Everything Has Fresnel (if you haven’t read it, go read it now). The main premise of the article is that real world materials are not actually as neat
2016-09-18 17:35:15 692
转载 Animating Water Using Flow Maps
Last week I attended SIGGRAPH 2010, and among the many good presentations, Valve game a talk on the simple water shader they implemented for Left For Dead 2 and Portal 2. So on the plane ride back
2016-09-18 15:06:54 767
原创 透明物体的渲染的简单理解
参考:http://learnopengl-cn.readthedocs.io/zh/latest/04%20Advanced%20OpenGL/03%20Blending/如图:如果你仔细看看,就会注意到有些不对劲。前面的窗子透明部分阻塞了后面的。为什么会这样?原因是深度测试在与混合的一同工作时出现了点状况。当写入深度缓冲的时候,深度测试不
2016-09-16 14:01:51 4645
原创 Water+
#ifndef WATERPLUS_CG_INCLUDED#define WATERPLUS_CG_INCLUDED #if !defined(WATERMAPS_ON) #undef BAKED_ANISOTROPY_DIR #endif #ifdef FLOWMAP_ANIMATION_ON #define FLOWMAP_ALL_ON #endif #defi
2016-09-14 00:19:24 643
原创 Unity3D Camera K Animation 绝对值变成相对值的做法
假如有一个MainCamera,那么不在这个MainCamera下挂上Camera,然后再k Animation,直接在MainCamera的同一层, 对着MainCamera的位置K了动画,那么,当这个MainCamera只要改变了,这个Camera就需要重新去k Animation。现在做法,可以使得MainCamera 怎么移动,旋转,都不需要重新K Camera。Camera 是已
2016-09-13 21:05:15 1326
原创 Unity3D 世界坐标上一个点对应UI上一个点
方法1:具体做法1. 用一个TempCamera相机,正交, 截图,为Temp.png, 假设这张PNG为898 * 7172. 建立一个Canvas3. UICamera 4. 在Canvas 下建立一个Bg,对应把Temp,png拖到Bg上。5. 挂上脚本using UnityEngine;using Sys
2016-09-13 20:34:33 2386
原创 OpenGL 注意事项
1.GL_ASSERT( glGenTextures(1, &textureId) ); 之后,最好设置Texture的属性,例如设置UV的平铺方式:GL_ASSERT(glTexParameteri(type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));GL_ASSERT(glTexParameteri(type, GL_TEXTUR
2016-09-13 20:00:22 348
原创 Unity3D 自动添加Fbx Animation Event
using UnityEngine;using System.Collections;using UnityEditor;using System.Collections.Generic;public class Test { [MenuItem("Assets/生成动作帧事件")] public static void GenerAnimationEvent1()
2016-09-13 19:01:54 2823
转载 Hermite Curve Interpolation
参考 : http://cubic.org/docs/hermite.htmIntroductionHermite curves are very easy to calculate but also very powerful. They are used to smoothly interpolate between key-points (like object moveme
2016-09-09 17:35:31 1342
原创 在 Shader 中使用四元数
Shader 代码:vec4 quaternionMul(vec4 q, vec4 r){ vec3 qv = q.xyz; vec3 rv = r.xyz; return vec4( cross(qv, rv) + qv * r.w + q.w * rv, q.w * r.w - dot(qv, rv));}vec4 rotate(vec4 q, vec4 p){
2016-09-08 22:27:06 1920
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人