Commit 708d3dee authored by BlackAngle233's avatar BlackAngle233
Browse files

update final design

parent 1444629e
fileFormatVersion: 2
guid: 2417dc227032f2f408819013986c2f68
timeCreated: 1575787610
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 7e6be90d564999745bcd53035209c31b
folderAsset: yes
timeCreated: 1567149903
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 00fa4517ccbd4d94b9cc9a55b8d35bad
folderAsset: yes
timeCreated: 1574911250
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: EasyAR
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: b9e171feb2446eb44b6086f224ecd184, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
fileFormatVersion: 2
guid: d39973b7d588cc845a69c591cb5ada15
timeCreated: 1575689902
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: easyar_watermark
m_Shader: {fileID: 4800000, guid: 26b1e453f325f1f42b9fbedec854196e, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _Logo:
m_Texture: {fileID: 2800000, guid: 754cd822041dc4d8898c631fd0a80b80, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _H: 0.2
- _W: 0.2
- _X: 0.1
- _Y: 0.2
m_Colors: []
fileFormatVersion: 2
guid: 69635646d48c2c3419395fd48bd8110b
timeCreated: 1567399532
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a4dca9cba2c5bfa40bb91e5b0833fea0
folderAsset: yes
timeCreated: 1574652292
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
//================================================================================================================================
//
// Copyright (c) 2015-2021 VisionStar Information Technology (Shanghai) Co., Ltd. All Rights Reserved.
// EasyAR is the registered trademark or trademark of VisionStar Information Technology (Shanghai) Co., Ltd in China
// and other countries for the augmented reality technology developed by VisionStar Information Technology (Shanghai) Co., Ltd.
//
//================================================================================================================================
using easyar;
using UnityEngine;
namespace VideoRecording
{
public class CameraRecorder : MonoBehaviour
{
private VideoRecorder videoRecorder;
private Material externalMaterial;
private RenderTexture rt;
public void OnRenderImage(RenderTexture source, RenderTexture destination)
{
Graphics.Blit(source, destination);
if (videoRecorder)
{
if (externalMaterial)
{
if (rt && (rt.width != source.width || rt.height != source.height))
{
Destroy(rt);
}
if (!rt)
{
rt = new RenderTexture(source.width, source.height, 0);
}
Graphics.Blit(source, rt, externalMaterial);
videoRecorder.RecordFrame(rt);
}
else
{
videoRecorder.RecordFrame(source);
}
}
}
public void Setup(VideoRecorder recorder, Material material)
{
videoRecorder = recorder;
externalMaterial = material;
}
public void Destroy()
{
if (rt)
{
Destroy(rt);
}
Destroy(this);
}
}
}
fileFormatVersion: 2
guid: ba751a5d7efe1674b81766ae7c27de34
timeCreated: 1577352766
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
//================================================================================================================================
//
// Copyright (c) 2015-2021 VisionStar Information Technology (Shanghai) Co., Ltd. All Rights Reserved.
// EasyAR is the registered trademark or trademark of VisionStar Information Technology (Shanghai) Co., Ltd in China
// and other countries for the augmented reality technology developed by VisionStar Information Technology (Shanghai) Co., Ltd.
//
//================================================================================================================================
using easyar;
using System;
using UnityEngine;
namespace VideoRecording
{
public class RecordingSample : MonoBehaviour
{
public bool RecordWatermark;
public Material WatermarkMaterial;
public GameObject Cube;
private VideoRecorder videoRecorder;
private string filePath;
private CameraRecorder cameraRecorder;
private GameObject cube;
private void Awake()
{
cube = Instantiate(Cube);
videoRecorder = FindObjectOfType<VideoRecorder>();
videoRecorder.FilePathType = WritablePathType.PersistentDataPath;
videoRecorder.StatusUpdate += (status, msg) =>
{
if (status == RecordStatus.OnStarted)
{
GUIPopup.EnqueueMessage("Recording start", 5);
}
if (status == RecordStatus.FailedToStart || status == RecordStatus.FileFailed || status == RecordStatus.LogError)
{
GUIPopup.EnqueueMessage("Recording Error: " + status + ", details: " + msg, 5);
}
Debug.Log("RecordStatus: " + status + ", details: " + msg);
};
}
private void OnDestroy()
{
if (cube)
{
Destroy(cube);
}
}
public void SampleStart()
{
if (!videoRecorder)
{
return;
}
if (!videoRecorder.IsReady)
{
return;
}
if (cube)
{
Destroy(cube);
}
cube = Instantiate(Cube);
filePath = "EasyAR_Recording_" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss") + ".mp4";
videoRecorder.FilePath = filePath;
videoRecorder.StartRecording();
cameraRecorder = Camera.main.gameObject.AddComponent<CameraRecorder>();
cameraRecorder.Setup(videoRecorder, WatermarkMaterial);
if (RecordWatermark)
{
cameraRecorder.Setup(videoRecorder, WatermarkMaterial);
}
else
{
cameraRecorder.Setup(videoRecorder, null);
}
}
public void SampleStop()
{
if (!videoRecorder)
{
return;
}
if (videoRecorder.StopRecording())
{
GUIPopup.EnqueueMessage("Recording finished, video saved to Unity Application.persistentDataPath" + Environment.NewLine +
"Filename: " + filePath + Environment.NewLine +
"PersistentDataPath: " + Application.persistentDataPath + Environment.NewLine +
"You can change sample code if you prefer to record videos into system album", 8);
AdjustVideoAndPlay();
}
else
{
GUIPopup.EnqueueMessage("Recording failed", 5);
}
if (cameraRecorder)
{
cameraRecorder.Destroy();
}
}
private void AdjustVideoAndPlay()
{
if (!cube)
{
return;
}
var player = cube.GetComponent<UnityEngine.Video.VideoPlayer>();
player.transform.localScale = new Vector3(1, (float)Screen.height / Screen.width, 1);
if (player.isPlaying)
{
player.Stop();
}
player.url = FileUtil.PathToUrl(Application.persistentDataPath + "/" + filePath);
player.Play();
// Unity bug: https://issuetracker.unity3d.com/issues/android-video-player-cannot-play-files-located-in-the-persistent-data-directory-on-android-10
// more info in this thread: https://forum.unity.com/threads/error-videoplayer-on-android.742451/
// We are not going to fix or workaround this bug here, the video playback is just a visual feedback for recording result but not a recording feature. You can still find your recorded videos in the directory.
#if UNITY_ANDROID && !UNITY_EDITOR
int sdkVersion = 0;
using (var buildVersion = new AndroidJavaClass("android.os.Build$VERSION"))
{
sdkVersion = buildVersion.GetStatic<int>("SDK_INT");
}
if (sdkVersion >= 29)
{
GUIPopup.EnqueueMessage("Video recorded may not play on cube due to Unity VideoPlayer bug on Android Q", 5);
}
#endif
}
}
}
fileFormatVersion: 2
guid: a0927e88222c09e49889f33c9c23c287
timeCreated: 1574652292
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: ef4f7003a08f0c940976c2d3da5632ae
folderAsset: yes
timeCreated: 1574673320
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
//================================================================================================================================
//
// Copyright (c) 2015-2021 VisionStar Information Technology (Shanghai) Co., Ltd. All Rights Reserved.
// EasyAR is the registered trademark or trademark of VisionStar Information Technology (Shanghai) Co., Ltd in China
// and other countries for the augmented reality technology developed by VisionStar Information Technology (Shanghai) Co., Ltd.
//
//================================================================================================================================
Shader "Sample/RecordingWatermark" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_Logo("Logo (RGBA)", 2D) = "white" {}
_X("X (0, 1)", Range(0, 1)) = 0.8
_Y("Y (0, 1)", Range(0, 1)) = 0.8
_W("W (0, 1)", Range(0.01, 1)) = 0.15
_H("H (0, 1)", Range(0.01, 1)) = 0.15
}
SubShader {
Pass {
Tags { "RenderType" = "Transparents" }
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 _MainTex_ST;
sampler2D _Logo;
float4 _Logo_ST;
float _X;
float _Y;
float _W;
float _H;
struct v2f {
float4 pos:SV_POSITION;
float4 uv : TEXCOORD0;
};
v2f vert (appdata_base v) {
v2f o;
o.pos = o.pos = UnityObjectToClipPos (v.vertex);
o.uv = v.texcoord;
return o;
}
fixed4 frag (v2f i) : COLOR0 {
float x = 0.0;
float y = 0.0;
if (_ScreenParams.y >= _ScreenParams.x)
{
x = i.uv.x - _X;
y = i.uv.y - _Y * (_ScreenParams.x / _ScreenParams.y);
x = x / _W;
y = y / (_H * _ScreenParams.x / _ScreenParams.y);
}
else
{
x = i.uv.x - _X * (_ScreenParams.y / _ScreenParams.x);
y = i.uv.y - _Y;
x = x / (_W * _ScreenParams.y / _ScreenParams.x);
y = y / _H ;
}
fixed4 color = 0.0;
if (x > 1 || x < 0 || y < 0 || y > 1)
{
color = tex2D(_MainTex, i.uv.xy);
}
else
{
color = tex2D(_Logo, float2(x, y));
if (color.a == 0.0)
{
color = tex2D(_MainTex, i.uv.xy);
}
}
return color;
}
ENDCG
}
}
}
fileFormatVersion: 2
guid: 26b1e453f325f1f42b9fbedec854196e
timeCreated: 1567414813
licenseType: Free
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: c5c390e64d0f4f8488ceaf5cbb43eb9f
folderAsset: yes
timeCreated: 1574911259
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: b9e171feb2446eb44b6086f224ecd184
timeCreated: 1575689615
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment