Research:Rendering: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(Clarify how output variables are used.) |
||
Line 41: | Line 41: | ||
vfxScale = max(1.0, sourceScale * finalScale) | vfxScale = max(1.0, sourceScale * finalScale) | ||
Attaches visual effect at entity centre + (0, 0, offset_z) | Attaches visual effect with local scale vfxScale. It is positioned at entity centre + (0, 0, offset_z). | ||
</syntaxhighlight> | </syntaxhighlight> | ||
This is preliminary research, please verify it matches standard Morrowind. | This is preliminary research, please verify it matches standard Morrowind. |
Revision as of 11:21, 24 May 2021
Spell effect VFX
Parameters: Reference reference, float sourceScale
sourceScale is normally 1.0, except:
Physical projectile hits use 0.5
Area spell effects use 2 * spell area radius
entity = reference.baseEntity
if entity is an NPC:
offset_z = 0
vfxScale = reference.scale * entity.height
else:
# entity.bounds are from the "Bounding Box" named node.
box_dimensions = entity.bounds.box.max - entity.bounds.box.min
scaleFactor_xy = max(box_dimensions.x, box_dimensions.y) / 64.0
scaleFactor_z = box_dimensions.z / 128.0
scaleFactor = reference.scale * max(factor_xy, factor_z)
offset_z = 0
if box_dimensions.z >= 128.0:
if box_dimensions.z < (box_dimensions.x + box_dimensions.y):
offset_z = 128.0 - box_dimensions.z
else:
offset_z = box_dimensions.z - 128.0
if entity is a flying actor:
offset_z = offset_z * 0.05
offset_z = offset_z * scaleFactor
vfxScale = scaleFactor
vfxScale = max(1.0, sourceScale * finalScale)
Attaches visual effect with local scale vfxScale. It is positioned at entity centre + (0, 0, offset_z).
This is preliminary research, please verify it matches standard Morrowind.