Skip to content

Instantly share code, notes, and snippets.

@reinsteam
reinsteam / atmosphere_clouds_rendering.md
Last active March 1, 2024 14:43
A collection of links to various materials on atmosphere / clouds rendering

Atmosphere / Clouds Rendering

Research papers

Atmosphere

  • A fast, simple method to render sky color using gradients maps [[Abad06]]
  • A Framework for the Experimental Comparison of Solar and Skydome Illumination [[Kider14]]
  • A Method for Modeling Clouds based on Atmospheric Fluid Dynamics [[Miyazaki01]]
  • A Physically-Based Night Sky Model [[Jensen01]]
@reinsteam
reinsteam / enum_heaps.c
Created August 28, 2015 11:51
Sample code of heap enumeration without using Tool Help functions <tlhelp32.h>
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
#pragma warning (push)
/* 4820: '<struct-name>' : 'n' bytes padding added after data member '<member-name>'*/
# pragma warning (disable : 4820)
# include <windows.h>
# include <stdio.h>
@reinsteam
reinsteam / pcomp.md
Created November 20, 2016 12:04
Links to materials about perceptual image comparison metric

Perceptual Image Differencing

  • [1983. Peter Burt and Edward Adelson. The Laplacian Pyramid as a Compact Image Code][1]
  • [1993. Scott Daly. The visible differences predictor: an algorithm for the assessment of image fidelity][2]
  • [1995. Andrew S. Glassner. In Principles of digital image synthesis, pages 59-66][3]
  • [1997. Gregory Ward-Larson, Holly Rushmeier, and Christine Piatko. A visibility matching tone reproduction operator for high dynamic range scenes][4]
  • [1999. Mahesh Ramasubramanian, Sumant N. Pattnaik, Donald P. Greenberg. A perceptually based physical error metric for realistic image synthesis][5]
  • [2004. Yangli Hector Yee, Anna Newman. A perceptual metric for production Testing][6]
  • [2004. HECTOR YEE, SUMANTA PATTANAIK and DONALD P. GREENBERG. Spatiotemporal Sensitivity and Visual Attention for Efficient Rendering of Dynamic Environments][7]
  • [2004. Hector Yee. *A Perceptual Metric for Production Testing (Submitted and Accepted in Journal of
@reinsteam
reinsteam / tbn_from_quat.c
Last active October 15, 2020 03:05
Snippet to calculate TBN basis from quaternion in 8 instructions (seems like this one is used at Crytek: http://www.crytek.com/download/izfrey_siggraph2011.pdf)
/*----------------------------------------------------------------------------------------------------------------------
Custom cross-product: mad + mul
----------------------------------------------------------------------------------------------------------------------*/
half3 crs(half3 v0, half3 v1)
{
//return cross(v0, v1);
half3 v0_0 = v0.yzx;
half3 v0_1 = v1.zxy;
half3 v1_0 = v0.zxy;
half3 v1_1 = v1.yzx;
/*
set isa_file=%~1.isa
set analysis_file=%~1.a
set isa_file
rga --define COMPILER_AMD_RGA=1 --source-kind hlsl --asic Pitcairn --profile cs_5_0 --function %2 --intrinsics --isa %isa_file% %1
*/
#if COMPILER_AMD_RGA
#include "ags_shader_intrinsics_dx11.hlsl"
uint2 ballot(bool pred)
@reinsteam
reinsteam / iaca_output.txt
Created February 23, 2019 04:57
Throughput analysis dump from IACA 2.3
Intel(R) Architecture Code Analyzer Version - 2.3 build:c151d5a (Thu, 6 Jul 2017 09:41:36 +0300)
Analyzed File - aosoa_packet.obj
Binary Format - 64Bit
Architecture - HSW
Analysis Type - Throughput
*******************************************************************
Intel(R) Architecture Code Analyzer Mark Number 1
*******************************************************************
// construct SunDir from cosine of an angle between the vector and zenith (MuS)
SunDir.x = 0.0;
SunDir.y = MuS;
SunDir.z = sqrt(1.0 - MuS * MuS);
// construct EyeDir from cosine of an angle between the vector and zenith (Mu)
EyeDir.x = 0.0;
EyeDir.y = Mu;
EyeDir.z = sqrt(1.0 - Mu * Mu);
Sigma = 1.0638460811;
X0 = 0.0;
X1 = 0.9580110968;
X2 = 2.01388028375;
G(X0) = 0.3750 = 6.0 / 16.0
G(X1) = 0.2500 = 4.0 / 16.0
G(X2) = 0.0625 = 1.0 / 16.0
@reinsteam
reinsteam / LdsMinMax.hlsl
Created April 6, 2018 15:41
Min/Max reduction example
groupshared float ldsMin[64];
groupshared float ldsMax[64];
void LdsMinMax(uint Idx, uint Ofs)
{
[branch] if (Idx < Ofs)
{
ldsMin[Idx] = min(ldsMin[Idx], ldsMin[Idx + Ofs]);
ldsMax[Idx] = max(ldsMax[Idx], ldsMax[Idx + Ofs]);
}
@reinsteam
reinsteam / TriangleFilteringCS.hlsl
Created April 2, 2018 15:23
Profiling stats of simple triangle filtering shader from [Pyramid](https://github.com/jbarczak/Pyramid)
/*-----------------------------------------------------------------------------------------------------------------------
* Output from Pyramid:
*
* SGPRs: 30 / 102
* VGPRs: 20 / 256
* LDS bytes/tg 32 / 32768
* Waves/Group: 4
* Occupancy:
* S: 10 waves/SIMD
* V: 10 waves/SIMD