Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
public class Gameboy : MonoBehaviour
{
public Material identityMaterial;
private RenderTexture _downscaledRenderTexture;
private void OnEnable()
{
Shader "Identity"
{
...
SubShader
{
...
Pass
{
...
float4 frag (v2f i) : SV_Target
using UnityEngine;
public class Gameboy : MonoBehaviour
{
private RenderTexture _downscaledRenderTexture;
private void OnEnable()
{
var camera = GetComponent<Camera>();
int height = 144;
using UnityEditor;
using UnityEngine;
public class MyWindow : EditorWindow
{
public MySO testNode;
[MenuItem("TEST/OPEN WINDOW")]
static void Init()
{
Shader "KumoKairo/Gradient Moon Skybox"
{
Properties
{
_SkyTint("Sky Tint", Color) = (.5, .5, .5, 1)
_GroundColor("Ground", Color) = (.369, .349, .341, 1)
_Exponent("Exponent", Range(0, 15)) = 1.0
_SunPosition("Sun Position", Vector) = (0.0, 0.0, 1.0)
_SunColor("Sun Color", Color) = (1.0, 1.0, 1.0, 1.0)
half4 frag(v2f i) : COLOR
{
half p = i.texcoord.y;
float p1 = pow(min(1.0f, 1.0f - p), _Exponent);
float p2 = 1.0f - p1;
// Our moon circle
half3 mie = calcSunSpot(_SunPosition.xyz, i.texcoord.xyz) * _SunColor;
// Blend ground fog with the moon
#define HARDNESS_EXPONENT_BASE 0.125
half calcSunSpot(half3 sunDirPos, half3 skyDirPos)
{
half3 delta = sunDirPos - skyDirPos;
half dist = length(delta);
half spot = 1.0 - smoothstep(0.0, _SunSize, dist);
return 1.0 - pow(HARDNESS_EXPONENT_BASE, spot * _SunHardness);
}
half4 frag(v2f i) : COLOR
{
half p = i.texcoord.y;
float p1 = pow(min(1.0f, 1.0f - p), _Exponent);
half3 color = lerp(_GroundColor, _SkyTint, p1);
}
half4 frag(v2f i) : COLOR
{
half p = i.texcoord.y;
// Moving [-1, 1] range to [0, 1]
half normP = p * 0.5 + 0.5;
half3 color = lerp(_GroundColor,_SkyTint, p);;
return half4(color, 1.0);
}
struct appdata
{
float4 position : POSITION;
float3 texcoord : TEXCOORD0;
};
struct v2f
{
float4 position : SV_POSITION;
float3 texcoord : TEXCOORD0;