Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xjine/unity_shadermatrixhacks
Get some parameters from shader matrix.
https://github.com/xjine/unity_shadermatrixhacks
unity
Last synced: 15 days ago
JSON representation
Get some parameters from shader matrix.
- Host: GitHub
- URL: https://github.com/xjine/unity_shadermatrixhacks
- Owner: XJINE
- License: bsd-3-clause
- Created: 2023-03-08T09:52:50.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-06T08:50:21.000Z (over 1 year ago)
- Last Synced: 2024-06-06T15:45:46.023Z (7 months ago)
- Topics: unity
- Language: ShaderLab
- Homepage:
- Size: 290 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Unity_ShaderMatrixHacks
Get some parameters from shader matrix.
```hlsl
float3 cameraForward = -unity_MatrixV._m02_m12_m22;float3 objectScale = float3(length(unity_ObjectToWorld._m00_m10_m20),
length(unity_ObjectToWorld._m01_m11_m21),
length(unity_ObjectToWorld._m02_m12_m22));float3 worldPosition = unity_ObjectToWorld._m03_m13_m23;
float4 clipPosition = UnityWorldToClipPos(unity_ObjectToWorld._m03_m13_m23);
float2 viewportPosition = (clipPosition.xy + 1) * 0.5;
viewportPosition.y = 1 - viewportPosition.y;
```