-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathSpaceTransform.osl
More file actions
58 lines (51 loc) · 1.43 KB
/
SpaceTransform.osl
File metadata and controls
58 lines (51 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Created by Saul Espinosa for Redshift 3D
// Modified 01.11.2022
// This file is licensed under Apache 2.0 license
//
// History:
// 2025-10-08
// - Licensed under Apache 2.0
// - Cleaned up indentation and simplified branches
//
shader SpaceTransform
[[ string label = "Space Transform"]]
(
// Inputs
vector Input = 0
[[ string label = "Input", string page = "Input" ]],
string Type = "point"
[[ string label = "Input Type",
string page = "Input",
string widget = "popup",
string options = "point|vector|normal" ]],
string From = "world"
[[ string label = "Input Space",
string page = "Transform",
string widget = "popup",
string options = "world|object|camera|screen" ]],
string To = "world"
[[ string label = "Output Space",
string page = "Transform",
string widget = "popup",
string options = "world|object|camera|screen" ]],
int Normalize = 0
[[ string widget = "checkBox",
string page = "Transform",
string label = "Normalize",
int connectable = 0 ]],
// Output
output vector Output = 0
[[ string label = "Output", string page = "Output" ]]
)
{
// Apply selected transform
if (Type == "point")
Output = transform(From, To, point(Input));
else if (Type == "normal")
Output = transform(From, To, normal(Input));
else
Output = transform(From, To, Input);
// Normalize output
if (Normalize)
Output = normalize(Output);
}