Skip to content

Instantly share code, notes, and snippets.

@yusukei
Created February 12, 2013 06:52
Show Gist options
  • Save yusukei/4760688 to your computer and use it in GitHub Desktop.
Save yusukei/4760688 to your computer and use it in GitHub Desktop.
サンプリング点の生成を可視化(SSAO) http://marina.sys.wakayama-u.ac.jp/~tokoi/?date=20101122
import maya.cmds as cmds
from math import sqrt, pow, cos, sin
import random
rand = random.random
R = 5
for i in range(5000):
r = R * rand()
#r = R * pow(rand(), 1.0/3)
t = 6.2831853 * rand() # 2pi * u
v = 2 * rand() - 1
sp = sqrt(1.0 - v*v)
x = r * sp * cos(t)
y = r * sp * sin(t)
z = r * v
s = cmds.polySphere(sx=4,sy=4,r=0.02)
cmds.move(x, y, z, s, absolute=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment