This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| public class CircularMotionXY: MonoBehaviour | |
| { | |
| [SerializeField, Range(0, 1000)] private float _Speed; | |
| [SerializeField, Range(1, 100)] private float _Radius; | |
| [SerializeField] private Transform _Center; | |
| private float _theta = 0.0f; | |
| void Update() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Shader "Custom/RaymarchingSample" | |
| { | |
| Properties | |
| { | |
| [KeywordEnum(WORLD, OBJECT)] _Coordinate ("Coordinate", int) = 0 | |
| [KeywordEnum(SPHERE, TORUS)] _Object ("Object", int) = 0 | |
| _MainTex ("Texture", 2D) = "white" {} | |
| _MaxStep ("Max Step" , int) = 100 | |
| _MaxDist ("Max Ray Distance", int) = 1000 | |
| _SurfDist ("Surface Distance", float) = 0.01 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| def uniform_hemisphere(): | |
| # Sampling 2 random numbers | |
| u_1 = np.random.rand() | |
| u_2 = np.random.rand() | |
| # Angles | |
| phi = 2 * np.pi * u_1 | |
| theta = np.pi / 2 * u_2 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| def cosine_lobe(N): | |
| # Sampling 2 random numbers | |
| u_1 = np.random.rand() | |
| u_2 = 1.0 - np.random.rand() | |
| # angles | |
| phi = 2 * np.pi * u_1 | |
| theta = np.arccos(np.power(u_2, 1/(N+1))) | |