Skip to content

Instantly share code, notes, and snippets.

@romainguy
romainguy / d_ggx.glsl
Last active October 26, 2023 06:18
D_GGX in mediump/half float
// From https://github.com/google/filament
float D_GGX(float linearRoughness, float NoH, const vec3 h) {
// Walter et al. 2007, "Microfacet Models for Refraction through Rough Surfaces"
// In mediump, there are two problems computing 1.0 - NoH^2
// 1) 1.0 - NoH^2 suffers floating point cancellation when NoH^2 is close to 1 (highlights)
// 2) NoH doesn't have enough precision around 1.0
// Both problem can be fixed by computing 1-NoH^2 in highp and providing NoH in highp as well
// However, we can do better using Lagrange's identity:
@marco-we
marco-we / android-remote-adb
Last active August 29, 2015 14:16
How to remote adb an Android device
Connect device via USB and make sure debugging is working.
adb tcpip 5555
adb connect <DEVICE_IP_ADDRESS>:5555
Disconnect USB and proceed with wireless debugging.
adb -s <DEVICE_IP_ADDRESS>:5555 usb to switch back when done.
(source: http://stackoverflow.com/questions/4893953/android-run-install-debug-applications-over-wifi)