Pugrad is a color gradient generator for Unity that supports commonly-used perceptually uniform colormaps.
At the moment, Pugrad supports the following colormaps:
// | |
// Lookup Tables for Transvoxel's Modified Marching Cubes | |
// | |
// Unlike the original paper (Marching Cubes: A High Resolution 3D Surface Construction Algorithm), these tables guarantee | |
// a closed mesh "whose connected components are continuous and free of holes." | |
// | |
// Rotations are prioritised over inversions so that 3 of the 6 cases containing ambiguous faces are never added. 3 extra | |
// cases are added as a post-process, overriding inverses through custom-build rotations to eliminate the rest. | |
// | |
// Uses the exact same co-ordinate system as https://gist.github.com/dwilliamson/c041e3454a713e58baf6e4f8e5fffecd |
// Copyright 2019 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
// Polynomial approximation in GLSL for the Turbo colormap | |
// Original LUT: https://gist.github.com/mikhailov-work/ee72ba4191942acecc03fe6da94fc73f | |
// Authors: | |
// Colormap Design: Anton Mikhailov (mikhailov@google.com) | |
// GLSL Approximation: Ruofei Du (ruofei@google.com) |
Setup: | |
1. Index buffer containing N quads (each 2 triangles), where N is the max amount of spheres. Repeating pattern of {0,1,2,1,3,2} + K*4. | |
2. No vertex buffer. | |
Render N*2 triangles, where N is the number of spheres you have. | |
Vertex shader: | |
1. Sphere index = N/4 (N = SV_VertexId) | |
2. Quad coord: Q = float2(N%2, (N%4)/2) * 2.0 - 1.0 | |
3. Transform sphere center -> pos |
// When creating shaders for Universal Render Pipeline you can you the ShaderGraph which is super AWESOME! | |
// However, if you want to author shaders in shading language you can use this teamplate as a base. | |
// Please note, this shader does not necessarily match perfomance of the built-in URP Lit shader. | |
// This shader works with URP 7.1.x and above | |
Shader "Universal Render Pipeline/Custom/Physically Based Example" | |
{ | |
Properties | |
{ | |
// Specular vs Metallic workflow | |
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0 |
// Rotation with angle (in radians) and axis | |
float3x3 AngleAxis3x3(float angle, float3 axis) | |
{ | |
float c, s; | |
sincos(angle, s, c); | |
float t = 1 - c; | |
float x = axis.x; | |
float y = axis.y; | |
float z = axis.z; |
// 2 sided standard surface shader (using 2 passes), with fixed normals for flipped faces | |
Shader "Custom/TwoSided (FixedNormals)" | |
{ | |
Properties | |
{ | |
_Color ("Color", Color) = (1,1,1,1) | |
_MainTex ("Albedo (RGB)", 2D) = "white" {} | |
_Glossiness ("Smoothness", Range(0,1)) = 0.5 | |
_Metallic ("Metallic", Range(0,1)) = 0.0 |
===
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |