@@ -414,6 +414,119 @@ the word "`alpha`", then each texture pixel will contain the RGB of
414
414
`<color>` and the alpha of `<color>` multiplied by the alpha of the
415
415
texture pixel.
416
416
417
+ Particle blend
418
+ --------------
419
+ Blend function is defined by integer number.
420
+ There is a huge number of acceptable blend modificators.
421
+ Colour of a resulting pixel calculated using formulae:
422
+
423
+ red = source_red * source_factor + destination_red * destination_factor
424
+
425
+ and so on for every channel.
426
+
427
+ Here is a some examples:
428
+
429
+ Default value:
430
+
431
+ material_type_param = 0,
432
+
433
+ Use this value to disable blending. Texture will be applied to existing pixels
434
+ using alpha channel of it. Its recomended to use 1-bit alpha
435
+ in that case. This value will leave z-buffer writeable.
436
+
437
+ Additive blend:
438
+
439
+ material_type_param = 12641,
440
+
441
+ Source = src_alpha, destination = one, alpha source is a texture and
442
+ vertex_color, modulate_1x.
443
+ Black color is completely transparent, white color is completely opaque.
444
+ Alpha channel still used to calculate result color, but not nessesary.
445
+ 'destination = one' means that resulting color will be calculated using
446
+ overwritten pixels values.
447
+ For example with color of source (our texture) RGBA = (0,192,255,63)
448
+ "blue-cyan", 1/4 opaque.
449
+ and already rendered pixel color (40,192,0) "dark lime green" we will get color:
450
+
451
+ R = source_red(0) * source_factor(src_alpha=63/255) +
452
+ destination_red(40) * destination_factor(one) =
453
+ 0 * 63/255 + 40 * 1 = 40
454
+
455
+ G = 192 * 63/255 + 192 * 1 = 239
456
+ B = 255 * 63/255 + 0 * 1 = 63
457
+
458
+ Result: (40,239,63), "green" (a kind of).
459
+ Note, if you made a texture with some kind of shape with colour 662211h
460
+ it will appear dark red with a single particle, then yellow with a
461
+ several of them and white if player looking thru a lot of them. With
462
+ this you could made a nice-looking fire.
463
+
464
+ Substractive blend:
465
+
466
+ material_type_param = 12548,
467
+
468
+ Source = zero, destination = src_color, alpha source is a texture and
469
+ vertex_color, modulate_1x.
470
+ Texture darkness act like an alpha channel.
471
+ Black color is completely opaque, white color is completely transparent.
472
+ 'destination = src_color' means that destination in multiplied by
473
+ a source values. 'source = zero' means that source values ignored
474
+ (multiplied by 0).
475
+
476
+ Invert blend:
477
+
478
+ material_type_param = 12597,
479
+
480
+ Source = one_minus_dst_color, destination = one_minus_src_alpha, alpha source
481
+ is a texture and vertex_color, modulate_1x.
482
+ Pixels invert color if source color value is big enough. If not, they just
483
+ black.
484
+ 'destination = one_minus_src_alpha' means, that effect is masked by a
485
+ source alpha channel.
486
+
487
+ You can design and use your own blend using those enum values and function
488
+ 'minetest.pack_texture_blend_func'. Returned value of a function is
489
+ your 'material_type_param'.
490
+
491
+ A values in a brackets is a multiplicators of a red, green, blue
492
+ and alpha channels respectively.
493
+
494
+ * 'minetest.ebf': global table, containing blend factor enum values. Such as:
495
+ * zero = 0 -- src & dest (0, 0, 0, 0)
496
+ * one = 1 -- src & dest (1, 1, 1, 1)
497
+ * dst_color = 2 -- src (destR, destG, destB, destA)
498
+ * one_minus_dst_color = 3 -- src (1-destR, 1-destG, 1-destB, 1-destA)
499
+ * src_color = 4 -- dest (srcR, srcG, srcB, srcA)
500
+ * one_minus_src_color = 5 -- dest (1-srcR, 1-srcG, 1-srcB, 1-srcA)
501
+ * src_alpha = 6 -- src & dest (srcA, srcA, srcA, srcA)
502
+ * one_minus_src_alpha = 7 -- src & dest (1-srcA, 1-srcA, 1-srcA, 1-srcA)
503
+ * dst_alpha = 8 -- src & dest (destA, destA, destA, destA)
504
+ * one_minus_dst_alpha = 9 -- src & dest (1-destA, 1-destA, 1-destA, 1-destA)
505
+ * src_alpha_saturate = 10 -- src (min(srcA, 1-destA), idem, ...)
506
+
507
+ * 'minetest.emfn': global table, containing modulate enum values.
508
+ * Multiply the components of the arguments, and shift the products to the
509
+ * left by x bits for brightening. Contain:
510
+ * modulate_1x = 1 -- no bit shift
511
+ * modulate_2x = 2 -- 1 bits shift
512
+ * modulate_4x = 4 -- 2 bits shift
513
+
514
+ 'modulate_4x' is quite useful when you want to make additive blend stronger
515
+ with a lower amount of particles.
516
+
517
+ * 'minetest.eas': global table, containing alpha source enum values. Such as:
518
+ * none = 0 -- do not use alpha.
519
+ * vertex_color = 1 -- use vertex color alpha.
520
+ * texture = 2 -- use texture alpha.
521
+
522
+ You can use both 'vertex_color' and 'texture' source by using value 3.
523
+
524
+ * 'minetest.pack_texture_blend_func(srcFact, dstFact, modulate, alphaSource)': return integer
525
+ * Pack texture blend funcion variable. Depending from that variable blend
526
+ * function will be applied in time of a render poligons with selected material.
527
+ * Therefore resulting pixel will be 'source * srcFact + destination * dstFact'
528
+ * Use result of this function as 'material_type_param'.
529
+
417
530
Sounds
418
531
------
419
532
Only Ogg Vorbis files are supported.
@@ -3650,7 +3763,7 @@ Definition tables
3650
3763
3651
3764
### Tile definition
3652
3765
* `"image.png"`
3653
- * `{name="image.png", animation={Tile Animation definition}}`
3766
+ * `{name="image.png", animation={Animation definition}}`
3654
3767
* `{name="image.png", backface_culling=bool, tileable_vertical=bool,
3655
3768
tileable_horizontal=bool}`
3656
3769
* backface culling enabled by default for most nodes
@@ -3661,8 +3774,50 @@ Definition tables
3661
3774
* deprecated, yet still supported field names:
3662
3775
* `image` (name)
3663
3776
3664
- ### Tile animation definition
3665
- * `{type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}`
3777
+ ### Animation definition
3778
+
3779
+ #### Node animation, particle and particle spawners
3780
+ * `{ type="vertical_frames",
3781
+ aspect_w=16,
3782
+ -- ^ specify width of a picture in pixels.
3783
+ aspect_h=16,
3784
+ -- ^ specify height of a frame in pixels.
3785
+ length=3.0
3786
+ -- ^ specify full loop length.
3787
+ first_frame = 0, -- <- only for particles, use
3788
+ min_first_frame = 0, -- <- for particle spawners
3789
+ max_first_frame = 0,
3790
+ loop_animation = true, -- <- only for particles and particle spawners
3791
+ -- specify if animation should start from beginning after last frame.
3792
+ }`
3793
+
3794
+ #### Particle and particle spawners only
3795
+ * `{
3796
+ type="2d_animation_sheet", -- <- only for particles and particle spawners
3797
+ vertical_frame_num = 1,
3798
+ horizontal_frame_num = 1,
3799
+ -- ^ specify amount of frames in texture.
3800
+ -- Can be used both for animation or for texture transform
3801
+ -- together with first_frame variable.
3802
+ -- A animation texture separated on equal parts of frames,
3803
+ -- by horizontal and vertical numbers. For example with
3804
+ -- vertical_frame_num = 4 and horizontal_frame_num = 3 we got
3805
+ -- 4*3 = 12 frames in total. Animation sequence start from
3806
+ -- left top frame and go on to the right until reach end of
3807
+ -- row. Next row also start from left frame.
3808
+ first_frame = 0, -- <- only for particles, use
3809
+ min_first_frame = 0, -- <- for particle spawners
3810
+ max_first_frame = 0,
3811
+ -- ^ specify first frame to start animation.
3812
+ frame_length = -1,
3813
+ -- ^ specify length of a frame in seconds. Negative and zero values
3814
+ -- disable animation. A sequence with vertical_frame_num = 4 and
3815
+ -- horizontal_frame_num = 3, first_frame = 4 and frame_length = 0.1
3816
+ -- will end in (4*3-4)*0.1 = 0.8 seconds.
3817
+ loop_animation = true,
3818
+ -- specify if animation should start from beginning after last frame.
3819
+ }`
3820
+ * All settings are optional. Default values is located in this example.
3666
3821
3667
3822
### Node definition (`register_node`)
3668
3823
@@ -4117,6 +4272,20 @@ The Biome API is still in an experimental phase and subject to change.
4117
4272
-- ^ Uses texture (string)
4118
4273
playername = "singleplayer"
4119
4274
-- ^ optional, if specified spawns particle only on the player's client
4275
+ material_type_param = 12641,
4276
+ -- ^ optional, if specified spawns particle with
4277
+ -- specified material type param and disable z-buffer.
4278
+ -- Some examples:
4279
+ -- Default value: 0,
4280
+ -- Additive blend: 12641,
4281
+ -- Substractive blend: 12548,
4282
+ -- Invert blend: 12597,
4283
+ -- See also "Particle blend".
4284
+ animation = {Animation definition},
4285
+ -- ^ see above. Note, that particle and particle spawners have differences.
4286
+ glow = 15,
4287
+ -- ^ optional, specify particle self-luminescence in darkness.
4288
+ values may vary from 0 (no glow) to 15 (bright glow).
4120
4289
}
4121
4290
4122
4291
### `ParticleSpawner` definition (`add_particlespawner`)
@@ -4151,6 +4320,20 @@ The Biome API is still in an experimental phase and subject to change.
4151
4320
-- ^ Uses texture (string)
4152
4321
playername = "singleplayer"
4153
4322
-- ^ Playername is optional, if specified spawns particle only on the player's client
4323
+ material_type_param = 12641,
4324
+ -- ^ optional, if specified spawns particle with specified material type
4325
+ -- param and disable z-buffer.
4326
+ -- Some examples:
4327
+ -- Default value: 0,
4328
+ -- Additive blend: 12641,
4329
+ -- Substractive blend: 12548,
4330
+ -- Invert blend: 12597,
4331
+ -- See also "Particle blend".
4332
+ animation = {Animation definition},
4333
+ -- ^ see above. Note, that particle and particle spawners have differences.
4334
+ glow = 15,
4335
+ -- ^ optional, specify particle self-luminescence in darkness.
4336
+ values may vary from 0 (no glow) to 15 (bright glow).
4154
4337
}
4155
4338
4156
4339
### `HTTPRequest` definition (`HTTPApiTable.fetch_async`, `HTTPApiTable.fetch_async`)
0 commit comments