Profile image

Some info on how SP sky works + suggestions

109k hpgbproductions  3.7 years ago
1. REVERSE ENGINEERING PROJECT

If anyone has ideas on modifying the skybox, leave a comment about it. I've tried it twice, once eight months ago, and now again, but failed both times.

Goals

  • Find a way to change skyboxes.
  • Find a way to interact with the in-game skybox asset Time Of Day (TOD).

Current Summary:

  • Both the sky and directional Light are controlled by an asset called Time Of Day (TOD). Documentation exists online.
  • TOD components are controlling several MeshRenderers on objects separate from SkyDome_Low(Clone). These must be removed to use custom skyboxes.
  • "Menu Day Night Cycle" SPMOD contains a .DLL.BYTES file with scripts. If it can be converted to .DLL, there's a chance of decompiling it. (This may not be necessary)
  • The type, name, and value of each field or property are readable through reflection. Documentation states whether they can be written to.

To-Do List:

  • Implement a script that changes values through reflection.

What I know (1):
- The "skybox" isn't even an actual skybox. It uses MeshRenderer. (It is affected by the indiscriminate material replacement script in GRIDMAP)
- Using the method in the Dev Console tutorial (setting RenderSettings.skybox) doesn't work.
- There are no Skybox components in the sandbox. (Using FindObjectsOfType)

What I know (2):
- The sky GameObject in sandbox maps is called SkyDome_Low(Clone)
- The sky is generated using the Time of Day (TOD) asset on the Unity Asset Store. (GetComponents and GetType debug messaging)
- MeshRenderer found in (1) isn't in the same GameObject. I have no idea where it is. It's also possible that one of the TOD components derives from MeshRenderer.
- Program that outputs the list of components to the dev console.

What I know (3):
- Removing the SkyDome_Low(Clone) GameObject only turns the sky black. It's likely controlling the material of a MeshRenderer in a separate GameObject.
- As a side note, it also controls the directional Light. As this light is removed with the sky material, it's likely a child object of SkyDome_Low(Clone).

From the Time of Day documentation:
- This asset simulates sky colors with many equations.
- Most useful properties are public, so they are theoretically changeable with a mod script.
- I imagine that by changing these values, a certain highly suggested feature can be added (almost perfectly).

Unfortunately the asset must be in the mod to edit the sky properties, and it is expensive. (Unless there is obscure programming wizardry to do it without needing to bundle the sky asset with the mod)

You can still replace the skybox with your own by disabling the GameObject and setting RenderSettings.skybox. But you lose the advanced features of the Time of Day asset.

Other findings:
- "Menu Day Night Cycle" is an interesting mod, since it shows a modification to a TOD SkyDome. However, that GameObject is just called SkyDome and only appears in the main menu.
- Of course, it's made by a dev, who has access to more information about the game.
- Inside the mod, it's only a persistent object with a script attached to it. Can't see what that script is, though.
- The mod uses the UnityFS format, and its assets can be extracted with a suitable tool. There is a .DLL.BYTES file inside for scripting, don't know how it may be converted to a regular .DLL.


Actual suggestion part:

  • Add color changing according to altitude.

    • Change Rayleigh and Mie scattering multipliers dynamically (?)

    • Change weather towards clear dynamically (if possible)

    • Unfortunately there's no way to move the horizon of the sky dome object without moving the object.

  • Add a way to modify these parameters from mod scripts.
  • Log in to leave a comment
  • Profile image

    @1342791782 only once the method is discovered

    3.7 years ago
  • Profile image
    44.0k 1342791782

    (You can still replace the skybox with your own by disabling the GameObject and setting RenderSettings.skybox. But you lose the advanced features of the Time of Day asset.)

    Can you change skyboxes with mods?

    3.7 years ago
  • Profile image
    4,039 RC1138Boss

    @Gestour @hpgbproductions me and @ChrisPy are agreeing with you, we ran some tests on our crisps and there is a lot of acid in Pringles. That’s what I were talking about; right?

    3.7 years ago
  • Profile image
    13.9k ChrisPy

    Um yeah... that...

    3.7 years ago
  • Profile image

    @Gestour just checked, there's no TOD types/classes etc. in the mod tools or reflection tools, so it's not possible to use <T> or even see any of the TOD values

    +1 3.7 years ago
  • Profile image
    314k Gestour

    The obscure programming wizardry is called reflection.
    You need to Get the TOD script from whatever component it's on in the game, then Set the variable.
    Something Like...
    GameObject.Find("SkyDone_Low(Clone)").GetComponent<TOD>().whateveritis = 0;

    I have never tried to do that particular thing, so IDK where the script actually is, so what I wrote is just an example of how it could potentially be done.

    3.7 years ago
  • Profile image
    59.7k PapaKernels

    Very interesting.

    3.7 years ago