mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fixed heightmap shader seam
This commit is contained in:
parent
8334c67206
commit
e3015b51e9
Binary file not shown.
@ -1,9 +1,9 @@
|
|||||||
ManifestFileVersion: 0
|
ManifestFileVersion: 0
|
||||||
CRC: 3840241390
|
CRC: 3597037522
|
||||||
Hashes:
|
Hashes:
|
||||||
AssetFileHash:
|
AssetFileHash:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
Hash: 1c2c90716d1ed7c9cbf5f785e41eace6
|
Hash: 33678ea445c06b269454371064cc3a5c
|
||||||
TypeTreeHash:
|
TypeTreeHash:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
Hash: 6370d3f9de9eca57f523bce048404a46
|
Hash: 6370d3f9de9eca57f523bce048404a46
|
||||||
@ -12,6 +12,7 @@ ClassTypes:
|
|||||||
- Class: 48
|
- Class: 48
|
||||||
Script: {instanceID: 0}
|
Script: {instanceID: 0}
|
||||||
Assets:
|
Assets:
|
||||||
- Assets/SphereTextureWrapper.shader
|
- Assets/Shaders/SphereTextureWrapper.shader
|
||||||
- Assets/UnlitTransparent.shader
|
- Assets/Shaders/Ring.shader
|
||||||
|
- Assets/Shaders/UnlitTransparent.shader
|
||||||
Dependencies: []
|
Dependencies: []
|
||||||
|
|||||||
@ -97,8 +97,8 @@ namespace NewHorizons.Body
|
|||||||
|
|
||||||
float latitude = (Mathf.Rad2Deg * Mathf.Acos(v.z / Mathf.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z)));
|
float latitude = (Mathf.Rad2Deg * Mathf.Acos(v.z / Mathf.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z)));
|
||||||
float longitude = 180f;
|
float longitude = 180f;
|
||||||
if(v.x > 0) longitude = Mathf.Rad2Deg * Mathf.Atan(v.y / v.x) + 90f;
|
if(v.x > 0) longitude = Mathf.Rad2Deg * Mathf.Atan(v.y / v.x);
|
||||||
if(v.x < 0) longitude = Mathf.Rad2Deg * (Mathf.Atan(v.y / v.x) + Mathf.PI) + 90f;
|
if(v.x < 0) longitude = Mathf.Rad2Deg * (Mathf.Atan(v.y / v.x) + Mathf.PI);
|
||||||
|
|
||||||
float sampleX = heightMap.width * longitude / 360f;
|
float sampleX = heightMap.width * longitude / 360f;
|
||||||
float sampleY = heightMap.height * latitude / 180f;
|
float sampleY = heightMap.height * latitude / 180f;
|
||||||
|
|||||||
@ -42,7 +42,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
cubeSphere.AddComponent<MeshFilter>();
|
cubeSphere.AddComponent<MeshFilter>();
|
||||||
cubeSphere.GetComponent<MeshFilter>().mesh = mesh;
|
cubeSphere.GetComponent<MeshFilter>().mesh = mesh;
|
||||||
|
|
||||||
if(PlanetShader == null) PlanetShader = Main.ShaderBundle.LoadAsset<Shader>("Assets/SphereTextureWrapper.shader");
|
if(PlanetShader == null) PlanetShader = Main.ShaderBundle.LoadAsset<Shader>("Assets/Shaders/SphereTextureWrapper.shader");
|
||||||
|
|
||||||
var cubeSphereMR = cubeSphere.AddComponent<MeshRenderer>();
|
var cubeSphereMR = cubeSphere.AddComponent<MeshRenderer>();
|
||||||
cubeSphereMR.material = new Material(PlanetShader);
|
cubeSphereMR.material = new Material(PlanetShader);
|
||||||
|
|||||||
@ -13,6 +13,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
static class RingBuilder
|
static class RingBuilder
|
||||||
{
|
{
|
||||||
public static Shader RingShader;
|
public static Shader RingShader;
|
||||||
|
public static Shader UnlitShader;
|
||||||
|
|
||||||
public static void Make(GameObject body, RingModule ring, IModAssets assets)
|
public static void Make(GameObject body, RingModule ring, IModAssets assets)
|
||||||
{
|
{
|
||||||
@ -39,9 +40,10 @@ namespace NewHorizons.Builder.Body
|
|||||||
var ringMR = ringGO.AddComponent<MeshRenderer>();
|
var ringMR = ringGO.AddComponent<MeshRenderer>();
|
||||||
var texture = ringTexture;
|
var texture = ringTexture;
|
||||||
|
|
||||||
if (RingShader == null) RingShader = Main.ShaderBundle.LoadAsset<Shader>("Assets/UnlitTransparent.shader");
|
if (RingShader == null) RingShader = Main.ShaderBundle.LoadAsset<Shader>("Assets/Shaders/Ring.shader");
|
||||||
|
if (UnlitShader == null) UnlitShader = Main.ShaderBundle.LoadAsset<Shader>("Assets/Shaders/UnlitTransparent.shader");
|
||||||
|
|
||||||
var mat = new Material(RingShader);
|
var mat = new Material(ring.Unlit ? UnlitShader : RingShader);
|
||||||
mat.mainTexture = texture;
|
mat.mainTexture = texture;
|
||||||
mat.renderQueue = 2895;
|
mat.renderQueue = 2895;
|
||||||
ringMR.material = mat;
|
ringMR.material = mat;
|
||||||
|
|||||||
1
NewHorizons/External/RingModule.cs
vendored
1
NewHorizons/External/RingModule.cs
vendored
@ -13,5 +13,6 @@ namespace NewHorizons.External
|
|||||||
public float Inclination { get; set; }
|
public float Inclination { get; set; }
|
||||||
public float LongitudeOfAscendingNode { get; set; }
|
public float LongitudeOfAscendingNode { get; set; }
|
||||||
public string Texture { get; set; }
|
public string Texture { get; set; }
|
||||||
|
public bool Unlit { get; set; } = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user