Skip to content

Instantly share code, notes, and snippets.

Avatar

Aras Pranckevičius aras-p

View GitHub Profile
@aras-p
aras-p / fbx_visibility_export.diff
Created February 8, 2023 10:10
Blender FBX Visibility export
View fbx_visibility_export.diff
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index c5cd93a7..f15b3a8a 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -1688,7 +1688,8 @@ def fbx_data_object_elements(root, ob_obj, scene_data):
animatable=True, animated=((ob_obj.key, "Lcl Rotation") in scene_data.animated))
elem_props_template_set(tmpl, props, "p_lcl_scaling", b"Lcl Scaling", scale,
animatable=True, animated=((ob_obj.key, "Lcl Scaling") in scene_data.animated))
- elem_props_template_set(tmpl, props, "p_visibility", b"Visibility", float(not ob_obj.hide))
+ elem_props_template_set(tmpl, props, "p_visibility", b"Visibility", float(not ob_obj.hide),
@aras-p
aras-p / dump.txt
Created December 15, 2022 10:46
Opening random Unity project in one minute, profiling dump
View dump.txt
Unity 2022.2.0f1 official release.
I get changes from version control, about a dozen files changed (1 commit), then I open Unity.
It takes about one minute to open the project. The project Assets is 23GB (143k files), it also references
some local packages which is 8GB (63k files). Large part of project assets folder is custom data not used
by Unity's import pipeline ("baked" files for game, under StreamingAssets folder, 13GB, 47k files).
63s: InitializeProject
62s: InitialRefreshV2
54s: RefreshInternalV2
30s: ImportOutOfDateAssets
@aras-p
aras-p / arrays.txt
Created December 13, 2022 10:33
UnityEngine C# API A..C array parameters
View arrays.txt
// just going through Data/Managed/UnityEngine.xml in Unity 2023.1.0a22, letters A to C,
// searching for "[]" finds these public APIs that take arrays as parameters. Then next to
// them I looked whether they have a List<> or NativeArray<> variants. Some do have List<>,
// very few have native array. Most of them would be good candidates to take a Span<T>,
// in some cases that might reduce the need for also having "an integer offset and number of items"
// arguments that some (minority) of them do.
//
// This is only A..C so far, or maybe like 10% of the UnityEngine.xml API. UnityEditor.xml probably
// has a ton of similar ones :)
@aras-p
aras-p / building_oiio.md
Last active November 12, 2022 23:54
Building OpenImageIO from source locally
View building_oiio.md

Windows

OIIO build instructions currently just say this for Windows:

Method 1 - from source I really need someone to write correct, modern docs about how to build from source on Windows.

So I decided to figure that out.

Easiest: get Blender first :)

@aras-p
aras-p / IntegerShader.shader
Created September 9, 2022 09:59
Unity integer texture formats test
View IntegerShader.shader
Shader "Unlit/IntegerShader"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Pass
{
@aras-p
aras-p / welcome.md
Created July 14, 2022 07:59
Welcome, ironSource! in human speak
View welcome.md

(original: https://blog.unity.com/news/welcome-ironsource)

Welcome, ironSource!

Unity announced today that it has entered into an agreement to merge with ironSource. Wait, a merge you ask? This is more like an acquisition, but we chose "merge" wording for either accounting reasons, or for better stonks optics reasons.

We continue to believe that the world is a better place with more creators in it. This is actually a great statement that almost no one disagrees with!

We do have a bunch of products, and with our recent acquisitions of Parsec, SyncSketch, Wētā Digital, and Ziva Dynamics, we hope to somehow smash them into a coherent whole, eventually.

@aras-p
aras-p / ExportDDS.cs
Created June 21, 2022 08:47
Unity DDS file exporter for compressed textures
View ExportDDS.cs
// Adds context menu to TextureImporter objects, saves .dds next to input texture.
// Tested with Unity 2021.3.4
using System;
using UnityEngine;
using UnityEditor;
using System.IO;
using Unity.Collections.LowLevel.Unsafe;
struct DDSHeader
@aras-p
aras-p / obj_exort_io.patch
Last active January 21, 2022 08:43
Blender 3.1 obj_export_io.hh output buffering
View obj_exort_io.patch
diff --git a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
index 92d478c20a1a2bd9beebda270848e369dfde3024..009b3eff8a836b5178d17f6675190160d1082d82 100644
--- a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
+++ b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
@@ -234,6 +234,42 @@ TEST(obj_exporter_writer, mtllib)
BLI_delete(out_file_path.c_str(), false, false);
}
+TEST(obj_exporter_writer, buffer_flushing)
+{
@aras-p
aras-p / results.md
Last active April 7, 2021 12:50
EquirectangularSeamCorrection results
View results.md

https://twitter.com/bgolus/status/1379670566961995776

Unity 2021.1.1 on Apple M1 MacMini, Mac standalone player build, capture frame in Xcode and see the timings it prints for the fragment shader of the main draw.

Uncompressed, Aniso on:

  • None: 338, 373 us
  • Tarini: 361, 582 us
  • Explicit LOD: 418, 423 us
@aras-p
aras-p / DebugNode.hlsl
Created January 3, 2020 10:37
"Print a value" custom function node code for Unity ShaderGraph
View DebugNode.hlsl
// Quick try at doing a "print value" node for Unity ShaderGraph.
// Tested on Unity 2019.2.17 with ShaderGraph 6.9.2.
//
// Use with CustomFunction node, with two inputs:
// - Vector1 Value, the value to display,
// - Vector2 UV, the UVs of area to display at.
// And one output:
// - Vector4 Color, the color.
// Function name is DoDebug.