View bump.hlsl
//float3 T = normalize(i.uBase - dot(i.uBase, N)*N);
//float3 B = cross(N, T);
//float3x3 TBN = float3x3(T, B, N);
//float3 normal = mul(rawN, TBN);
//return fixed4((normalize(finalNormal * float3(1,1,1))), 1);
View instance.shader
Shader "SpaceFramework/PlanetShaderInstance"
{
Properties
{
_MainTex("Color Texture", 2D) = "white" {}
}
CGINCLUDE
#include "SFCommon.cginc"
View sample.hlsl
//output.height = lerp(lerp(a, b, localUV.x), lerp(c, d, localUV.x), localUV.y);
//output.height = _HeightMap.SampleLevel(MyPointRepeatSampler, uvSphere, 0).x;
//output.height = tex2Dlod(_HeightMap2, float4(uvSphere, 0, 0)).x;
float a = _HeightMap.Load(int3(coord.x, coord.y, 0)).x;
View FPSDisplay.cs
using UnityEngine;
using System.Collections;
public class FPSDisplay : MonoBehaviour
{
float deltaTime = 0.0f;
void Update()
{
deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
View groupsharedmem.hlsl
RWStructuredBuffer<float> g_data;
#define groupDim_x 128
groupshared float sdata[groupDim_x];
[numthreads(groupDim_x, 1, 1)]
void reduce1(uint3 threadIdx : SV_GroupThreadID,
uint3 groupIdx : SV_GroupID)
{
// each thread loads one element from global to shared mem
unsigned int tid = threadIdx.x;
unsigned int i = groupIdx.x * groupDim_x + threadIdx.x;
View grey2rgb.hlsl
float interpolate(float val, float y0, float x0, float y1, float x1) {
return (val - x0)*(y1 - y0) / (x1 - x0) + y0;
}
float blue(float grayscale) {
if (grayscale < -0.33) return 1.0;
else if (grayscale < 0.33) return interpolate(grayscale, 1.0, -0.33, 0.0, 0.33);
else return 0.0;
}
float green(float grayscale) {
if (grayscale < -1.0) return 0.0; // unexpected grayscale value
View bokehsplatting.shader
/*
DX11 Bokeh splatting
basic algorithm:
* find bright spots
* verify high frequency (otherwise dont care)
* if possitive, replace with black pixel and add to append buffer
* blend bokeh texture sprites via append buffer on top of blurred buffer
*/
View run compute shader.cs
RenderTexture RunShader()
{
int kernelHandle = shader.FindKernel("CSMain");
RenderTexture tex = new RenderTexture(256, 256, 24);
tex.enableRandomWrite = true;
tex.Create();
shader.SetTexture(kernelHandle, "Result", tex);
shader.Dispatch(kernelHandle, 32, 32, 1);
View lab ip config.txt
ip 202.120.38.35
mask 255.255.255.0
gateway 202.120.38.254
DNS 202.120.1.101
202.120.1.100
MAC 000874:149325
View cholupdate.py
from __future__ import division
import numpy as np
from numpy.random import randn
from scipy.linalg.blas import drot, drotg
# references for updates:
# - Golub and van Loan (4th ed.) Section 6.5.4
# - http://mathoverflow.net/questions/30162/is-there-a-way-to-simplify-block-cholesky-decomposition-if-you-already-have-deco
#
# references for downdates: