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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
use ;
use *;
use Reflect;
use ExtractComponent;
use From;
/// Marker component identifying the entity representing the center of the chunking and lod systems.
///
/// This should be added to the camera or the player controller.
;
/// Component specifying the LOD for a [`ScatterItem`].
;
/// Marker component for debug visualization.
///
/// Makes shaders return `debug_color` in the fragment shader.
///
/// Enables `#ifdef MATERIAL_DEBUG` in shaders.
;
/// Marker component to make instances always face the camera.
///
/// Enables `#ifdef BILLBOARDING` in shaders.
///
/// Not supported in combination with [`EdgeCorrectionFactor`].
;
/// Marker component to force simple, undisplaced world-space normals.
///
/// Will have incorrect lighting on displaced vertices,
/// as the normals will not match the displaced vertex positions.
///
/// **Note:** If neither [`FastNormals`] nor [`AnalyticalNormals`] is present,
/// the shader defaults to the numerical path, which is the most accurate, but most expensive path,
/// as it runs the full displacement logic on the neighbors to find the surface direction,
/// which should only be used for complex foliage like non-billboarded bushes, trees.
///
/// **Note:** For correct fallback behavior (if the mesh lacks tangents or normals),
/// the mesh should ideally be modeled with its "growth" axis along Y-Up (`+Y`)
/// and its "face" pointing along Z-Up (`+Z`).
///
/// Typically used for performance reasons and/or on static or barely wind-affected objects.
///
/// Enables `#ifdef FAST_NORMALS` in shaders.
;
/// Marker component to enable approximated, mathematically derived normals.
///
/// Should be faster than numerical sampling but less accurate,
/// as it only accounts for `static_bend`, `twist`,
/// and `macro_wind`, ignoring high-frequency displacements.
///
/// **Note:** If neither [`FastNormals`] nor [`AnalyticalNormals`] is present,
/// the shader defaults to the numerical path, which is the most accurate, but most expensive path,
/// as it runs the full displacement logic on the neighbors to find the surface direction,
/// which should only be used for complex foliage like non-billboarded bushes, trees.
///
/// **Note:** For correct fallback behavior (if the mesh lacks tangents or normals),
/// the mesh should ideally be modeled with its "growth" axis along Y-Up (`+Y`)
/// and its "face" pointing along Z-Up (`+Z`).
///
/// Typically used for billboarded foliage or flat meshes like grass.
///
/// Enables `#ifdef ANALYTICAL_NORMALS` in shaders.
;
/// Adds Edge Correction.
///
/// See [`EdgeCorrectionFactor`].
;
/// Controls the edge correction effect (makes vegetation look fuller).
///
/// Corresponds to `wind.edge_correction_factor` in shaders.
///
/// Defaults to `0.02`.
///
/// Enables `#ifdef EDGE_CORRECTION` in shaders if larger than 0.
///
/// Not supported in combination with [`EnableBillboarding`].
///
/// TODO requires previous camera/view and normals so currently broken with temporal fx
;
/// Marker component to enable simulated subsurface scattering.
///
/// Enables `#ifdef SUBSURFACE_SCATTERING` in shaders.
///
/// [`InstancedWindAffectedMaterial`] has support for subsurface scattering currently,
/// if it is using the standard PBR lighting, which this effect requires (emissive material).
;
/// Controls the overall intensity of the subsurface scattering (SSS) effect.
///
/// This acts as a master multiplier for the entire SSS calculation,
/// scaling both the back-scatter and front-scatter components.
/// Higher values make the material more emissive, i.e., it starts to `glow`.
///
/// Corresponds to `sss_strength` in the shader uniforms.
///
/// Defaults to `0.5`.
///
/// **Note:** This component only has an effect if the
/// [`SubsurfaceScattering`] marker component is also present.
;
/// Controls the strength of the back-scattering (rim-lighting) SSS effect.
///
/// This value specifically scales the light that scatters *through* the
/// object from behind (relative to the camera). Higher values create
/// a brighter, more pronounced "glow" on the edges of the object
/// when it is backlit.
///
/// Corresponds to `sss_scale` in the shader uniforms.
///
/// Defaults to `1.0`.
///
/// **Note:** This component only has an effect if the
/// [`SubsurfaceScattering`] marker component is also present.
;
/// Controls the light intensity scale.
///
/// Used for Blinn-Phing shading/lighting and [`StandardPBR`] + [`SubsurfaceScattering`],
/// but should be set to a low value when used with Blinn-Phong, e.g., `0.0001`.
///
/// Defaults to `1.0`.
///
/// **NOTE:** this might be removed in the future.
///
/// TODO
;