Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into support_animation
Browse files Browse the repository at this point in the history
  • Loading branch information
faidra committed May 22, 2023
2 parents 88bbb31 + 4c743e9 commit f3d42ec
Show file tree
Hide file tree
Showing 55 changed files with 2,523 additions and 278 deletions.
38 changes: 28 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
# This .gitignore file should be placed at the root of your Unity project directory
#
# https://raw.githubusercontent.com/github/gitignore/master/Unity.gitignore
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
#
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
[Ll]ogs/
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/

# Never ignore Asset meta data
![Aa]ssets/**/*.meta
# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/

# Recordings can get excessive in size
/[Rr]ecordings/

# Uncomment this line if you wish to ignore the asset store tools plugin
# [Aa]ssets/AssetStoreTools*
# /[Aa]ssets/AssetStoreTools*

# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*

# Visual Studio cache directory
.vs/
Expand Down Expand Up @@ -48,11 +57,20 @@ sysinfo.txt

# Builds
*.apk
*.aab
*.unitypackage
*.app

# Crashlytics generated file
crashlytics-build.properties

# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*

# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*

#
#
#
Expand Down
8 changes: 8 additions & 0 deletions Assets/StreamingAssets/SampleModels/EmissiveStrengthTest.meta

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

48 changes: 48 additions & 0 deletions Assets/StreamingAssets/SampleModels/EmissiveStrengthTest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Emissive Strength Test

## Screenshots

### Plain Rendering (Test Passes)

![plain screenshot](screenshot/screenshot_large_plain.jpg)

### Render with Optional Bloom Effect Enabled

![screenshot with bloom](screenshot/screenshot_large_bloom.jpg)

These screenshots were rendered in BabylonJS with the default IBL strength dialed
down to help the glow stand out. The second screenshot has an optional "Bloom" effect
applied using the BabylonJS Default Rendering Pipeline.

## Description

This model tests if the `KHR_materials_emissive_strength` extension is available in a
given implementation. If it is not, the cubes will all emit the same shade of
light blue. For implementations that support this extension, the cubes will be
progressively brighter to the right.

## Cube Colors

The basic emissive color of all the cubes is `[0.1, 0.5, 0.9]` in the glTF file, which
is expected to undergo the usual linear-to-sRGB transfer before being shown to the viewer.
The cube on the far left has no emissive strength extension (`1x`), and each subsequent
cube doubles the strength (`2x`, `4x`, `8x`, and `16x`).

With a simple output mapping, the cube on the far right may appear as
plain white, due to all of its color components being clamped to the 1.0 upper limit.
If "bloom" effects are enabled, some cubes may appear to glow. In a path-tracing
engine, all of these cubes may emit light, but the ones on the right should
emit substantially more light.

## Test Failure

If a given implementation does not support `KHR_materials_emissive_strength`, the
boxes will all appear to emit the same color. For example:

![test fail screenshot](screenshot/test_fail.jpg)

## License Information

Copyright 2022 Analytical Graphics, Inc.
CC-BY 4.0 https://creativecommons.org/licenses/by/4.0/
Model and textures by Ed Mackey.

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

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.

Binary file not shown.

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

43 changes: 43 additions & 0 deletions Assets/VGltfExamples/Common/Scripts/StreamReaderFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System.IO;
using UnityEngine;
# if !UNITY_EDITOR && UNITY_ANDROID
using System;
using UnityEngine.Networking;
# endif

namespace VGltfExamples.Common
{
public static class StreamReaderFactory
{
# if !UNITY_EDITOR && UNITY_ANDROID
public static Stream Create(string path)
{
var basePath = "jar:file://" + Application.dataPath + "!/assets/";
var url = basePath + path;
using (var req = UnityWebRequest.Get(url))
{
req.SendWebRequest();

while (!req.isDone && !req.isNetworkError && !req.isHttpError) { }
if (req.isNetworkError || req.isHttpError) {
throw new Exception($"Failed to load: url = {url}, error = {req.error}");
}

return new MemoryStream(req.downloadHandler.data);
}
}
# elif !UNITY_EDITOR && UNITY_IOS
public static Stream Create(string path)
{
var basePath = Path.Combine(Application.dataPath, "Raw");
return File.OpenRead(Path.Combine(basePath, path));
}
# else
public static Stream Create(string path)
{
var basePath = Path.Combine(Application.dataPath, "StreamingAssets");
return File.OpenRead(Path.Combine(basePath, path));
}
# endif
}
}
11 changes: 11 additions & 0 deletions Assets/VGltfExamples/Common/Scripts/StreamReaderFactory.cs.meta

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

5 changes: 4 additions & 1 deletion Assets/VGltfExamples/Common/Scripts/TimeSlicer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@

namespace VGltfExamples.Common
{
// TimeSlicer is a utility class to slice the loading process of glTF.
// If loading takes more than {limitMillisecPerFrame} ms to process on the main thread during {maxFrameCount} frames,
// interrupt the loading and wait for the next frame to avoid continuing to block the main thread.
public sealed class TimeSlicer : VGltf.Unity.ITimeSlicer
{
readonly int limitMillisecPerFrame = 16;
readonly int maxFrameCount = 120; // 120フレーム以内に読まれれば良い
readonly int maxFrameCount = 120;

readonly System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
int elapsedFrame = 0;
Expand Down
Loading

0 comments on commit f3d42ec

Please sign in to comment.