Skip to content

Instantly share code, notes, and snippets.

1) : VPOS not supported for pixel-position in fragment program
NOT FUNCTIONAL workaround: (see https://gist.github.com/aras-p/8e0c061d4e2490c1f8e2 )
#if defined(SHADER_API_D3D11)
#define VPOS_TYPE float4
#define VPOS_SEM WPOS
#else
#define VPOS_TYPE float2
#define VPOS_SEM VPOS
#endif
half4 frag( v2f IN, VPOS_TYPE in_vpos : VPOS_SEM ) : COLOR
sampler2D _CameraNormalsTexture;
float4x4 _CameraToWorld;
v2f vert (appdata v)
{
v2f o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
o.uv = ComputeScreenPos (o.pos);
o.ray = mul (UNITY_MATRIX_MV, v.vertex).xyz * float3(-1,-1,1);
@pixelmager
pixelmager / u4_to_u5
Last active February 26, 2017 19:36
u4 to u5
Oh hey, they updated the physics-engiOMG-EVERYTHING-IS-BROKEN!!1
To match look of u4:
- disable all light-baking
- disable auto-patching shaders with fog (and switch fog back to whatever mode you were using)
- set Light Bounce to 0 on all lights... or you'll get a warning!1 (on every spot-light)
- Light-shaders are now overridden explicitly in the Lighting-tab
...all other shaders still override automagically... :p
@pixelmager
pixelmager / screenshot.cs
Last active October 19, 2022 15:03
Unity HDR screenshot
if ( DoHDRscreenshot )
{
DoHDRscreenshot = false;
int w = source.width;
int h = source.height;
RenderTexture rt_hdr = RenderTexture.GetTemporary( w, h, 0, RenderTextureFormat.ARGBHalf );
Finalpass( source, rt_hdr, bloom_rt, distortion_rt, distparms ); //note: final posteffects pass
@pixelmager
pixelmager / pixelpedant.md
Last active November 13, 2023 13:11
pixel pedant

a tool like colorcop, but with the purpose of inspecting pixels, rather than picking colors.

  • resizable window like gifcam
  • zoomed window next to org pixels
  • levels-filter
  • run random shader on image
  • before/after snapshots in tabs to flip between
  • and diff-tool?

analysis

  • live histogram / waveform?