Skip to content

Commit 43f2e5a

Browse files
committed
Modified how UV areas are calculated so that planar objects don't get a minimum sized texture.
1 parent 33e228e commit 43f2e5a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Scripts/DecalableInfo.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ public void Render(CommandBuffer buffer, Material projector, string textureName)
109109

110110
// Create the texture if we don't have it.
111111
if (!textureTargets.ContainsKey(textureName)) {
112-
int worldScale = Mathf.RoundToInt(renderer.bounds.extents.magnitude*PaintDecal.GetTexelsPerMeter());
112+
var bounds = renderer.bounds;
113+
float maxA = Mathf.Max(bounds.extents.x*bounds.extents.y, bounds.extents.x*bounds.extents.z);
114+
float maxBounds = Mathf.Max(maxA, bounds.extents.y*bounds.extents.z);
115+
int worldScale = Mathf.RoundToInt(maxBounds*PaintDecal.GetTexelsPerMeter());
113116
int textureScale = Mathf.Clamp(CeilPowerOfTwo(worldScale), 16, 2048);
114117
if (!PaintDecal.TryReserveMemory(dilationEnabled ? 2*textureScale*textureScale*4 : textureScale*textureScale*4)) {
115118
return;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.naelstrof.skinnedmeshdecals",
33
"displayName": "Skinned Mesh Decals",
4-
"version": "6.7.6",
4+
"version": "6.7.7",
55
"unity": "2018.3",
66
"description": "Renders decals on arbitrary meshes, for any pipeline."
77
}

0 commit comments

Comments
 (0)