| 1 |
{%MainUnit castlerenderoptions.pas} |
| 2 |
{ |
| 3 |
Copyright 2002-2023 Michalis Kamburelis. |
| 4 |
|
| 5 |
This file is part of "Castle Game Engine". |
| 6 |
|
| 7 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 8 |
included in this distribution, for details about the copyright. |
| 9 |
|
| 10 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
|
| 14 |
---------------------------------------------------------------------------- |
| 15 |
} |
| 16 |
|
| 17 |
{$ifdef read_interface} |
| 18 |
|
| 19 |
type |
| 20 |
{ Shader types. } |
| 21 |
TShaderType = (stVertex, stGeometry, stFragment); |
| 22 |
|
| 23 |
{ What to do when shader uniform variable is set |
| 24 |
but doesn't exist in the shader. |
| 25 |
See @link(TGLSLProgram.UniformMissing). } |
| 26 |
TUniformMissing = ( |
| 27 |
{ Report that uniform variable not found to WritelnWarning. } |
| 28 |
umWarning, |
| 29 |
{ Report that uniform variable not found by raising EGLSLUniformNotFound. |
| 30 |
|
| 31 |
This was implemented in the past, but was not useful - we converted it to warnings anyway. |
| 32 |
Because OpenGL aggressively removes unused variables from shader code, |
| 33 |
it was common for perfectly valid shader code to raise this |
| 34 |
(e.g. when using shader for lit objects, but no light is present on the scene). |
| 35 |
} |
| 36 |
//uaException, |
| 37 |
{ Ignore the fact that uniform variable doesn't exist in the GLSL shader. |
| 38 |
Do not warn anywhere. } |
| 39 |
umIgnore |
| 40 |
); |
| 41 |
|
| 42 |
{ Type of @link(TAbstractColorNode.Mode). } |
| 43 |
TColorMode = (cmReplace, cmModulate); |
| 44 |
|
| 45 |
{ Type of @link(ToneMapping). } |
| 46 |
TToneMapping = ( |
| 47 |
tmNone, |
| 48 |
|
| 49 |
{ Uncharted 2 tone map. |
| 50 |
See http://filmicworlds.com/blog/filmic-tonemapping-operators/ } |
| 51 |
tmUncharted, |
| 52 |
|
| 53 |
{ Hejl Richard tone map. |
| 54 |
See http://filmicworlds.com/blog/filmic-tonemapping-operators/ } |
| 55 |
tmHejlRichard, |
| 56 |
|
| 57 |
{ ACES tone map. |
| 58 |
See https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/ } |
| 59 |
tmACES |
| 60 |
); |
| 61 |
|
| 62 |
{ Color space. Determines in what color space do we make lighting calculations |
| 63 |
and do we gamma-correct colors when reading textures and writing to screen. |
| 64 |
See https://castle-engine.io/color_space . } |
| 65 |
TColorSpace = ( |
| 66 |
(* |
| 67 |
{ For now we decided to not implement per-scene RenderOptions.ColorSpace. |
| 68 |
As such csDefault, and special |
| 69 |
TColorSpaceNotDefault = csSRGB..csLinear; |
| 70 |
are not useful. } |
| 71 |
csDefault, |
| 72 |
*) |
| 73 |
|
| 74 |
{ Color calculation is done in sRGB color space. |
| 75 |
That is, gamma correction is @italic(not done). |
| 76 |
|
| 77 |
This results in marginally faster but also incorrect lighting calculation. |
| 78 |
|
| 79 |
This was the "old, traditional" way of calculating lighting in 3D applications, |
| 80 |
before linear space (with gamma correction) became popular. |
| 81 |
Some 3D models and their textures may assume it and can look weird |
| 82 |
with calculation in linear space. } |
| 83 |
csSRGB, |
| 84 |
|
| 85 |
{ Color calculation is done in linear space for materials using PBR (TPhysicalMaterialNode), |
| 86 |
otherwise (for unlit and Phong lighting -- @link(TUnlitMaterialNode), @link(TMaterialNode)) |
| 87 |
the calculation is done in sRGB space. |
| 88 |
|
| 89 |
This is like using csSRGB for @link(TUnlitMaterialNode), @link(TMaterialNode), |
| 90 |
and csLinear for TPhysicalMaterialNode. |
| 91 |
It is the default color space for Castle Game Engine, |
| 92 |
as it means that typical materials in modern 3D models (PBR) will behave nicely, |
| 93 |
while also keeping backward compatibility (for Phong and unlit materials). } |
| 94 |
csLinearWhenPhysicalMaterial, |
| 95 |
|
| 96 |
{ Color calculation is always done in linear space. This results in correct lighting calculation. |
| 97 |
|
| 98 |
It means that texture colors (like for @link(TPhysicalMaterialNode.BaseTexture) |
| 99 |
or @link(TMaterialNode.DiffuseTexture) or |
| 100 |
@link(TAbstractOneSidedMaterialNode.EmissiveTexture TUnlitMaterialNode.EmissiveTexture)) |
| 101 |
are converted from sRGB into linear space before using them (to multiply with material |
| 102 |
and lighting colors) and at the end the resulting color is converted back from linear |
| 103 |
to display space (likely sRGB) for proper display. |
| 104 |
|
| 105 |
See https://castle-engine.io/color_space and |
| 106 |
https://github.com/michaliskambi/x3d-tests/wiki/Gamma-correction-in-X3D-and-glTF |
| 107 |
for more details. |
| 108 |
|
| 109 |
In other words, @italic(gamma correction is performed). } |
| 110 |
csLinear |
| 111 |
); |
| 112 |
|
| 113 |
TShadersRendering = (srDisable, srWhenRequired, srAlways) deprecated 'this was only useful with TCastleRenderOptions.Shaders, which is now deprecated in favor of TCastleRenderOptions.PhongShading'; |
| 114 |
|
| 115 |
{ Possible bump mapping options. |
| 116 |
Use for @link(TCastleRenderOptions.BumpMapping). |
| 117 |
See https://castle-engine.io/bump_mapping . } |
| 118 |
TBumpMapping = ( |
| 119 |
{ Do not perform bump mapping. The normal map texture is completely ignored. } |
| 120 |
bmNone, |
| 121 |
|
| 122 |
{ Simple bump mapping: use the information in normal map RGB channels |
| 123 |
to change the normal vector at each pixel. |
| 124 |
Achieves a realistic "rough" surface look. |
| 125 |
|
| 126 |
See https://en.wikipedia.org/wiki/Bump_mapping . } |
| 127 |
bmBasic, |
| 128 |
|
| 129 |
{ In addition to bmBasic, the texture coordinates |
| 130 |
are perturbed based on the height map and camera direction, to create |
| 131 |
illusion of 3D shape instead of flat surface. |
| 132 |
|
| 133 |
This makes e.g. the bricks on the texture really |
| 134 |
visible as "standing out", in 3D, from the wall. |
| 135 |
|
| 136 |
We rely on the height map information which should be in the alpha channel |
| 137 |
of the normal map texture. |
| 138 |
The @link(TCastleRenderOptions.BumpMappingParallaxHeight) can be used |
| 139 |
to scale that information. |
| 140 |
|
| 141 |
See https://en.wikipedia.org/wiki/Parallax_mapping . } |
| 142 |
bmParallax, |
| 143 |
|
| 144 |
{ Improves the parallax effect, by tracing the ray as it goes through the height map. |
| 145 |
This is more costly, but makes the parallax effect better. |
| 146 |
|
| 147 |
See https://www.casual-effects.com/research/McGuire2005Parallax/index.html . } |
| 148 |
bmSteepParallax, |
| 149 |
|
| 150 |
{ Improves the bmSteepParallax even more, by adding additional shadow calculation. |
| 151 |
|
| 152 |
See https://www.casual-effects.com/research/McGuire2005Parallax/index.html . } |
| 153 |
bmSteepParallaxShadowing |
| 154 |
); |
| 155 |
|
| 156 |
{ Possible values of @link(TCastleRenderOptions.Mode). } |
| 157 |
TRenderingMode = ( |
| 158 |
{ Normal rendering features. Everything is enabled |
| 159 |
(as long as other TCastleRenderOptions settings allow them). } |
| 160 |
rmFull, |
| 161 |
|
| 162 |
{ Solid color is used for everything. We do not show any color variation, |
| 163 |
materials, lights, fog, textures on surfaces, alpha test. |
| 164 |
We still do back-face culling and depth test. |
| 165 |
The idea is that we "hit" the same pixels as normal rendering |
| 166 |
(with the exception of alpha test textures, this mode |
| 167 |
doesn't set up alpha test since it doesn't set up textures). |
| 168 |
But everything has color TCastleRenderOptions.SolidColor. |
| 169 |
|
| 170 |
This is useful for special tricks. } |
| 171 |
rmSolidColor, |
| 172 |
|
| 173 |
{ Only the rendering fetures that affect depth buffer work reliably, |
| 174 |
everything else is undefined (and works as fast as possible). |
| 175 |
This is suitable if you render only to depth buffer, like for shadow maps. |
| 176 |
|
| 177 |
It's quite similar to rmSolidColor, except alpha testing must work, |
| 178 |
so (at least some) textures must be applied over the model. } |
| 179 |
rmDepth |
| 180 |
); |
| 181 |
|
| 182 |
{ Values for @link(TCastleRenderOptions.WireframeEffect). |
| 183 |
|
| 184 |
Generally, two other properties may affect the way wireframe is rendered: |
| 185 |
TCastleRenderOptions.WireframeColor and |
| 186 |
TCastleRenderOptions.LineWidth, quite self-explanatory. } |
| 187 |
TWireframeEffect = ( |
| 188 |
|
| 189 |
{ Default setting, polygons are rendered as filled polygons. } |
| 190 |
weNormal, |
| 191 |
|
| 192 |
{ Polygons are rendered as wireframe. |
| 193 |
|
| 194 |
LineWidth is used as wireframe line width (regardless of |
| 195 |
TCastleRenderOptions.Mode). |
| 196 |
|
| 197 |
Depending on TCastleRenderOptions.Mode value: |
| 198 |
|
| 199 |
@unorderedList( |
| 200 |
@item(If TCastleRenderOptions.Mode <> rmFull then WireframeColor is used as wireframe |
| 201 |
line color.) |
| 202 |
|
| 203 |
@item(If rmFull, then lines are colored |
| 204 |
and potentially lighted and textured just like their corresponding |
| 205 |
triangles would be colored. So you can control lighting using |
| 206 |
@link(TCastleRenderOptions.Lighting), |
| 207 |
@link(TCastleRenderOptions.ReceiveSceneLights), |
| 208 |
@link(TCastleRenderOptions.ReceiveGlobalLights) properties, and you |
| 209 |
can control texturing by @link(TCastleRenderOptions.Textures) property.) |
| 210 |
) } |
| 211 |
weWireframeOnly, |
| 212 |
|
| 213 |
{ The model is rendered as normal, with it's wireframe version visible |
| 214 |
on top. This is most often called "solid wireframe", since the intention |
| 215 |
is too see wireframe version of the model but still render shapes |
| 216 |
solid (e.g. filled polygons with depth test). |
| 217 |
|
| 218 |
@link(TCastleRenderOptions.WireframeColor Scene.RenderOptions.WireframeColor) and |
| 219 |
@link(TCastleRenderOptions.LineWidth Scene.RenderOptions.LineWidth) determine the color and width |
| 220 |
of lines. |
| 221 |
|
| 222 |
This is often used together with the |
| 223 |
@link(TCastleRenderOptions.Mode RenderOptions.Mode) |
| 224 |
set to rmSolidColor. In such case, |
| 225 |
Then @link(TCastleRenderOptions.SolidColor) determinesthe fill color. } |
| 226 |
weSolidWireframe, |
| 227 |
|
| 228 |
{ The model is rendered as normal, with silhouette outlined around it. |
| 229 |
This works quite like weSolidWireframe, except that weSolidWireframe |
| 230 |
makes the wireframe mesh slightly in front the model, while weSilhouette |
| 231 |
makes the wireframe mesh slightly at the back of the model. This way |
| 232 |
only the silhouette is visible from the wireframe rendering. |
| 233 |
|
| 234 |
@link(TCastleRenderOptions.WireframeColor Scene.RenderOptions.WireframeColor) and |
| 235 |
@link(TCastleRenderOptions.LineWidth Scene.RenderOptions.LineWidth) determine the color and width |
| 236 |
of silhouette lines. |
| 237 |
|
| 238 |
This is often used together with the |
| 239 |
@link(TCastleRenderOptions.Mode RenderOptions.Mode) |
| 240 |
set to rmSolidColor. In such case, |
| 241 |
Then @link(TCastleRenderOptions.SolidColor) determinesthe fill color. } |
| 242 |
weSilhouette |
| 243 |
); |
| 244 |
|
| 245 |
{ Values for @link(TCastleRenderOptions.ShadowSampling). } |
| 246 |
TShadowSampling = ( |
| 247 |
{ One sample to shadow map. } |
| 248 |
ssSimple, |
| 249 |
|
| 250 |
{ Percentage Closer Filtering improve shadow maps look, by sampling |
| 251 |
the depth map a couple of times. They also make shadow more blurry |
| 252 |
(increase shadow map size to counteract this), and a little slower. |
| 253 |
They may also introduce new artifacts (due to bad interaction |
| 254 |
with the "polygon offset" of shadow map). } |
| 255 |
ssPCF4, |
| 256 |
ssPCF4Bilinear, |
| 257 |
ssPCF16, |
| 258 |
|
| 259 |
{ Variance Shadow Maps, see http://www.punkuser.net/vsm/ . |
| 260 |
This may generally produce superior |
| 261 |
results, as shadow maps can be then filtered like normal textures |
| 262 |
(bilinear, mipmaps, anisotropic filtering). So shadows look much nicer |
| 263 |
from very close and very far distances. |
| 264 |
However, this requires new GPU, and may cause artifacts on some scenes. } |
| 265 |
ssVarianceShadowMaps |
| 266 |
); |
| 267 |
|
| 268 |
{ Texture minification filter (what happens when many texture pixels |
| 269 |
are squeezed in one screen pixel). } |
| 270 |
TAutoMinificationFilter = ( |
| 271 |
minNearest, |
| 272 |
minLinear, |
| 273 |
minNearestMipmapNearest, |
| 274 |
minNearestMipmapLinear, |
| 275 |
minLinearMipmapNearest, |
| 276 |
minLinearMipmapLinear, |
| 277 |
|
| 278 |
{ Interpretation of this filter depends on current |
| 279 |
@link(TCastleRenderOptions.MinificationFilter Scene.RenderOptions.MinificationFilter). |
| 280 |
If that is also minDefault, it depends on current |
| 281 |
@link(TCastleRenderOptions.DefaultMinificationFilter). } |
| 282 |
minDefault, |
| 283 |
{ Alias for minNearest. } |
| 284 |
minFastest, |
| 285 |
{ Alias for minLinearMipmapLinear. } |
| 286 |
minNicest |
| 287 |
); |
| 288 |
TMinificationFilter = minNearest..minLinearMipmapLinear; |
| 289 |
|
| 290 |
{ Texture magnification filter (what happens when a single texture pixel |
| 291 |
in stretched over many screen pixels). } |
| 292 |
TAutoMagnificationFilter = ( |
| 293 |
magNearest, |
| 294 |
magLinear, |
| 295 |
|
| 296 |
{ Interpretation of this filter depends on current |
| 297 |
@link(TCastleRenderOptions.MagnificationFilter Scene.RenderOptions.MagnificationFilter). |
| 298 |
If that is also magDefault, it depends on current |
| 299 |
@link(TCastleRenderOptions.DefaultMagnificationFilter). } |
| 300 |
magDefault, |
| 301 |
{ Alias for magnNearest. } |
| 302 |
magFastest, |
| 303 |
{ Alias for magLinear. } |
| 304 |
magNicest |
| 305 |
); |
| 306 |
TMagnificationFilter = magNearest..magLinear; |
| 307 |
|
| 308 |
TBlendingSourceFactor = ( |
| 309 |
bsSrcAlpha, |
| 310 |
bsOneMinusSrcAlpha, |
| 311 |
bsZero, |
| 312 |
bsOne, |
| 313 |
|
| 314 |
bsDstColor, |
| 315 |
bsSrcColor, //< As a source factor only since GL 1.4, check @code(GLFeatures.Version_1_4) |
| 316 |
bsDstAlpha, |
| 317 |
bsOneMinusDstColor, |
| 318 |
bsOneMinusSrcColor, //< As a source factor only since GL 1.4, check @code(GLFeatures.Version_1_4) |
| 319 |
bsOneMinusDstAlpha, |
| 320 |
|
| 321 |
bsSrcAlphaSaturate, |
| 322 |
|
| 323 |
bsConstantColor, |
| 324 |
bsOneMinusConstantColor, |
| 325 |
bsConstantAlpha, |
| 326 |
bsOneMinusConstantAlpha |
| 327 |
); |
| 328 |
TBlendingDestinationFactor = ( |
| 329 |
bdSrcAlpha, |
| 330 |
bdOneMinusSrcAlpha, |
| 331 |
bdZero, |
| 332 |
bdOne, |
| 333 |
|
| 334 |
bdDstColor, //< As a destination factor only since GL 1.4, check @code(GLFeatures.Version_1_4) |
| 335 |
bdSrcColor, |
| 336 |
bdDstAlpha, |
| 337 |
bdOneMinusDstColor, //< As a destination factor only since GL 1.4, check @code(GLFeatures.Version_1_4) |
| 338 |
bdOneMinusSrcColor, |
| 339 |
bdOneMinusDstAlpha, |
| 340 |
|
| 341 |
// not supported by OpenGL for destination factor: bsSrcAlphaSaturate |
| 342 |
{ } |
| 343 |
bdConstantColor, |
| 344 |
bdOneMinusConstantColor, |
| 345 |
bdConstantAlpha, |
| 346 |
bdOneMinusConstantAlpha |
| 347 |
); |
| 348 |
|
| 349 |
{ Various ways to sort the shapes. |
| 350 |
|
| 351 |
Used to define blending sort @link(TCastleViewport.BlendingSort) |
| 352 |
to correctly render partially-transparent objects. |
| 353 |
See https://castle-engine.io/blending . |
| 354 |
|
| 355 |
Used to suggest blending sort from X3D too, |
| 356 |
@link(TNavigationInfoNode.BlendingSort). |
| 357 |
|
| 358 |
Used to define occlusion sort @link(TCastleViewport.OcclusionSort) |
| 359 |
to optimize rendering. } |
| 360 |
TShapeSort = ( |
| 361 |
{ Automatically determine the best sorting method. |
| 362 |
See the documentation of each usage ( |
| 363 |
@link(TCastleViewport.BlendingSort) , |
| 364 |
@link(TNavigationInfoNode.BlendingSort) , |
| 365 |
@link(TCastleViewport.OcclusionSort) ) about what this exactly means. |
| 366 |
} |
| 367 |
sortAuto, |
| 368 |
|
| 369 |
{ Do not sort. |
| 370 |
If used for blending sort, this will cause artifacts if multiple |
| 371 |
partially-transparent objects may be visible on top of each other. |
| 372 |
Unless you manually change the order of shapes / scenes in Viewport.Items. } |
| 373 |
sortNone, |
| 374 |
|
| 375 |
{ Sort objects by their Z coordinate (independent from camera). |
| 376 |
|
| 377 |
This is good and fast for 2D worlds, with flat 2D objects |
| 378 |
that have zero (or near-zero) size in the Z axis, |
| 379 |
and they are moved in the Z axis to specify which is in front of another. |
| 380 |
|
| 381 |
More precisely, we take the minimum bounding box Z coordinate |
| 382 |
of two objects. (We don't bother calculating the middle Z coordinate, |
| 383 |
as we assume that the bounding box is infinitely small along the Z axis.) |
| 384 |
The one with @italic(larger) Z coordinate is considered to be |
| 385 |
@italic(closer), this is consistent with the right-handed coordinate system. |
| 386 |
|
| 387 |
Note that the camera position doesn't matter for this sorting. |
| 388 |
So the 2D object will look OK, @italic(even if viewed from an angle, |
| 389 |
even if viewed from the other side). } |
| 390 |
sort2D, |
| 391 |
|
| 392 |
{ Sort objects by the (3D) distance of their bounding box to the camera. |
| 393 |
This is the best universal sorting method for 3D |
| 394 |
scenes with many partially-transparent objects. |
| 395 |
|
| 396 |
The distance is measured from the middle |
| 397 |
of the bounding box, projected along the camera direction. |
| 398 |
Note that we do not measure strictly @italic(distance to the camera position), |
| 399 |
we measure @italic(distance to the point projected on camera direction). |
| 400 |
The difference is subtle, and it means that sorting makes sense even |
| 401 |
for models like Spine (with multiple thin layers that have various 3D coordinates) |
| 402 |
as long as they are billboards oriented towards the camera |
| 403 |
with @link(TCastleBillboard.MatchCameraDirection) = @true |
| 404 |
and @link(TCastleBillboard.AxisOfRotation) = zero. } |
| 405 |
sort3D, |
| 406 |
|
| 407 |
{ Sort objects by the (3D) distance of their bounding box to the camera, |
| 408 |
looking at camera direction projected on Y=0 plane. |
| 409 |
|
| 410 |
This is a good sorting method for 3D when the camera looking more upward |
| 411 |
or downward should not change the order. |
| 412 |
In particular, this sorting makes sense |
| 413 |
for models like Spine (with multiple thin layers that have various 3D coordinates) |
| 414 |
as long as they are billboards oriented towards the camera |
| 415 |
with @link(TCastleBillboard.MatchCameraDirection) = @true |
| 416 |
and @link(TCastleBillboard.AxisOfRotation) = +Y (0, 1, 0). } |
| 417 |
sort3DVerticalBillboards, |
| 418 |
|
| 419 |
{ Sort objects by the (3D) distance of their origin point |
| 420 |
(point (0,0,0) in local coordinates) |
| 421 |
to the camera. |
| 422 |
This is a useful sorting method for 3D |
| 423 |
scenes with many partially-transparent objects. |
| 424 |
|
| 425 |
This is an alternative to sort3D, it is more under your control |
| 426 |
(because the origin doesn't change e.g. because of animations |
| 427 |
or using TCastleBillboard, contrary to bounding box, |
| 428 |
see https://github.com/castle-engine/castle-engine/issues/427#issuecomment-1365862663 ). |
| 429 |
The downside is that you need to be more aware where is your object origin. |
| 430 |
|
| 431 |
Just like sort3D, this is measured by projecting the point on the camera |
| 432 |
direction, instead of measuring the distance to the camera position. |
| 433 |
|
| 434 |
@deprecated Deprecated, in most pratical applications now |
| 435 |
sort3D or sort3DVerticalBillboards will be good. } |
| 436 |
sort3DOrigin, |
| 437 |
|
| 438 |
{ Sort objects by the (3D) distance of their origin point |
| 439 |
(point (0,0,0) in local coordinates) |
| 440 |
to the camera, projected on the ground (Y=0). |
| 441 |
|
| 442 |
Similar to sort3DOrigin, but the height of the object (above Y) doesn't matter. |
| 443 |
|
| 444 |
Just like sort3D, this is measured by projecting the point on the camera |
| 445 |
direction, instead of measuring the distance to the camera position. |
| 446 |
|
| 447 |
@deprecated Deprecated, in most pratical applications now |
| 448 |
sort3DVerticalBillboards or sort3D will be good. } |
| 449 |
sort3DGround, |
| 450 |
|
| 451 |
{ Use @link(TCastleViewport.OnCustomShapeSort). |
| 452 |
If this event is not assigned, this is equivalent to sortNone. } |
| 453 |
sortCustom |
| 454 |
); |
| 455 |
|
| 456 |
{ Like TShapeSort, but doesn't allow sortAuto value. } |
| 457 |
TShapeSortNoAuto = sortNone .. High(TShapeSort); |
| 458 |
|
| 459 |
TBlendingSort = TShapeSort deprecated 'use TShapeSort'; |
| 460 |
|
| 461 |
T3DCoord = 0..2; |
| 462 |
T3DCoords = set of T3DCoord; |
| 463 |
|
| 464 |
{ Render layer for @link(TCastleTransform.RenderLayer). } |
| 465 |
TRenderLayer = (rlParent, rlBack, rlFront); |
| 466 |
|
| 467 |
{ Supported line types (patterns), for @link(TLinePropertiesNode.LineType) |
| 468 |
or @link(TRenderContext.LineType). } |
| 469 |
TLineType = ( |
| 470 |
ltSolid, |
| 471 |
ltDashed, |
| 472 |
ltDotted, |
| 473 |
ltDashedDotted, |
| 474 |
ltDashDotDot |
| 475 |
); |
| 476 |
|
| 477 |
{ Possible color channel to write, |
| 478 |
see @link(TCastleRenderOptions.InternalColorChannels). } |
| 479 |
TColorChannel = 0..3; |
| 480 |
|
| 481 |
{ Possible subset of color channels to write, |
| 482 |
see @link(TCastleRenderOptions.InternalColorChannels). } |
| 483 |
TColorChannels = set of TColorChannel; |
| 484 |
|
| 485 |
{ Possible values of @link(TRenderContext.DepthRange) and |
| 486 |
@link(TRenderParams.DepthRange). |
| 487 |
User code should not use this, rather change |
| 488 |
@link(TCastleTransform.RenderLayer). |
| 489 |
|
| 490 |
@exclude } |
| 491 |
TDepthRange = (drFull, drNear, drFar); |
| 492 |
|
| 493 |
const |
| 494 |
ShadowSamplingNames: array [TShadowSampling] of string = |
| 495 |
( 'Simple', 'PCF 4', 'PCF 4 Bilinear', 'PCF 16', 'Variance Shadow Maps (Experimental)' ); |
| 496 |
|
| 497 |
ShaderTypeName: array [TShaderType] of string = |
| 498 |
( 'Vertex', 'Geometry', 'Fragment' ); |
| 499 |
|
| 500 |
BumpMappingNames: array [TBumpMapping] of string = ( |
| 501 |
'None', |
| 502 |
'Basic', |
| 503 |
'Parallax', |
| 504 |
'Steep Parallax', |
| 505 |
'Steep Parallax With Self-Shadowing' |
| 506 |
); |
| 507 |
|
| 508 |
{ Names for TBlendingSourceFactor used by TBlendModeNode when it is read/written in X3D file. |
| 509 |
Deliberately compatible with (a subset of) X3DOM BlendMode specification on |
| 510 |
https://doc.x3dom.org/author/Shape/BlendMode.html . } |
| 511 |
BlendingSourceFactorNames: array [TBlendingSourceFactor] of string = |
| 512 |
( |
| 513 |
'SRC_ALPHA', |
| 514 |
'ONE_MINUS_SRC_ALPHA', |
| 515 |
'ZERO', |
| 516 |
'ONE', |
| 517 |
|
| 518 |
'DST_COLOR', |
| 519 |
'SRC_COLOR', |
| 520 |
'DST_ALPHA', |
| 521 |
|
| 522 |
'ONE_MINUS_DST_COLOR', |
| 523 |
'ONE_MINUS_SRC_COLOR', |
| 524 |
'ONE_MINUS_DST_ALPHA', |
| 525 |
|
| 526 |
'SRC_ALPHA_SATURATE', |
| 527 |
|
| 528 |
'CONSTANT_COLOR', |
| 529 |
'ONE_MINUS_CONSTANT_COLOR', |
| 530 |
'CONSTANT_ALPHA', |
| 531 |
'ONE_MINUS_CONSTANT_ALPHA' |
| 532 |
); |
| 533 |
|
| 534 |
{ Names for TBlendingDestinationFactor used by TBlendModeNode when it is read/written in X3D file. |
| 535 |
Deliberately compatible with (a subset of) X3DOM BlendMode specification on |
| 536 |
https://doc.x3dom.org/author/Shape/BlendMode.html . } |
| 537 |
BlendingDestinationFactorNames: array [TBlendingDestinationFactor] of string = |
| 538 |
( |
| 539 |
'SRC_ALPHA', |
| 540 |
'ONE_MINUS_SRC_ALPHA', |
| 541 |
'ZERO', |
| 542 |
'ONE', |
| 543 |
|
| 544 |
'DST_COLOR', |
| 545 |
'SRC_COLOR', |
| 546 |
'DST_ALPHA', |
| 547 |
|
| 548 |
'ONE_MINUS_DST_COLOR', |
| 549 |
'ONE_MINUS_SRC_COLOR', |
| 550 |
'ONE_MINUS_DST_ALPHA', |
| 551 |
|
| 552 |
// 'SRC_ALPHA_SATURATE', // NOT SUPPORTED AS DESTINATION FACTOR |
| 553 |
|
| 554 |
'CONSTANT_COLOR', |
| 555 |
'ONE_MINUS_CONSTANT_COLOR', |
| 556 |
'CONSTANT_ALPHA', |
| 557 |
'ONE_MINUS_CONSTANT_ALPHA' |
| 558 |
); |
| 559 |
|
| 560 |
DefaultColorSpace = csLinearWhenPhysicalMaterial; |
| 561 |
|
| 562 |
{ Default for TCastleWindow.StencilBits and TCastleControl.StencilBits. |
| 563 |
|
| 564 |
Non-zero now, which means that in both TCastleWindow and TCastleControl, |
| 565 |
shadow volumes should work by default. |
| 566 |
|
| 567 |
Note that TCastleWindow implementation makes a smooth fallback: |
| 568 |
if we cannot get stencil, we retry initialization without stencil buffer. |
| 569 |
This way we will open the window reliably, and in the worst case -- shadow volumes |
| 570 |
will not work. } |
| 571 |
DefaultStencilBits = 8; |
| 572 |
|
| 573 |
AllColorChannels = [0..3]; |
| 574 |
|
| 575 |
bsNone = sortNone deprecated 'use sortNone'; |
| 576 |
bs3D = sort3D deprecated 'use sort3D'; |
| 577 |
bs2D = sort2D deprecated 'use sort2D'; |
| 578 |
bs3DOrigin = sort3DOrigin deprecated 'use sort3DOrigin'; |
| 579 |
bs3DGround = sort3DGround deprecated 'use sort3DGround'; |
| 580 |
|
| 581 |
var |
| 582 |
{ Log shadow volume information. |
| 583 |
See https://castle-engine.io/manual_log.php about the log. } |
| 584 |
LogShadowVolumes: Boolean = false; |
| 585 |
|
| 586 |
{ Determines if color calculation is done in linear space (thus performing |
| 587 |
gamma correction when reading textures and when storing pixel color to screen) |
| 588 |
or sRGB (thus not performing gamma correction). |
| 589 |
|
| 590 |
Using linear color space follows reality better and is advised |
| 591 |
for modern games. |
| 592 |
|
| 593 |
Whatever you choose, your assets (their colors and textures) |
| 594 |
have to be prepared with the given color space in mind. |
| 595 |
|
| 596 |
See https://castle-engine.io/color_space |
| 597 |
and possible TColorSpace values documentation. } |
| 598 |
ColorSpace: TColorSpace = DefaultColorSpace; |
| 599 |
|
| 600 |
{ Change the colors you render, to make them visually better. |
| 601 |
|
| 602 |
Contrary to @link(ColorSpace), tone mapping is not about realism. |
| 603 |
It's just about changing all colors using some visually-pleasing equation. |
| 604 |
Just as with <i@link(ColorSpace), tone mapping is applied to TCastleScene rendering. |
| 605 |
It doesn't affect UI rendering. |
| 606 |
|
| 607 |
Do you want to implement your own color-changing operation? |
| 608 |
There are two ways to process colors with shaders: |
| 609 |
|
| 610 |
@orderedList( |
| 611 |
@item(You can define your own color processing using |
| 612 |
our compositing shaders ( https://castle-engine.io/compositing_shaders.php ), |
| 613 |
use PLUG_fragment_modify ( https://castle-engine.io/compositing_shaders_doc/html/section.fragment_plugs.html ). |
| 614 |
See https://github.com/castle-engine/demo-models/blob/master/compositing_shaders/tone_mapping.x3dv |
| 615 |
example. |
| 616 |
) |
| 617 |
@item(You can use screen effects (see https://castle-engine.io/x3d_extensions_screen_effects.php ) |
| 618 |
to apply post-processing in screen space.) |
| 619 |
) |
| 620 |
) } |
| 621 |
ToneMapping: TToneMapping = tmNone; |
| 622 |
|
| 623 |
{ Force given rendering for all scenes, if not weNormal. } |
| 624 |
InternalForceWireframe: TWireframeEffect; |
| 625 |
|
| 626 |
{$endif read_interface} |
| 627 |
|
| 628 |
{$ifdef read_implementation} |
| 629 |
|
| 630 |
{$endif read_implementation} |