RimWorld

RimWorld

103 ratings
NareisLib
5
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.4, 1.5, 1.6
File Size
Posted
Updated
7.834 MB
5 Jul, 2023 @ 11:32am
16 Sep @ 11:56pm
7 Change Notes ( view )

Subscribe to download
NareisLib

Description
NareisLib

The following introduction utilizes GPT for translation.

This is a custom multi-layer rendering mod built on vanilla RimWorld and the HumanAlienRace mod ------ but since the 1.5 update some functionality now overlaps with vanilla; blame Tynan ;P



1. Defining textures for vanilla defs
For example:
  • Take a HairDef whose defName is Test_Hair;
  • In another XML file, define a MultiTexDef—its defName can be anything—and set its originalDef property to Test_Hair;
  • This means the MultiTexDef is created for the HairDef named Test_Hair, and the two are now linked;
  • You can define multiple layers inside the MultiTexDef. When the game renders the linked HairDef, it automatically detects the layers defined in the MultiTexDef and renders them together.
This is just a rough workflow example. For actual usage, see the wiki guide[github.com].
Defs on a pawn that you can target include: BodyDef, HeadDef, HairDef, Apparel (clothing), and HandTypeDef.



2. Custom multi-layer textures —— this currently overlaps with vanilla functionality; blame Tynan XD
As the name implies, you can define multiple identical or different texture layers within a MultiTexDef.
Before listing the layers, you need to understand a bit about RimWorld’s pawn rendering mechanics:
  1. RimWorld primarily renders pawns using Unity’s DrawMesh function;
  2. A pawn roughly consists of two parts: the head and the body;
  3. As the function name suggests, each part corresponds to a Mesh, and textures must be drawn onto that Mesh, which comes either from the game’s internal mesh pool or is generated on the fly;
    P.S.: Vanilla RimWorld cannot render very large textures because of mesh size limitations;
  4. When vanilla draws meshes, the spacing between each mesh layer is extremely small (on the order of two to three zeros after the decimal point). When that spacing is smaller than the GPU’s highest precision, the rendering order is determined by the order in which the function is executed (the one called first ends up underneath);
  5. Unlike traditional Unity games, RimWorld uses the Y-axis as the height axis (normally this would be Z), so X and Z are the width and height of the image, and Y determines its elevation.
This mod augments and modifies the vanilla rendering functions to define several selectable layers:
Layer heights increase from top to bottom.
  1. BottomOverlay
  2. BottomHair
  3. BottomShell
  4. Body
  5. Apparel
  6. Hand
  7. Head
  8. FaceMask
  9. Hair
  10. FrontShell
  11. HeadMask
  12. Hat
  13. Overlay
Among these, Body, Apparel, Head, FaceMask, and Hair are the vanilla pawn body parts. They represent the pawn’s body, clothing/gear/headgear, head, facial makeup/beards, and hair, respectively, while the other layers revolve around these parts. Their default render order matches the list above.
The list does not mean you can only set up 13 layers; the layers define the baseline Y-offsets.
By assigning textures to any of the layers above in XML and adjusting their properties, you achieve multi-layer rendering—that’s the core functionality of this mod.



3. Mod load order
  • Harmony
  • Core
  • All DLCs
  • Human Alien Races
  • NareisLib (this mod)
  • Mods that use NareisLib
In theory, any mod that doesn’t use NareisLib can load before it.



4. Known issues (Rimworld 1.4 only)
RimWorld 1.4: Requires HugsLib (subscribe first).
Conflicts with most mods that alter the rendering logic. Known conflicts include:
Hats Display Selection (affects hat/hair rendering)
[CAT] Show Hair With Hats or Hide All Hats (affects hat/hair rendering)
Combat Extended (affects hat/hair rendering)
Vanilla Factions Expanded - Pirates (sarcophagi affect global pawn rendering)
Dubs Apparel Tweaks (features that alter hat and hair display affect hat/hair rendering)
Stylish Rim (affects global pawn rendering)
RJW Animation Framework (affects global pawn rendering)

For hair rendering incompatibilities, the framework currently forces all hairstyles to display in-game; customizable settings will be added later.
Since version 1.5 adopts the same rendering logic as vanilla, the mods listed above are (theoretically) compatible—thanks, Tynan.



5. Mods currently using this framework



6. About this framework
GitHub[github.com]
Wiki guide[github.com]

1.6 removed part of the spaghetti code
23 Comments
ゆきんこ 13 Sep @ 8:41pm 
希望取消hugsilb
boistenn 4 Aug @ 8:28am 
1.6 would be lovely I know coding takes time, wish you the best of luck and a wonderful day as this mod has been amazing.
flor4 29 Jul @ 7:35am 
跌,1.6有没有希望取消hugsilb的前置QAQ
光能族视监者 13 Jul @ 10:18pm 
1.6plz
AlioJet 11 Jul @ 7:37am 
1.6plz
verniy709 29 Oct, 2024 @ 6:59am 
@清蒸五香龙 能不能详细讲一下问题是什么,我这边测试是没有问题。
奥妮克希娅 27 Oct, 2024 @ 9:13am 
似乎1.5的渲染依然与各类帽子显示冲突,使用帽子是否显示的mod后会导致安妮特莉丝渲染出现一些问题。希望可以修复一下。目前看来cat与ab的两种都有问题,别的没有测试。
Coco 26 Oct, 2024 @ 11:06am 
大佬NB
Device 26 Oct, 2024 @ 5:42am 
张庭秀 24 Oct, 2024 @ 1:43pm 
好呀好呀,爱死你了大佬!