Compare commits

5 Commits
lua ... main

Author SHA1 Message Date
a825d5a707 Modified .gitattributes 2025-06-17 14:07:03 +02:00
69d366aaa1 Fix LFS tracking for image files 2025-06-17 14:06:05 +02:00
Bandwidth
7b040f7a3c Merge pull request #15 from SamuliJaaskelainen/patch-1
Add tips for Scene creation link.
2025-05-03 21:27:18 +02:00
Samuli Jääskeläinen
81310d3ac1 Add tips for Scene creation link. 2025-05-01 22:02:11 +03:00
b65b6ca150 Added texture warning 2025-04-13 00:57:44 +02:00
7 changed files with 19 additions and 6 deletions

6
.gitattributes vendored
View File

@@ -1,7 +1,6 @@
# #
# Auto Generated # Auto Generated
# #
# Other # Other
*.pdf filter=lfs diff=lfs merge=lfs -text *.pdf filter=lfs diff=lfs merge=lfs -text
# Unity Binary Assets # Unity Binary Assets
@@ -70,18 +69,15 @@
*.wmv filter=lfs diff=lfs merge=lfs -text *.wmv filter=lfs diff=lfs merge=lfs -text
# Unity-Specific # Unity-Specific
* text=auto * text=auto
# Some assets such as lighting data, nav meshes, etc will always be binary, # Some assets such as lighting data, nav meshes, etc will always be binary,
# as will anything with [PreferBinarySerialization] # as will anything with [PreferBinarySerialization]
# (Even if you force it to text mode serialization) # (Even if you force it to text mode serialization)
# Meaning autoCRLF on git will fuck up your project. # Meaning autoCRLF on git will fuck up your project.
*.asset auto *.asset auto
TimeManager.asset -text TimeManager.asset -text
# #
# The following should be text to allow git merges # The following should be text to allow git merges
# #
*.anim text *.anim text
*.controller text *.controller text
*.mat text *.mat text
@@ -92,5 +88,3 @@ TimeManager.asset -text
*.unity text *.unity text
*.preset text *.preset text
*.lfs_test filter=lfs diff=lfs merge=lfs -text *.lfs_test filter=lfs diff=lfs merge=lfs -text

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 129 B

View File

@@ -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) [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: ## PSX Components:
There are currently four custom Unity components for exporting your scenes to the PS1. These include: There are currently four custom Unity components for exporting your scenes to the PS1. These include:

View File

@@ -40,6 +40,7 @@ namespace SplashEdit.RuntimeCode
{ {
public List<Tri> Triangles; public List<Tri> Triangles;
private static Vector3[] RecalculateSmoothNormals(Mesh mesh) private static Vector3[] RecalculateSmoothNormals(Mesh mesh)
{ {
Vector3[] normals = new Vector3[mesh.vertexCount]; Vector3[] normals = new Vector3[mesh.vertexCount];
@@ -89,6 +90,8 @@ namespace SplashEdit.RuntimeCode
// Get materials and mesh. // Get materials and mesh.
Material[] materials = renderer.sharedMaterials; Material[] materials = renderer.sharedMaterials;
Mesh mesh = renderer.GetComponent<MeshFilter>().sharedMesh; Mesh mesh = renderer.GetComponent<MeshFilter>().sharedMesh;
bool uvWarning = false;
// Iterate over each submesh. // Iterate over each submesh.
for (int submeshIndex = 0; submeshIndex < materials.Length; submeshIndex++) for (int submeshIndex = 0; submeshIndex < materials.Length; submeshIndex++)
@@ -147,11 +150,22 @@ namespace SplashEdit.RuntimeCode
(vid1, vid2) = (vid2, vid1); (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. // Add the constructed triangle to the mesh.
psxMesh.Triangles.Add(new Tri { v0 = convertData(vid0), v1 = convertData(vid1), v2 = convertData(vid2), Texture = psxTexture }); 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; return psxMesh;
} }
@@ -183,6 +197,9 @@ namespace SplashEdit.RuntimeCode
nz = PSXTrig.ConvertCoordinateToPSX(normal.z), nz = PSXTrig.ConvertCoordinateToPSX(normal.z),
// Map UV coordinates to a byte range after scaling based on texture dimensions. // Map UV coordinates to a byte range after scaling based on texture dimensions.
u = (byte)Mathf.Clamp(uv.x * (width - 1), 0, 255), u = (byte)Mathf.Clamp(uv.x * (width - 1), 0, 255),
v = (byte)Mathf.Clamp((1.0f - uv.y) * (height - 1), 0, 255), v = (byte)Mathf.Clamp((1.0f - uv.y) * (height - 1), 0, 255),