Skip to content

Instantly share code, notes, and snippets.

@rkandas
rkandas / decimator.py
Created November 27, 2021 16:00
Imports the given FBX model, Decimates the meshes and exports as FBX
import bpy
import os
import sys
'''
Imports the given FBX model, Decimates the meshes and exports as FBX
@input
<input_fbx_filepath>
@rkandas
rkandas / AssimpAndroidBuildCMakeList.patch
Created November 26, 2021 14:16
Assimp build patch for Android builds
diff --git a/port/AndroidJNI/CMakeLists.txt b/port/AndroidJNI/CMakeLists.txt
index 8c821c72a..6fb7489fe 100644
--- a/port/AndroidJNI/CMakeLists.txt
+++ b/port/AndroidJNI/CMakeLists.txt
@@ -13,4 +13,7 @@ add_library( # Defines the name of the library.
BundledAssetIOSystem.cpp
)
TARGET_LINK_LIBRARIES(android_jniiosystem android log)
-INSTALL(TARGETS android_jniiosystem EXPORT "${TARGETS_EXPORT_NAME}")
+INSTALL(TARGETS android_jniiosystem EXPORT "${TARGETS_EXPORT_NAME}"
using System;
using UnityEngine;
using UnityEngine.UI;
public class ExternalTextureRenderer : MonoBehaviour
{
[SerializeField] private RawImage image;
private Texture2D _imageTexture2D;
private IntPtr _nativeTexturePointer;
package com.thoughtworks.texturerendererandroidplugin;
import android.app.Activity;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.opengl.EGL14;
import android.opengl.EGLContext;
@rkandas
rkandas / DepthSensor.cs
Last active October 5, 2022 08:01
Unity Barracuda Depth sensing with fastdepth ONNX
using System.Linq;
using Unity.Barracuda;
using UnityEngine;
using UnityEngine.UI;
public class DepthSensor : MonoBehaviour
{
[SerializeField] private NNModel _monoDepthONNX;
[SerializeField] private RawImage _sourceImageView;
[SerializeField] private RawImage _destinationImageView;
using System.IO;
using TensorFlowLite;
using UnityEngine;
[RequireComponent(typeof(Camera))]
[ExecuteInEditMode]
public class StyleTransferPostProcessing : MonoBehaviour
{
[SerializeField, FilePopup("*.tflite")] string predictionFileName = "style_predict_quantized_256.tflite";
[SerializeField, FilePopup("*.tflite")] string transferFileName = "style_transfer_quantized_dynamic.tflite";
using System.Reflection;
using UnityEditor.ShaderGraph;
using UnityEngine;
[Title("Custom", "Image", "Sobel Edge Detection")]
public class SobelNode : CodeFunctionNode
{
public SobelNode()
{
name = "Sobel Edge Detection";
using UnityEngine;
using UnityEngine.UI;
public class WebCamPlayer : MonoBehaviour
{
[SerializeField] public RawImage rawimage;
private WebCamTexture webcamTexture;
void Start ()
{
using System.Reflection;
using UnityEditor.ShaderGraph;
using UnityEngine;
[Title("Custom", "Gray Scale Node")]
public class GrayScaleNode : CodeFunctionNode
{
public GrayScaleNode()
{
name = "Gray Scale";
using System.Reflection;
using UnityEngine;
using UnityEditor.ShaderGraph;
[Title("Custom", "Mirror Texture Node")]
public class MirrorTextureNode : CodeFunctionNode
{
public MirrorTextureNode()
{
name = "Mirror Texture";