Skip to content

Instantly share code, notes, and snippets.

@esnosy
esnosy / uv_edges_blender.py
Last active November 23, 2023 06:55
Example Blender script for getting/setting UV edge selection for large meshes using NumPy and foreach_get/set
# Author: Iyad Ahmed
import bpy
# importing numpy is slow for first time
import numpy as np
prev_mode = bpy.context.object.mode
bpy.ops.object.mode_set(mode="OBJECT")
@Fewes
Fewes / Tricubic.cginc
Last active March 22, 2024 18:23
Tricubic texture sampling using 8 trilinear samples
#ifndef TRICUBIC_INCLUDED
#define TRICUBIC_INCLUDED
float4 Cubic(float v)
{
float4 n = float4(1.0, 2.0, 3.0, 4.0) - v;
float4 s = n * n * n;
float x = s.x;
float y = s.y - 4.0 * s.x;
float z = s.z - 4.0 * s.y + 6.0 * s.x;
@pixnblox
pixnblox / shading_position.hlsl
Last active August 14, 2023 13:15
Address the shadow terminator problem by computing a new shading position
// Projects the specified position (point) onto the plane with the specified origin and normal.
float3 projectOnPlane(float3 position, float3 origin, float3 normal)
{
return position - dot(position - origin, normal) * normal;
}
// Computes the shading position of the specified geometric position and vertex positions and
// normals. For a triangle with normals describing a convex surface, this point will be slightly
// above the surface. For a concave surface, the geometry position is used directly.
// NOTE: The difference between the shading position and geometry position is significant when
@voluntas
voluntas / death_march.md
Last active December 29, 2023 15:36
デスマーチが起きる理由 - 3つの指標

デスマーチが起きる理由 - 3つの指標

著者: 青い鴉(ぶるくろ)さん @bluecrow2

これは結城浩さんの運用されていた YukiWiki に当時 Coffee 様 (青い鴉(ぶるくろ)さん)がかかれていた文章です。 ただ 2018 年 3 月 7 日に YukiWiki が運用停止したため消えてしまいました。その記事のバックアップです。

今は 404 ですが、もともとの記事の URL は http://www.hyuki.com/yukiwiki/wiki.cgi?%A5%C7%A5%B9%A5%DE%A1%BC%A5%C1%A4%AC%B5%AF%A4%AD%A4%EB%CD%FD%CD%B3 になります。

昔、自分がとても感銘を受けた文章なので、このまま読めなくなるのはとてももったいないと思い、バックアップとして公開しています。

@ufcpp
ufcpp / Lambda.cs
Created November 26, 2017 06:41
静的メソッドをデリゲート化した場合の呼び出し負荷、思ったよりもでかかった
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System;
static class Lambda
{
// Roslyn 実装では、ラムダ式に対して匿名クラスが作られて、インスタンス メソッドが作られる。
// インスタンスを作る分重たそうに見えるけど、実はこの方が速い。というか静的メソッドが遅い。
public static Action Nop { get; } = () => { };
}
@ginrou
ginrou / construct_lenna.py
Last active August 14, 2023 09:27
DCTでlennaを再構成する
#!/bin/env python
import numpy as np
import scipy.misc
from scipy.fftpack import dct, idct
import sys
H = 128
W = 128
lenna = scipy.misc.imresize(scipy.misc.lena(), (H, W)).astype(float)
@cocopon
cocopon / Easing.pde
Last active January 28, 2023 04:05
A class that brings Robert Penner's easing functions into Processing
/*
* Easing.pde - brings Robert Penner's easing functions into Processing
* (c) 2015 cocopon.
*
* See the following to learn more about these famous functions:
* http://www.robertpenner.com/easing/
*
* License:
* http://www.robertpenner.com/easing_terms_of_use.html
*/
@micahscopes
micahscopes / index.html
Last active February 8, 2022 16:54
A/V hybrid synth (routes pixels from a WebGL to WebAudio)
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>reaction diffusion space ship (a/v synth)</title>
<script id="shader-vs" type="x-shader/x-vertex">
attribute vec3 aPos;
attribute vec2 aTexCoord;
varying vec2 pixel;
void main(void) {
gl_Position = vec4(aPos, 1.);
@iCyP
iCyP / readme
Last active July 25, 2018 10:51
blender用スクリプト。使用したこと等による損害等一切無保証、自己責任でどうぞ
使い方
1 .下記スクリプトのresolution,frames,outPutPassesをよしなに書き換える
※とりあえず 初期のまま、デスクトップにでもuntitle.blendを保存して、それで試して見ることをおすすめします。
以下a,b好きな方で
2a. cmdなりPowerShellなりBashなりZshなりで ./blender.exe -b <ここにレンダリングしたい*.blendのパス> -P resourceRenderScript.py (->このスクリプトのあるパス)
2b. blenderでレンダリングしたい *.blend を開いて、blenderのテキストエディタにこれを貼り付けてAlt+P
3. *.blendと同じフォルダに、同じ名前でフォルダが作られ、その中に結果が入ります。
注意