Texel Density preset.

This commit is contained in:
max 2021-04-23 17:02:34 +02:00
parent 14d7e7eb41
commit 9f0566f358
22 changed files with 157 additions and 260 deletions

View File

@ -13,16 +13,16 @@ MonoBehaviour:
m_Name: Default
m_EditorClassIdentifier:
content:
icon: {fileID: 2800000, guid: 1553c43734bfa6345a845ed8637f8fc7, type: 3}
icon: {fileID: 2800000, guid: 1ede19fb3ac23954580aaeebd0ab0255, type: 3}
tooltip:
sortingOrder: -999
compact:
m_Text:
m_Image: {fileID: 2800000, guid: 1553c43734bfa6345a845ed8637f8fc7, type: 3}
m_Image: {fileID: 2800000, guid: 1ede19fb3ac23954580aaeebd0ab0255, type: 3}
m_Tooltip:
normal:
m_Text: ' Default'
m_Image: {fileID: 2800000, guid: 1553c43734bfa6345a845ed8637f8fc7, type: 3}
m_Image: {fileID: 2800000, guid: 1ede19fb3ac23954580aaeebd0ab0255, type: 3}
m_Tooltip:
shader: {fileID: 0}
replacementTag:

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -0,0 +1,144 @@
fileFormatVersion: 2
guid: 1ede19fb3ac23954580aaeebd0ab0255
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -1,97 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1aa272ccd1306c545b68254a527f8025, type: 3}
m_Name: MipMaps
m_EditorClassIdentifier:
content:
icon: {fileID: 2800000, guid: e613356da75e6764ea82a89a5ce3c6bc, type: 3}
tooltip:
sortingOrder: 30
compact:
m_Text:
m_Image: {fileID: 2800000, guid: e613356da75e6764ea82a89a5ce3c6bc, type: 3}
m_Tooltip:
normal:
m_Text: ' MipMaps'
m_Image: {fileID: 2800000, guid: e613356da75e6764ea82a89a5ce3c6bc, type: 3}
m_Tooltip:
shader: {fileID: 4800000, guid: 19d63524eb012af4e8e086121f546128, type: 3}
replacementTag:
parameters:
- m_name: _Max
m_parameterType: 7
m_texture: {fileID: 0}
m_vector: {x: 0, y: 0, z: 0, w: 0}
m_vectorArray: []
m_color: {r: 0, g: 0, b: 0, a: 0}
m_colorArray:
- {r: 0, g: 0.4, b: 1, a: 1}
- {r: 0, g: 1, b: 1, a: 1}
- {r: 0, g: 1, b: 0.4, a: 1}
- {r: 0.2, g: 1, b: 0, a: 1}
- {r: 0.8, g: 1, b: 0, a: 1}
- {r: 1, g: 0.6, b: 0, a: 1}
m_float: 0
m_floatArray: []
m_int: 6
m_matrix:
e00: 0
e01: 0
e02: 0
e03: 0
e10: 0
e11: 0
e12: 0
e13: 0
e20: 0
e21: 0
e22: 0
e23: 0
e30: 0
e31: 0
e32: 0
e33: 0
m_matrixArray: []
- m_name: _MipMapColors
m_parameterType: 4
m_texture: {fileID: 0}
m_vector: {x: 0, y: 0, z: 0, w: 0}
m_vectorArray: []
m_color: {r: 0, g: 0, b: 0, a: 0}
m_colorArray:
- {r: 0, g: 0.4, b: 1, a: 1}
- {r: 0, g: 1, b: 1, a: 1}
- {r: 0, g: 1, b: 0.4, a: 1}
- {r: 0.2, g: 1, b: 0, a: 1}
- {r: 0.8, g: 1, b: 0, a: 1}
- {r: 1, g: 0.6, b: 0, a: 1}
m_float: 0
m_floatArray: []
m_int: 0
m_matrix:
e00: 0
e01: 0
e02: 0
e03: 0
e10: 0
e11: 0
e12: 0
e13: 0
e20: 0
e21: 0
e22: 0
e23: 0
e30: 0
e31: 0
e32: 0
e33: 0
m_matrixArray: []

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: ce4e894416ac8004fa4d80eddd059296
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -21,7 +21,7 @@ MonoBehaviour:
m_Image: {fileID: 2800000, guid: e613356da75e6764ea82a89a5ce3c6bc, type: 3}
m_Tooltip:
normal:
m_Text: ' TexelDensityChecker 1'
m_Text: ' TexelDensity32'
m_Image: {fileID: 2800000, guid: e613356da75e6764ea82a89a5ce3c6bc, type: 3}
m_Tooltip:
shader: {fileID: 4800000, guid: 83a3ee0da908c7542be7a089c047d28f, type: 3}
@ -29,7 +29,7 @@ MonoBehaviour:
parameters:
- m_name: _RS_Texture
m_parameterType: 0
m_texture: {fileID: 2800000, guid: 5c021ebf5a89dcf4cb5504809772f451, type: 2}
m_texture: {fileID: 2800000, guid: 05a258bf93e7ca749ae1cd66d39fb477, type: 2}
m_vector: {x: 0, y: 0, z: 0, w: 0}
m_vectorArray:
- {x: 0, y: 0, z: 0, w: 0}

