Skip to content

Commit

Permalink
Added test-scene for GoPro lens distortion real-vs-simulated overlay …
Browse files Browse the repository at this point in the history
…comparison
  • Loading branch information
elimvb committed Aug 28, 2024
1 parent 0b4e824 commit 5093071
Show file tree
Hide file tree
Showing 42 changed files with 7,189 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using UnityEngine;

[ExecuteInEditMode]
public class CameraBlender : MonoBehaviour
{
public Camera camera1;
public Camera camera2;
public Camera blendedCamera;

public RenderTexture renderTexture1;
public RenderTexture renderTexture2;
public Material blendMaterial;

[Range(0, 100)]
public float blendAmount = 50;

void Start()
{
if (camera1 != null)
{
camera1.targetTexture = renderTexture1;
}
if (camera2 != null)
{
camera2.targetTexture = renderTexture2;
}

if (blendMaterial != null)
{
blendMaterial.SetTexture("_MainTex1", renderTexture1);
blendMaterial.SetTexture("_MainTex2", renderTexture2);
}
}

void Update()
{
if (blendMaterial != null)
{
blendMaterial.SetFloat("_BlendAmount", blendAmount / 100f);
}
}

void OnRenderImage(RenderTexture src, RenderTexture dest)
{
if (blendMaterial != null)
{
Graphics.Blit(null, dest, blendMaterial);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
%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: 8e6292b2c06870d4495f009f912b9600, type: 3}
m_Name: Checkerboard_Camera_Profile
m_EditorClassIdentifier:
settings:
- {fileID: 2042350943332231850}
--- !u!114 &2042350943332231850
MonoBehaviour:
m_ObjectHideFlags: 3
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: 9b77c5407dc277943b591ade9e6b18c5, type: 3}
m_Name: LensDistortion
m_EditorClassIdentifier:
active: 1
enabled:
overrideState: 1
value: 1
intensity:
overrideState: 1
value: 75
intensityX:
overrideState: 0
value: 1
intensityY:
overrideState: 0
value: 1
centerX:
overrideState: 0
value: 0
centerY:
overrideState: 0
value: 0
scale:
overrideState: 1
value: 1.25

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Shader "Custom/BlendShader"
{
Properties
{
_MainTex1 ("Texture 1", 2D) = "white" {}
_MainTex2 ("Texture 2", 2D) = "white" {}
_BlendAmount ("Blend Amount", Range(0, 1)) = 0.5
}
SubShader
{
Tags { "RenderType"="Opaque" }
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag

#include "UnityCG.cginc"

struct appdata_t
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};

struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};

sampler2D _MainTex1;
sampler2D _MainTex2;
float _BlendAmount;

v2f vert (appdata_t v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}

fixed4 frag (v2f i) : SV_Target
{
fixed4 col1 = tex2D(_MainTex1, i.uv);
fixed4 col2 = tex2D(_MainTex2, i.uv);
return lerp(col1, col2, _BlendAmount);
}
ENDCG
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: EliShader_Mat
m_Shader: {fileID: 4800000, guid: 9ed8b818cffaf48eea82d5509f40644f, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex1:
m_Texture: {fileID: 8400000, guid: d72bb822e6a3c406f87e189943bc7fba, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex2:
m_Texture: {fileID: 8400000, guid: 43629d0a2155c41109bfb8119b4a0fbe, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BlendAmount: 0.5
- _BlendFactor: 0.5
m_Colors: []
m_BuildTextureStacks: []

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: RenderTexture1
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 3
m_Width: 2704
m_Height: 2028
m_AntiAliasing: 1
m_MipCount: -1
m_DepthFormat: 2
m_ColorFormat: 8
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: RenderTexture2
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 3
m_Width: 2704
m_Height: 2028
m_AntiAliasing: 1
m_MipCount: -1
m_DepthFormat: 2
m_ColorFormat: 8
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5093071

Please sign in to comment.