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; | |
public class Gameboy : MonoBehaviour | |
{ | |
public Material identityMaterial; | |
private RenderTexture _downscaledRenderTexture; | |
private void OnEnable() | |
{ |
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 "Identity" | |
{ | |
... | |
SubShader | |
{ | |
... | |
Pass | |
{ | |
... | |
float4 frag (v2f i) : SV_Target |
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; | |
public class Gameboy : MonoBehaviour | |
{ | |
private RenderTexture _downscaledRenderTexture; | |
private void OnEnable() | |
{ | |
var camera = GetComponent<Camera>(); | |
int height = 144; |
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 UnityEditor; | |
using UnityEngine; | |
public class MyWindow : EditorWindow | |
{ | |
public MySO testNode; | |
[MenuItem("TEST/OPEN WINDOW")] | |
static void Init() | |
{ |
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 "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) |
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
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 |
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
#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); | |
} |
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
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); | |
} |
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
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); | |
} |
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
struct appdata | |
{ | |
float4 position : POSITION; | |
float3 texcoord : TEXCOORD0; | |
}; | |
struct v2f | |
{ | |
float4 position : SV_POSITION; | |
float3 texcoord : TEXCOORD0; |