View File

@ -10,18 +10,18 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1aa272ccd1306c545b68254a527f8025, type: 3}
m_Name: TexelDensity128
m_Name: TexelDensity32a
m_EditorClassIdentifier:
content:
icon: {fileID: 2800000, guid: e613356da75e6764ea82a89a5ce3c6bc, type: 3}
tooltip:
sortingOrder: 31
sortingOrder: 32
compact:
m_Text:
m_Image: {fileID: 2800000, guid: e613356da75e6764ea82a89a5ce3c6bc, type: 3}
m_Tooltip:
normal:
m_Text: ' TexelDensityChecker'
m_Text: ' TexelDensity32a'
m_Image: {fileID: 2800000, guid: e613356da75e6764ea82a89a5ce3c6bc, type: 3}
m_Tooltip:
shader: {fileID: 4800000, guid: 83a3ee0da908c7542be7a089c047d28f, type: 3}
@ -29,7 +29,7 @@ MonoBehaviour:
parameters:
- m_name: _RS_Texture
m_parameterType: 0
m_texture: {fileID: 2800000, guid: 05a258bf93e7ca749ae1cd66d39fb477, type: 2}
m_texture: {fileID: 2800000, guid: d3577f229be143744905ab6bbccd3a47, type: 2}
m_vector: {x: 0, y: 0, z: 0, w: 0}
m_vectorArray:
- {x: 0, y: 0, z: 0, w: 0}

View File

@ -12,7 +12,7 @@ namespace TAO.SceneDebugViewer.Editor
private GUIStyle optionsButtonStyle = null;
private Vector2 scrollPos;
[MenuItem("Window/Analysis/SceneDebugViewer")]
[MenuItem("Window/Analysis/SceneDebugViewer/SDV")]
static void Init()
{
Load();

View File

@ -1,75 +0,0 @@
// Ref: https://developer.nvidia.com/gpugems/gpugems2/part-iii-high-quality-rendering/chapter-28-mipmap-level-measurement
// https://github.com/jintiao/MipmapLevel/blob/master/Assets/MipmapColor.shader
Shader "Hidden/RS/MipMaps"
{
SubShader
{
Tags { "RenderType" = "Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "RSUtilsCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float2 uvmip : TEXCOORD1;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float4 _MainTex_TexelSize;
float4 _MipMapColors[15]; // max mipmaps = 1 + floor(log2(maxTexSize))
int _Max;
v2f vert(appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
int mips = RS_MipCount(_MainTex_TexelSize);
float2 mipuv = v.uv * (_MainTex_TexelSize.zw / mips);
o.uvmip = TRANSFORM_TEX(mipuv, _MainTex);
return o;
}
fixed4 frag(v2f i) : SV_Target
{
int mipLevels = 1 + floor(log2(max(_MainTex_TexelSize.z, _MainTex_TexelSize.w)));
// int m = RS_MipMap(i.uvmip, _MainTex_TexelSize);
int m = RS_M(i.uvmip, _MainTex_TexelSize);
// int m = RS_Mip(i.uvmip, _MainTex_TexelSize, mipLevels);
// m = clamp(m, 0, _Max);
// m = RS_Remap(m, 0, 15, 0, _Max);
fixed4 mip = _MipMapColors[m];
fixed4 col = tex2D(_MainTex, i.uv);
fixed4 res;
res.rgb = lerp(col.rgb, mip.rgb, mip.a);
res.a = col.a;
return res;
}
ENDCG
}
}
}

View File

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 19d63524eb012af4e8e086121f546128
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3,6 +3,7 @@
sampler2D _RS_Texture;
float4 _RS_Texture_ST;
float4 _RS_Texture_TexelSize;
float _RS_Sharpness;
fixed4 _RS_Color;
half _RS_Metallic;

View File

@ -40,9 +40,8 @@ Shader "Hidden/RS/TexelDensity"
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
int mips = RS_MipCount(_MainTex_TexelSize);
float2 mipuv = v.uv * (_MainTex_TexelSize.zw / mips);
o.uvmip = TRANSFORM_TEX(mipuv, _MainTex);
//int mip = RS_MipMap(o.uv, _RS_Texture_TexelSize);
o.uvmip = o.uv * _MainTex_TexelSize.zw / (_RS_Texture_TexelSize.zw / 4.0);
return o;
}

File diff suppressed because one or more lines are too long

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 5c021ebf5a89dcf4cb5504809772f451
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2800000
userData:
assetBundleName:
assetBundleVariant: