Closed Fronkln closed 5 years ago
@antimYT It's giving not intended results
Default image
Rotate Matrix
What we actually need to do so it works
IMPORTANT DISCOVERY!
All textures excluding UP has to be FLIPPED which can be done with Array.Reverse
It's giving not intended results
works for me.
i had to write my own code so here it is (im too lazy to pull request it)
if (uSrcSettings.Inst.skyBox)
{
Material skybox = new Material(Shader.Find("Skybox/6 Sided"));
string[] skysides = new string[] { "bk", "ft", "rt", "lf", "up", "dn" };
string[] skysides_u = new string[] { "_FrontTex", "_BackTex", "_LeftTex", "_RightTex", "_UpTex", "_DownTex" };
for (int side = 0; side < 6; side++) {
var tex = ResourceManager.Inst.GetTexture($"skybox/{skyName}{skysides[side]}").ToTexture2D();
ConvertUtils.FlipTextureVertically(tex);
if (side >= 4)
tex = tex.rotateTexture(false);
tex.wrapMode = TextureWrapMode.Clamp;
skybox.SetTexture(skysides_u[side], tex);
}
RenderSettings.skybox = skybox;
DynamicGI.UpdateEnvironment();
}
And functions for ConvertUtils.cs: https://pastebin.com/WvR6DKsJ
Noted
Just making an "issue" for this so this get's more attention, on my skybox loading code, due to how Source handles skybox textures, the up texture of skybox will have incorrect rotation and will not match with the rest of the skybox.
The solution is simple:
Rotate the Skybox Up Texture2D by 90 degrees clockwise
The issue: I do not know how to do this
So if any of you coders out there can do this it would greatly help loading Skyboxes from the game