Skip to content

Instantly share code, notes, and snippets.

View cherkesgiller's full-sized avatar
🎯
0xDEADBEEF

Cherkesgiller Tural cherkesgiller

🎯
0xDEADBEEF
  • Idrak Technology Transfer
  • Azerbaijan
View GitHub Profile
@Erkaman
Erkaman / nan-payload.cpp
Last active August 5, 2019 08:22
shows how to save a payload into a NaN value.
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <inttypes.h>
int main()
{
{
float f = sqrtf(-1); // this results in f being set to nan.
@Erkaman
Erkaman / CustomTriLerp.shader
Last active November 17, 2020 07:35
Texture minification using Custom Trilinear Interpolation. From my tweet: https://twitter.com/erkaman2/status/1090645031227191296
Shader "Custom/CustomTriLerp"
{
Properties
{
[NoScaleOffset] _MainTex("Texture", 2D) = "white" {}
}
SubShader
{
Pass
{
@unitycoder
unitycoder / UNITY_MATRIX_IT_MV.shader
Last active October 12, 2023 03:31
UNITY_MATRIX_IT_MV[] Vectors in Shader
UNITY_MATRIX_IT_MV[0].xyz = ???
UNITY_MATRIX_IT_MV[1].xyz = Camera Up
UNITY_MATRIX_IT_MV[2].xyz = Camera Forward
float3 forward = -normalize(UNITY_MATRIX_V._m20_m21_m22);
float3 up = normalize(UNITY_MATRIX_V._m10_m11_m12);
float3 right = normalize(UNITY_MATRIX_V._m00_m01_m02);
float3 cameraUp = unity_CameraInvProjection[1].xyz;
float3 camRight = cross(unity_CameraInvProjection[2].xyz, cameraUp);