Compare commits
5 Commits
ecb1422937
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a825d5a707 | |||
| 69d366aaa1 | |||
|
|
7b040f7a3c | ||
|
|
81310d3ac1 | ||
| b65b6ca150 |
6
.gitattributes
vendored
@@ -1,7 +1,6 @@
|
||||
#
|
||||
# Auto Generated
|
||||
#
|
||||
|
||||
# Other
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
# Unity Binary Assets
|
||||
@@ -70,18 +69,15 @@
|
||||
*.wmv filter=lfs diff=lfs merge=lfs -text
|
||||
# Unity-Specific
|
||||
* text=auto
|
||||
|
||||
# Some assets such as lighting data, nav meshes, etc will always be binary,
|
||||
# as will anything with [PreferBinarySerialization]
|
||||
# (Even if you force it to text mode serialization)
|
||||
# Meaning autoCRLF on git will fuck up your project.
|
||||
*.asset auto
|
||||
TimeManager.asset -text
|
||||
|
||||
#
|
||||
# The following should be text to allow git merges
|
||||
#
|
||||
|
||||
*.anim text
|
||||
*.controller text
|
||||
*.mat text
|
||||
@@ -92,5 +88,3 @@ TimeManager.asset -text
|
||||
*.unity text
|
||||
*.preset text
|
||||
*.lfs_test filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 129 B |
@@ -42,6 +42,8 @@ Both Nicolas and Bandwidth have videos on setting up the PSX Dev Extension in Vi
|
||||
|
||||
[Setting up a Scene in Unity 6 for SplashEdit.](https://youtu.be/1JJFYptDTk0)
|
||||
|
||||
[Tips for Scene creation.](https://zhamul.itch.io/sauna/devlog/936240/using-psxsplashedit-to-craft-a-scene-for-playstation)
|
||||
|
||||
## PSX Components:
|
||||
|
||||
There are currently four custom Unity components for exporting your scenes to the PS1. These include:
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace SplashEdit.RuntimeCode
|
||||
{
|
||||
public List<Tri> Triangles;
|
||||
|
||||
|
||||
private static Vector3[] RecalculateSmoothNormals(Mesh mesh)
|
||||
{
|
||||
Vector3[] normals = new Vector3[mesh.vertexCount];
|
||||
@@ -89,6 +90,8 @@ namespace SplashEdit.RuntimeCode
|
||||
// Get materials and mesh.
|
||||
Material[] materials = renderer.sharedMaterials;
|
||||
Mesh mesh = renderer.GetComponent<MeshFilter>().sharedMesh;
|
||||
|
||||
bool uvWarning = false;
|
||||
|
||||
// Iterate over each submesh.
|
||||
for (int submeshIndex = 0; submeshIndex < materials.Length; submeshIndex++)
|
||||
@@ -147,11 +150,22 @@ namespace SplashEdit.RuntimeCode
|
||||
(vid1, vid2) = (vid2, vid1);
|
||||
}
|
||||
|
||||
// Set uvWarning to true if uv cooordinates are outside the range [0, 1].
|
||||
if (uv[vid0].x < 0 || uv[vid0].y < 0 || uv[vid1].x < 0 || uv[vid1].y < 0 || uv[vid2].x < 0 || uv[vid2].y < 0)
|
||||
uvWarning = true;
|
||||
if (uv[vid0].x > 1 || uv[vid0].y > 1 || uv[vid1].x > 1 || uv[vid1].y > 1 || uv[vid2].x > 1 || uv[vid2].y > 1)
|
||||
uvWarning = true;
|
||||
|
||||
// Add the constructed triangle to the mesh.
|
||||
psxMesh.Triangles.Add(new Tri { v0 = convertData(vid0), v1 = convertData(vid1), v2 = convertData(vid2), Texture = psxTexture });
|
||||
}
|
||||
}
|
||||
|
||||
if(uvWarning)
|
||||
{
|
||||
Debug.LogWarning($"UV coordinates on mesh {mesh.name} are outside the range [0, 1]. Texture repeat DOES NOT WORK right now. You may have broken textures.");
|
||||
}
|
||||
|
||||
return psxMesh;
|
||||
}
|
||||
|
||||
@@ -183,6 +197,9 @@ namespace SplashEdit.RuntimeCode
|
||||
nz = PSXTrig.ConvertCoordinateToPSX(normal.z),
|
||||
|
||||
// Map UV coordinates to a byte range after scaling based on texture dimensions.
|
||||
|
||||
|
||||
|
||||
u = (byte)Mathf.Clamp(uv.x * (width - 1), 0, 255),
|
||||
v = (byte)Mathf.Clamp((1.0f - uv.y) * (height - 1), 0, 255),
|
||||
|
||||
|
||||