profile
viewpoint

conradev/YikYakAPI 11

Python implementation of the private Yik Yak API

Jarred-Sumner/doorkeeper 1

Doorkeeper is an OAuth 2 provider for Rails.

Jarred-Sumner/3taps-Ruby-Client 0

A Ruby gem for accessing the 3taps API.

Jarred-Sumner/acacia 0

A spatial partitioning and tree library in Rust.

Jarred-Sumner/active_model_serializers 0

ActiveModel::Serializer implementation and Rails hooks

Jarred-Sumner/angular.js 0

HTML enhanced for web apps

Jarred-Sumner/audio-recorder-polyfill 0

MediaRecorder polyfill to record audio in Edge and Safari

Jarred-Sumner/awesome-chrome-devtools 0

Awesome tooling and resources in the Chrome DevTools & DevTools Protocol ecosystem

Jarred-Sumner/awesome-react 0

A collection of awesome things regarding React ecosystem

Jarred-Sumner/awesome-react-native 0

Awesome React Native components, news, tools, and learning material!

issue openedCadiboo/NoCubes

[extremely minor] Unnecessary addition in SurfaceNets

I was looking at your SurfaceNets implementation as an example implementation in use that works, and noticed you're adding 0 here: https://github.com/Cadiboo/NoCubes/blob/95c67559fc22169d1bccf0ba843b02932c9016f3/src/main/java/io/github/cadiboo/nocubes/mesh/SurfaceNets.java#L217-L219

I'm not super familiar with Java, but it's likely safe to remove that (assuming this isn't a way of doing type casting)

created time in 7 days

pull request commenttimetocode/nengi

Performance: Reduce memory allocations & GC pauses by preallocating arrays

I manually tested in my game that: ☑️ sending an entity works ☑️ sending a message woks ☑️ sending a message containing an array works ☑️ deleting an entity doesn't crash ☑️ sending commands work ☑️ sending an entity containing a string woks

I don't think Babel compiles forEach since browsers widely support it as of ~2015

I also added a few more places where it preallocates arrays

Jarred-Sumner

comment created time in a month

push eventJarred-Sumner/nengi

Jarred Sumner

commit sha 1f1350d2364398b758be603aaf2a52beea509c2b

typo

view details

push time in a month

push eventJarred-Sumner/nengi

Jarred Sumner

commit sha ca3ad6fa250662671fa7bb54a085ba79e278aa50

It seems to work without copying the array, but it causes more automated tests to failf so I'll be cautious

view details

push time in a month

push eventJarred-Sumner/nengi

Jarred Sumner

commit sha 3fa9b55fa9ec0b8266c91a92021da61db26905a0

fewer allocations for string

view details

Jarred Sumner

commit sha dc21c4319f3c1c91a29762a865a56b3329e40483

Reduce allocations in IdPool

view details

Jarred Sumner

commit sha da425fcd3c45126d6ee507a91ad01acc2d7c629a

Simpliy proxy (is this dangeous?)

view details

Jarred Sumner

commit sha ed589bc2559af843500299058aeebbf61c31f156

Reduce allocations in readMessage & readProp

view details

Jarred Sumner

commit sha 5cb3e1e665c47a454c88ade21355e30005a5d4b0

Peallcoate in chooseOptimization

view details

Jarred Sumner

commit sha 0bf80b45554acbbfa6be5c80deff13e7be69c037

Peallcoate & use Map instead of Object in Outbound

view details

push time in a month

starteddimforge/rapier.js

started time in a month

PR opened timetocode/nengi

Performance: Reduce memory allocations & GC pauses by preallocating arrays

This PR does three things.

Note: I haven't fully tested that this doesn't break anything, but I will update when I have. One of the tests is failing, but it seems to fail without any code changes.

Preallocate arrays when reading snapshots

When you know the length ahead of time, it's much faster to preallocate the array (new Array(length)) and then set the values of the array by index than to push onto an Array inside a loop.

Declare fewer anonymous functions in code that's called often

If you run Chrome's profiler on code which creates anonymous functions on every function call (array.forEach(() =>) and run it on code that uses loops instead, you'll often find that loops has lower memory usage & runs faster. I don't entirely understand why, but my guess is its easier for v8 to JIT since the code doesn't change (and there are fewer Function objects).

Ignore yarn.lock and prettier

I (and many others) use Prettier, but this project doesn't. I didn't want to submit a PR that was mostly style changes from running prettier, so I added the .prettierignore file to prevent that. Same for yarn.lock.

There are still some formatting changes, which was not deliberate – it happens when I save in VSCode. But I think most of them just remove trailing whitespace.

+84 -74

0 comment

19 changed files

pr created time in a month

push eventJarred-Sumner/nengi

Jarred Sumner

commit sha f5b16b662bf6f4cc3721f57f5a82364e5477ef58

Ignore prettier & yarn.lock to make it easier for contributors

view details

Jarred Sumner

commit sha 2f379d6b66b2c6831128508ee17e8e41c23a1eb8

Peallocate arrays when reading snapshots

view details

Jarred Sumner

commit sha 3f4d2ae092a328622ba592c37b830933fb2a5f88

Avoid creating anonymous funcftions to make life easier for V8

view details

Jarred Sumner

commit sha f7d8499fb30c0f8e7fd7b3acb8f386f99f4fe5cb

Avoid anonymous functions

view details

push time in a month

create barnchJarred-Sumner/nengi

branch : jarred/reduce-memory-allocations

created branch time in a month

fork Jarred-Sumner/Babylon.js

Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework.

http://www.babylonjs.com

fork in a month

startedBabylonJS/BabylonNative

started time in a month

issue openedevanw/kiwi

How to compile the schema at build-time

I'm not sure if this is helpful to anyone else, but I had some trouble with importing the binary schema file in a webpack build and I wanted to avoid adding a network request to fetch the data as an ArrayBuffer.

So I setup babel-plugin-preval to compile the schema at build-time. It looks like the code below.

import preval from "preval.macro";
import { Schema as SchemaInterface } from "./MapChunkKiwiTypes";

export default preval(`
// cache-busting comment
const { compileSchemaJS, decodeBinarySchema, ByteBuffer } = require("kiwi-schema");
const fs = require("fs");
const path = require("path");

const SCHEMA_FILE = fs.readFileSync(
  path.resolve(__dirname, "MapChunkKiwiTypes.kiwib")
);
const AST = decodeBinarySchema(new Uint8Array(SCHEMA_FILE));
let result = {ByteBuffer};

const JS_CODE = compileSchemaJS(AST).replace(/required field .*/igm, 'required field");');
new Function("exports", JS_CODE)(result);
module.exports = result;
`) as SchemaInterface;
  • I had to remove the required field error messages because there's a string escaping issue.
  • This probably is a bad idea if you have a very long schema, since it increases bundle size.
  • I haven't measured if this causes any performance issues (i.e. if JIT treats function created at runtime via strings differently), but it seems fine for my usage so far.
  • Is this better than checking a file in? I kind of like it better but it is more magical

created time in a month

issue closedvercel/next.js

Workers causing webpack infinite build loop

Bug report

Describe the bug

webpack or worker-loader is consistently going into an infinite build loop for me. I'm not sure why. I've spent a few hours investigating and so far, I think its related to workers because if I remove worker-loader, it builds successfully.

This happens on both Webpack v5 and Webpack v4, and Next.js canary, 9.5.2 , and 9.4.5.

There are no errors being shown, so its pretty difficult to debug :(

When running next dev with DEBUG=*, eventually the console prints this line until the next dev process OOMs: image

If I remove the custom babel.config.js, it doesn't show that line anymore, but it still OOMs.

It seems like babel is building a file repeatedly. The code doesn't do anything like trying to import itself, so I'm not really sure why/how this can happen.

I tried adding lots of logging to worker-loader and that seems to be where its getting stuck. I see it rebuilding the same worker file. There's also a React Refresh boundary in the code for the worker, which makes me wonder if this is possibly related to https://github.com/vercel/next.js/issues/12753.

Is anyone else seeing an issue like this?

To Reproduce

I'm honestly not sure how I'd reproduce this yet :(

closed time in a month

Jarred-Sumner

issue commentvercel/next.js

Workers causing webpack infinite build loop

I switched the web worker-related code away from using Next.js and into a separate webpack config. I didn't make other code changes, and it works now

Jarred-Sumner

comment created time in a month

issue openedvercel/next.js

Workers causing webpack infinite build loop

Bug report

Describe the bug

webpack or worker-loader is consistently going into an infinite build loop for me. I'm not sure why. I've spent a few hours investigating and so far, I think its related to workers because if I remove worker-loader, it builds successfully.

This happens on both Webpack v5 and Webpack v4, and Next.js canary, 9.5.2 , and 9.4.5.

There are no errors being shown, so its pretty difficult to debug :(

When running next dev with DEBUG=*, eventually the console prints this line until the next dev process OOMs: image

If I remove the custom babel.config.js, it doesn't show that line anymore, but it still OOMs.

It seems like babel is building a file repeatedly. The code doesn't do anything like trying to import itself, so I'm not really sure why/how this can happen.

I tried adding lots of logging to worker-loader and that seems to be where its getting stuck. I see it rebuilding the same worker file. There's also a React Refresh boundary in the code for the worker, which makes me wonder if this is possibly related to https://github.com/vercel/next.js/issues/12753.

Is anyone else seeing an issue like this?

To Reproduce

I'm honestly not sure how I'd reproduce this yet :(

created time in a month

issue closedthi-ng/umbrella

[ecs] Custom Float32Array subclass?

I'm trying to use the same position object between the game engine (Babylon.js) and ECS.

To do that, I have a custom subclass of Float32Array which implements some of the interface from the Vector3 type Babylon expects.

I thought it'd be as simple as:

TYPEDARRAY_CTORS[Type.F32] = Float32BackedVector3;

But, this doesn't do what I thought it would. It creates a new Function instead of a new Float32BackedVector3: image

If we dig into the object, we'll see that __proto__ is Float32BackedVector3, but prototype is Float32Array. Very strange. image

Do you have any ideas how to use a custom Float32Array subclass with ECS? This class has no properties of its own, its just a bunch of extra functions wrapping the content. I could have it wrap the underlying Float32Array, but then I'd have to create a wrapper everywhere instead of just receiving the subclassed object.

This is what Float32BackedVector3 looks like:

export class Float32BackedVector3 extends Float32Array implements Vector3 {
  get x() {
    return this[0];
  }

  get y() {
    return this[1];
  }

  get z() {
    return this[2];
  }

  set x(value: number) {
    this[0] = value;
  }

  set y(value: number) {
    this[1] = value;
  }

  set z(value: number) {
    this[2] = value;
  }

  toString(): string {
    return `${this.x}-${this.y}-${this.z}`;
  }
  getClassName(): string {
    return "Float32BackedVector3";
  }
  getHashCode() {
    let hash = this.x | 0;
    hash = (hash * 397) ^ (this.x | 0);
    hash = (hash * 397) ^ (this.z | 0);
    return hash;
  }

  asArray(): number[] {
    return this;
  }

  fromArray(array: Float32Array, index?: number) {
    v.set3(this, array);
    return this;
  }
  fromInt16Array(array: Int16Array, index?: number) {
    v.set3(this, array);
    return this;
  }

  toArray(array: Float32Array, index?: number) {
    v.set3(array, this);
    return this;
  }

  toQuaternion(): Quaternion {
    throw new Error("Method not implemented.");
  }
  addInPlace(otherVector: DeepImmutableObject<Vector3>): Float32BackedVector3 {}
  addInPlaceFromFloats(x: number, y: number, z: number): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  add(otherVector: DeepImmutableObject<Vector3>): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  addToRef(
    otherVector: DeepImmutableObject<Vector3>,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  subtractInPlace(
    otherVector: DeepImmutableObject<Vector3>
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  subtract(otherVector: DeepImmutableObject<Vector3>): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  subtractToRef(
    otherVector: DeepImmutableObject<Vector3>,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  subtractFromFloats(x: number, y: number, z: number): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  subtractFromFloatsToRef(
    x: number,
    y: number,
    z: number,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  negate(): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  negateInPlace(): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  negateToRef(result: Float32BackedVector3): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  scaleInPlace(scale: number): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  scale(scale: number): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  scaleToRef(
    scale: number,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  scaleAndAddToRef(
    scale: number,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  equals(otherVector: DeepImmutableObject<Vector3>): boolean {
    throw new Error("Method not implemented.");
  }
  equalsWithEpsilon(
    otherVector: DeepImmutableObject<Vector3>,
    epsilon?: number
  ): boolean {
    throw new Error("Method not implemented.");
  }
  equalsToFloats(x: number, y: number, z: number): boolean {
    throw new Error("Method not implemented.");
  }
  multiplyInPlace(
    otherVector: DeepImmutableObject<Vector3>
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  multiply(otherVector: DeepImmutableObject<Vector3>): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  multiplyToRef(
    otherVector: DeepImmutableObject<Vector3>,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  multiplyByFloats(x: number, y: number, z: number): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  divide(otherVector: DeepImmutableObject<Vector3>): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  divideToRef(
    otherVector: DeepImmutableObject<Vector3>,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  divideInPlace(otherVector: Float32BackedVector3): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  minimizeInPlace(other: DeepImmutableObject<Vector3>): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  maximizeInPlace(other: DeepImmutableObject<Vector3>): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  minimizeInPlaceFromFloats(
    x: number,
    y: number,
    z: number
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  maximizeInPlaceFromFloats(
    x: number,
    y: number,
    z: number
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  isNonUniformWithinEpsilon(epsilon: number): boolean {
    throw new Error("Method not implemented.");
  }
  get isNonUniform(): boolean {
    throw new Error("Method not implemented.");
  }
  floor(): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  fract(): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }

  lengthSquared(): number {
    throw new Error("Method not implemented.");
  }
  normalize(): Float32BackedVector3 {
    v.normalize(this, this, 1);
    return this;
  }
  reorderInPlace(order: string): this {
    throw new Error("Method not implemented.");
  }
  rotateByQuaternionToRef(
    quaternion: Quaternion,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  rotateByQuaternionAroundPointToRef(
    quaternion: Quaternion,
    point: Float32BackedVector3,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  cross(other: Float32BackedVector3): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  normalizeFromLength(len: number): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  normalizeToNew(): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  normalizeToRef(
    reference: DeepImmutableObject<Vector3>
  ): Float32BackedVector3 {
    v.normalize(reference, this, 1);
    return this;
  }
  clone(): Float32BackedVector3 {
    return new Float32BackedVector3(3);
  }
  copyFrom(source: DeepImmutableObject<Vector3>): Float32BackedVector3 {
    return this.setValues(source.x, source.y, source.z);
  }
  copyFromFloats(x: number, y: number, z: number): Float32BackedVector3 {
    return this.setValues(x, y, z);
  }
  setValues(x: number, y: number, z: number): Float32BackedVector3 {
    this[0] = x;
    this[1] = y;
    this[2] = z;
    return this;
  }

  setAll(v: number): Float32BackedVector3 {
    this[0] = this[1] = this[2] = v;
    return this;
  }
}

closed time in a month

Jarred-Sumner

issue commentthi-ng/umbrella

[ecs] Custom Float32Array subclass?

This was caused by something dumb I was doing. Overriding TYPEDARRAY_CTORS works.

Not your fault! Thank you for the library.

Jarred-Sumner

comment created time in a month

issue openedthi-ng/umbrella

[ecs] Custom Float32Array subclass?

I'm trying to use the same position object between the game engine (Babylon.js) and ECS.

To do that, I have a custom subclass of Float32Array which implements some of the interface from the Vector3 type Babylon expects.

I thought it'd be as simple as:

TYPEDARRAY_CTORS[Type.F32] = Float32BackedVector3;

But, this doesn't do what I thought it would. It creates a new Function instead of a new Float32BackedVector3: image

If we dig into the object, we'll see that __proto__ is Float32BackedVector3, but prototype is Float32Array. Very strange. image

Do you have any ideas how to use a custom Float32Array subclass with ECS? This class has no properties of its own, its just a bunch of extra functions wrapping the content. I could have it wrap the underlying Float32Array, but then I'd have to create a wrapper everywhere instead of just receiving the subclassed object.

This is what Float32BackedVector3 looks like:

export class Float32BackedVector3 extends Float32Array implements Vector3 {
  get x() {
    return this[0];
  }

  get y() {
    return this[1];
  }

  get z() {
    return this[2];
  }

  set x(value: number) {
    this[0] = value;
  }

  set y(value: number) {
    this[1] = value;
  }

  set z(value: number) {
    this[2] = value;
  }

  toString(): string {
    return `${this.x}-${this.y}-${this.z}`;
  }
  getClassName(): string {
    return "Float32BackedVector3";
  }
  getHashCode() {
    let hash = this.x | 0;
    hash = (hash * 397) ^ (this.x | 0);
    hash = (hash * 397) ^ (this.z | 0);
    return hash;
  }

  asArray(): number[] {
    return this;
  }

  fromArray(array: Float32Array, index?: number) {
    v.set3(this, array);
    return this;
  }
  fromInt16Array(array: Int16Array, index?: number) {
    v.set3(this, array);
    return this;
  }

  toArray(array: Float32Array, index?: number) {
    v.set3(array, this);
    return this;
  }

  toQuaternion(): Quaternion {
    throw new Error("Method not implemented.");
  }
  addInPlace(otherVector: DeepImmutableObject<Vector3>): Float32BackedVector3 {}
  addInPlaceFromFloats(x: number, y: number, z: number): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  add(otherVector: DeepImmutableObject<Vector3>): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  addToRef(
    otherVector: DeepImmutableObject<Vector3>,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  subtractInPlace(
    otherVector: DeepImmutableObject<Vector3>
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  subtract(otherVector: DeepImmutableObject<Vector3>): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  subtractToRef(
    otherVector: DeepImmutableObject<Vector3>,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  subtractFromFloats(x: number, y: number, z: number): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  subtractFromFloatsToRef(
    x: number,
    y: number,
    z: number,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  negate(): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  negateInPlace(): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  negateToRef(result: Float32BackedVector3): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  scaleInPlace(scale: number): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  scale(scale: number): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  scaleToRef(
    scale: number,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  scaleAndAddToRef(
    scale: number,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  equals(otherVector: DeepImmutableObject<Vector3>): boolean {
    throw new Error("Method not implemented.");
  }
  equalsWithEpsilon(
    otherVector: DeepImmutableObject<Vector3>,
    epsilon?: number
  ): boolean {
    throw new Error("Method not implemented.");
  }
  equalsToFloats(x: number, y: number, z: number): boolean {
    throw new Error("Method not implemented.");
  }
  multiplyInPlace(
    otherVector: DeepImmutableObject<Vector3>
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  multiply(otherVector: DeepImmutableObject<Vector3>): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  multiplyToRef(
    otherVector: DeepImmutableObject<Vector3>,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  multiplyByFloats(x: number, y: number, z: number): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  divide(otherVector: DeepImmutableObject<Vector3>): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  divideToRef(
    otherVector: DeepImmutableObject<Vector3>,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  divideInPlace(otherVector: Float32BackedVector3): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  minimizeInPlace(other: DeepImmutableObject<Vector3>): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  maximizeInPlace(other: DeepImmutableObject<Vector3>): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  minimizeInPlaceFromFloats(
    x: number,
    y: number,
    z: number
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  maximizeInPlaceFromFloats(
    x: number,
    y: number,
    z: number
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  isNonUniformWithinEpsilon(epsilon: number): boolean {
    throw new Error("Method not implemented.");
  }
  get isNonUniform(): boolean {
    throw new Error("Method not implemented.");
  }
  floor(): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  fract(): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }

  lengthSquared(): number {
    throw new Error("Method not implemented.");
  }
  normalize(): Float32BackedVector3 {
    v.normalize(this, this, 1);
    return this;
  }
  reorderInPlace(order: string): this {
    throw new Error("Method not implemented.");
  }
  rotateByQuaternionToRef(
    quaternion: Quaternion,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  rotateByQuaternionAroundPointToRef(
    quaternion: Quaternion,
    point: Float32BackedVector3,
    result: Float32BackedVector3
  ): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  cross(other: Float32BackedVector3): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  normalizeFromLength(len: number): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  normalizeToNew(): Float32BackedVector3 {
    throw new Error("Method not implemented.");
  }
  normalizeToRef(
    reference: DeepImmutableObject<Vector3>
  ): Float32BackedVector3 {
    v.normalize(reference, this, 1);
    return this;
  }
  clone(): Float32BackedVector3 {
    return new Float32BackedVector3(3);
  }
  copyFrom(source: DeepImmutableObject<Vector3>): Float32BackedVector3 {
    return this.setValues(source.x, source.y, source.z);
  }
  copyFromFloats(x: number, y: number, z: number): Float32BackedVector3 {
    return this.setValues(x, y, z);
  }
  setValues(x: number, y: number, z: number): Float32BackedVector3 {
    this[0] = x;
    this[1] = y;
    this[2] = z;
    return this;
  }

  setAll(v: number): Float32BackedVector3 {
    this[0] = this[1] = this[2] = v;
    return this;
  }
}

created time in a month

startedbevyengine/bevy

started time in 2 months

fork Jarred-Sumner/acacia

A spatial partitioning and tree library in Rust.

fork in 2 months

issue commentqntm/fastjson

README is missing benchmarks

+1

ylukem

comment created time in 2 months

issue openedevanw/kiwi

Performance optimization: set array length ahead of time (JavaScript)

For a schema like this:

struct UnsignedBlockVector {
  uint x;
  uint y;
  uint z;
  uint w;
}

struct BlockArray {
  UnsignedBlockVector shape;
  UnsignedBlockVector stride;
  uint offset;
  uint[] data;
}

decodeBlockArray gets compiled into:

function(bb) {
  var result = {};
  if (!(bb instanceof this.ByteBuffer)) {
    bb = new this.ByteBuffer(bb);
  }

  result["shape"] = this["decodeUnsignedBlockVector"](bb);
  result["stride"] = this["decodeUnsignedBlockVector"](bb);
  result["offset"] = bb.readVarUint();
  var length = bb.readVarUint();
  var values = result["data"] = [];
  while (length-- > 0) values.push(bb.readVarUint());
  return result;
}

Pushing in the loop can end up being many memory allocations, which can cause GC pauses

Instead, we could preallocate it, like this:

function(bb) {
  var result = {};
  if (!(bb instanceof this.ByteBuffer)) {
    bb = new this.ByteBuffer(bb);
  }

  result["shape"] = this["decodeUnsignedBlockVector"](bb);
  result["stride"] = this["decodeUnsignedBlockVector"](bb);
  result["offset"] = bb.readVarUint();
  var length = bb.readVarUint();
 var values = (result["data"] = new Array(length)); // <--- preallocating here
  for (let i = 0; i < length; i++) {
    values[i] = bb.readVarUint(); // <--- setting by index instead of pushing
  }
  return result;
}

Extremely unscientific benchmark

When I run this locally on a 52.3 MB file containing 1,024 BlockArray objects

Before:

❯ yarn print-brr worlds-store/352/-1.-1.brr                                                                                  23:28:07
yarn run v1.22.4
$ NODE_ENv=development node --max-old-space-size=12000 ./dev/lib/scripts/printBRR.js worlds-store/352/-1.-1.brr
LOAD TIME: 3.829s
✨  Done in 3.99s.

After:

❯ yarn print-brr worlds-store/352/-1.-1.brr                                                                                  23:27:41
yarn run v1.22.4
$ NODE_ENv=development node --max-old-space-size=12000 ./dev/lib/scripts/printBRR.js worlds-store/352/-1.-1.brr
LOAD TIME: 3.314s
✨  Done in 3.48s.

Not all of whats going on in LOAD TIME is Kiwi (which makes this very unscientific). But, this change seems to shave off about 14% of the time anyway.

created time in 2 months

startedevanw/kiwi

started time in 2 months

issue commentAgoraIO/Basic-Video-Broadcasting

Live Streaming not working from Chrom and Safari browse of Mac browser as Host and as Audience both

I got it working!

The problem was that I was using string-based user IDs. The error appeared when calling startLiveStreaming (after joined & published)

shubhra-ahead

comment created time in 2 months

issue commentAgoraIO-Community/AgoraWebSDK-NG

Some feedback

Thanks for the detailed response! Also, your English is really good.

But please be attention that If developers pass their own AudioContext to SDK, they have to write many iOS/Safari AudioContext workarounds by themself. Such as no sound in iOS silent mode, no sound in iOS 12 randomly.

Yeah, manually managing AudioContext is not fun (especially in Safari).

Chrome has a little-known API that tells you if creating an AudioContext will work before you actually create it:

if (
  navigator?.userActivation?.isActive ||
  navigator?.userActivation?.hasBeenActive
) {
  this.getAudioContext();
}

I don't see documentation for navigator.userActivation other than old blog posts though and it's Chrome only. But it might help reduce cases where an AudioContext is created prematurely in Chrome

My understanding is that our service now supports the CORS protocol, so there is no need to add the Cross-Origin-Resource-Policy header, right?

You're right – I misread the document, I thought it required both CORS & CORP rather than either CORS or CORP. I was also missing the Cross-Origin-Opener-Policy header.

BTW, have you seen RNNoise? Its better than native noise cancellation and fast enough to run in real-time on browsers. I integrated it into the game to cover up laptop fan noise in voice chat. I'd be a little wary of using it in browsers that don't support Audio Worklet or any older browsers, but it might be a cool feature to add sometime later since it would (theoretically) improve audio call quality & make the volume level stuff better at distinguishing between speech and ambient noise.


On an unrelated note, do you know how to get pushing a livestream to CDN to work? I'm trying to make it push a MediaStreamTrack from a Canvas element to an RTMP url and I get invalid_appid. I filed a support ticket about this: CUS-7128 and was able to reproduce the issue in both Agora Web SDK and Agora Web SDK NG.

Jarred-Sumner

comment created time in 2 months

issue openedAgoraIO-Community/AgoraWebSDK-NG

Some feedback

I'm using Agora inside a browser-based game for in-game voice chat. Overall, I really like Agora and Agora Web SDK NG is an easier API than Agora Web SDK – good job!

I have a few points of feedback that I hope is helpful to you.

Bundle size

The minified source is 547 KB, which is large for any library.

I think there are a number of opportunities to reduce bundle size. From looking at the code, you could release 2-3 bundles instead:

  • UMD build (matches what you currently have)
  • CommonJS build
  • ESM build

If you provided a CommonJS or ESM build and then used export & import in your source code to import files, this would make it more eligible for tree shaking. Additionally, for any libraries you use, you'd require them and add them as a dependency in your package.json, rather than inline them into the source.

Different companies use Agora differently – some might use the DOM-related functionality (showing a video stream, adding an <audio /> tag, etc) and some might not. Tree shaking would allow integrators to only import the parts of Agora's SDK that are relevant to their application. This should significantly reduce bundle size for most integrators.

Performance

Agora makes many requests, seemingly for analytics rather than VOIP. There is a meaningful performance cost to sending lots of requests, and browsers have connection limits for how many requests they send at a time per tab.

If the only thing happening on the page is VOIP, then its probably fine. But, if there's lots of other stuff too (e.g. rendering a 3D game), it can cause performance problems.

It would be great if integrators could disable analytics and voice quality-related data collection.

Additionally, allocating new objects or pushing onto arrays inside of setInterval (or any timer) is an easy way to trigger Garbage Collection and briefly freeze the webpage. If you reuse objects (where possible) inside of timers, it will improve performance.

CORP & COEP

Currently, this SDK does not work when using Cross-Origin-Resource-Policy & Cross-Origin-Embedder-Policy together. Requests to Agora's servers are blocked by the browser.

These headers enable SharedArrayBuffer in Firefox 79 and soon will be required by Chrome to use SharedArrayBuffer too.

These standards are pretty new, so it makes sense why this wouldn't be supported yet. I'm honestly not sure of a solution to this, unless it involves proxying.

Audio Context

Web browsers cannot create many AudioContext objects per page without stuff breaking. It would be great if the SDK allowed a developer to pass in their own AudioContext object, instead of creating one during initialization.

created time in 2 months

issue commentAgoraIO/Basic-Video-Broadcasting

Live Streaming not working from Chrom and Safari browse of Mac browser as Host and as Audience both

I haven't but I'll try it tomorrow.

The main differences between a canvas stream and a webcam stream is the variety of resolutions a canvas could be -- webcams have relatively standard resolutions, but a canvas could be any. H264 encoders are known to have issues with height/width that are not divisible by 8 (With iOS' video editing framework, if it's not divisible by 8 then you will sometimes get green bars on the edges of the video). I also vaguely remember something about canvas streams always being vp8 instead of h264, but that might not be true anymore (MediaRecorder supports h264 inside a webm container)

shubhra-ahead

comment created time in 2 months

issue commentAgoraIO/Basic-Video-Broadcasting

Live Streaming not working from Chrom and Safari browse of Mac browser as Host and as Audience both

I have a similar issue when using a Canvas stream. Support Ticket: CUS-7128

The error I'm getting is: {code: 400, reason: "invalid_appid", serverTs: 1595977190985, requestId: 1}

Here are the logs:

16:51:17:545 Agora-SDK [INFO]: browser compatibility {getDisplayMedia: true, getStreamFromExtension: true, supportUnifiedPlan: true, supportMinBitrate: true, supportMaxBitrateInEncodingParameters: true, …} {name: "Chrome", version: "84", os: "Mac OS X"}
16:51:17:569 Agora-SDK [INFO]: [835cf] Initializing AgoraRTC client v0.1.9, mode: live, codec: vp8
16:51:17:573 Agora-SDK [DEBUG]: [835cf] connection state change: DISCONNECTED -> CONNECTING
16:51:17:576 Agora-SDK [DEBUG]: Flush cached event reporting: 1
16:51:17:583 Agora-SDK [DEBUG]: [835cf] Connect to choose_server: https://webrtc2-ap-web-1.agora.io/api/v1
16:51:18:56 Agora-SDK [INFO]: [835cf] Joining channel: 315
16:51:18:57 Agora-SDK [DEBUG]: [835cf] setParameter in distribution: {}
16:51:18:60 Agora-SDK [DEBUG]: [gateway-835cf] start connect, url: wss://107-155-2-162.edge.agora.io:5888
16:51:18:208 Agora-SDK [DEBUG]: [gateway-835cf] websockect opened: wss://107-155-2-162.edge.agora.io:5888
16:51:18:363 Agora-SDK [DEBUG]: [835cf] finish join to gateway
16:51:18:363 Agora-SDK [DEBUG]: turn config {username: "test", password: "111111", turnServerURL: "107-155-2-162.edge.agora.io", tcpport: 5918, udpport: 5918, …}
16:51:18:364 Agora-SDK [DEBUG]: [835cf] connection state change: CONNECTING -> CONNECTED
16:51:18:367 Agora-SDK [DEBUG]: [835cf] Connected to gateway server
16:51:21:585 Agora-SDK [DEBUG]: start check mediaStreamTrack resolution CanvasCaptureMediaStreamTrack {canvas: canvas#noa-container.jsx-1576047751, kind: "video", id: "da4c4fbc-fd70-468a-8e84-de568f0456bb", label: "RNb1Yibyj0vTCwJDjhuLnfk2jbWhAf+j8s4oy1ydIpNGs2ocqkiwtDTD48nQE7aqhAEwL1X/3jBEO0Mv35+heQ==", enabled: true, …}
16:51:21:596 Agora-SDK [INFO]: [835cf] Publishing tracks, id 7949d531 ,9d408368 
16:51:21:741 Agora-SDK [DEBUG]: get track resolution:  547 x 926 CanvasCaptureMediaStreamTrack {canvas: canvas#noa-container.jsx-1576047751, kind: "video", id: "da4c4fbc-fd70-468a-8e84-de568f0456bb", label: "RNb1Yibyj0vTCwJDjhuLnfk2jbWhAf+j8s4oy1ydIpNGs2ocqkiwtDTD48nQE7aqhAEwL1X/3jBEO0Mv35+heQ==", enabled: true, …}
16:51:21:851 Agora-SDK [DEBUG]: [pc-1] ice-state: pub p2p checking
16:51:21:877 Agora-SDK [DEBUG]: [pc-1] connection-state: pub p2p connecting
16:51:21:885 Agora-SDK [DEBUG]: [pc-1] ice-state: pub p2p connected
16:51:21:886 Agora-SDK [DEBUG]: Flush cached event reporting: 2
16:51:21:894 Agora-SDK [DEBUG]: start live streaming rtmp://global-live.mux.com/app/[redacted], mode: mix_streaming
16:51:21:968 Agora-SDK [DEBUG]: [pc-1] connection-state: pub p2p connected
shubhra-ahead

comment created time in 2 months

PR opened BabylonJS/Documentation

Mention how to register manually created Octree in docs

When using a manually created Octree, I was experiencing a bug where only parts of the scene were visible and the rest would appear for a moment and then disappear.

I read through the forums for any reports of this, and I found this reply: https://forum.babylonjs.com/t/manually-created-octrees-no-longer-working-in-bjs-4-0/5412/10

Adding that code seemed to fix the issue.

Additionally: it would be nice if there was an Edit button in the docs pages. It could just link to the edit button on Github for the specific file.

+12 -0

0 comment

1 changed file

pr created time in 2 months

push eventJarred-Sumner/Documentation

Jarred Sumner

commit sha 8faf14e663020aecb6db068bb5052ed1f6ee7796

Mention how to activate octree

view details

push time in 2 months

issue commentandyhall/noa

Meshing in a worker

If you want the code I can make a PR but it's a lot of other changes too, it would be time-consuming for you to review it, and the code style doesn't match what you currently do (no semicolons, using ES6 classes, etc)

Jarred-Sumner

comment created time in 2 months

issue closedandyhall/noa

Meshing in a worker

I have meshing in a worker like 50% working

It technically works and feels quite fast...but, there's two really weird bugs that I don't really understand the cause of.

Video (worker meshing on): https://www.dropbox.com/s/t4pmgs1w7v50nnm/worker.1.mp4?dl=0 Video (worker meshing off): https://www.dropbox.com/s/ko3foqcmiftfa4k/Screen%20Recording%202020-07-24%20at%2011.35.15%20AM.mp4?dl=0

Bug 1: Some chunks are skipped? Specifically, the one the player starts at (something to do with _chunkIDsToMeshFirst maybe?) Bug 2: The positions of the chunks are all wrong.

Does anything come to mind why this might happen? I suspect the two bugs are related, but the positions being wrong makes no sense to me. The position is set on the main thread.

This is all using SharedArrayBuffer for the voxel / neighbor data

closed time in 2 months

Jarred-Sumner

issue commentandyhall/noa

Meshing in a worker

Fixed it. I forgot to pass the offset of the ndarray.

Jarred-Sumner

comment created time in 2 months

issue openedandyhall/noa

Meshing in a worker

I have meshing in a worker like 50% working

It technically works and feels quite fast...but, there's two really weird bugs that I don't really understand the cause of.

Video (worker meshing on): https://www.dropbox.com/s/t4pmgs1w7v50nnm/worker.1.mp4?dl=0 Video (worker meshing off): https://www.dropbox.com/s/ko3foqcmiftfa4k/Screen%20Recording%202020-07-24%20at%2011.35.15%20AM.mp4?dl=0

Bug #1: Some chunks are skipped? Specifically, the one the player starts at (something to do with _chunkIDsToMeshFirst maybe?) Bug #2: The positions of the chunks are all wrong.

Does anything come to mind why this might happen? I suspect the two bugs are related, but the positions being wrong makes no sense to me. The position is set on the main thread.

This is all using SharedArrayBuffer for the voxel / neighbor data

created time in 2 months

issue commentandyhall/noa

A question about custom meshes

GLBs/GLTFs in Babylon are loaded with a few wrapping meshes. Usually a Mesh -> TransformNode -> [real content here]

I suspect the issue you're seeing is that its only adding that first mesh to the scene.

csf30816

comment created time in 2 months

issue commentBabylonJS/Documentation

There are 89 broken links in the documentation site

Np

Also worth flagging that many of the links pointing to demos don't work:

For example, in https://doc.babylonjs.com/how_to/optimizing_your_scene_with_octrees#Demos: image

Jarred-Sumner

comment created time in 2 months

starteddonmccurdy/glTF-Transform

started time in 2 months

create barnchJarred-Sumner/babylon-serializer-repro

branch : master

created branch time in 2 months

created repositoryJarred-Sumner/babylon-serializer-repro

created time in 2 months

issue commentfacebookincubator/FBX2glTF

Can't handle texture for TransparencyFactor; discarding.

If you want another example, the eyelash material in this character asset has a TransparencyFactor: https://assetstore.unity.com/packages/3d/characters/o3n-uma-race-stunner-jane-175172

This is what the eyelash renders like: (in Babylon.js) image

Warning you that it shows NSFW content if you convert the .fbx file to .gltf

southkorea2013

comment created time in 2 months

issue commentandyhall/noa

How to do LODs?

I think you're right – it would make meshing slower, and that's worse than the need for LODs. The bigger perf problem for me right now is (which is not related to noa) is rendering lots of small 3D models is slow, so I'm not working on LODs right now

I was considering rewriting the meshing stuff in Rust using WASM, based on this: https://github.com/Technici4n/voxel-rs/blob/master/client/src/render/world/meshing.rs#L67

But only slightly considering it. Theoretically, could use WASM threads and then with SharedArrayBuffer, could run meshing in a separate thread entirely. And probably would be faster in Rust than JavaScript, however it might not be (If you try https://wasmboy.app/benchmark/, their AssemblyScript WASM code isn't consistently faster than the JavaScript code). WASM threads & SharedArrayBuffer are also only supported in Chrome, which is problematic unless you had a single separate & dedicated meshing worker. Might not be a big deal to copy over one of the UInt16Array's often

Jarred-Sumner

comment created time in 2 months

pull request commentmakehumancommunity/community-plugins-socket

Fix for latest MakeHuman build

I'm not sure either. I don't know Python really. I think I just ran the command to install pyqt before installing makehuman

Jarred-Sumner

comment created time in 2 months

PR opened makehumancommunity/community-plugins-socket

Fix for latest MakeHuman build

The Socket tab wasn't showing up, so I was unable to use this with Blender.

I looked at the logs and saw that it said some method didn't exist, so I grepped for methods that sounded like it and found the right ones.

Now it works. Proof: image

+10 -10

0 comment

1 changed file

pr created time in 2 months

push eventJarred-Sumner/community-plugins-socket

Jarred Sumner

commit sha 8ae17123ced32dc1d376c44e3061eee9b336f905

Fix for latest MakeHuman build

view details

push time in 2 months

PR opened zeux/meshoptimizer

Add gltfpack installation instructions to main readme

I wanted to update to the latest version of gltfpack but it took me a minute to remember that gltfpack is in the gltf folder and to figure out the correct options to compile it with CMake.

Then I read through recent issues and saw you posted a link to the the Actions page which contains binaries in the build artifacts

Probably a good number of people come to this repo to install gltfpack itself, so I figured it'd be helpful to mention on the main readme

+13 -0

0 comment

1 changed file

pr created time in 2 months

push eventJarred-Sumner/meshoptimizer

Jarred Sumner

commit sha be0bc2c9fb9454f3572c03ecc8ee352dbd332a4d

Add gltfpack installation instructions to main readme

view details

push time in 2 months

fork Jarred-Sumner/meshoptimizer

Mesh optimization library that makes meshes smaller and faster to render

fork in 2 months

issue openedBabylonJS/Documentation

There are 89 broken links in the documentation site

You all put so much effort into writing very helpful documentation but when the links are 404'ing, it makes it harder to find them :(

Rather than complain report them one-off, I ran a script to crawl doc.babylonjs.com for broken links:

blc https://doc.babylonjs.com/ -ro -e github -e .jpg -e .png -c 10 > broken-links-babylon.txt
grep -E '├─BROKEN─' broken-links-babylon.txt | sort | uniq

Here's the output after I cleaned it up a little:

https://doc.babylonjs.com/How_To/Animations#animation-blending
https://doc.babylonjs.com/How_To/Environment
https://doc.babylonjs.com/How_To/Normals
https://doc.babylonjs.com/How_To/Reflec#refractiont
https://doc.babylonjs.com/How_To/ShaderIntro
https://doc.babylonjs.com/How_To/Solid_Particle_System
https://doc.babylonjs.com/How_To/Using_the_Canvas2D
https://doc.babylonjs.com/How_To/environment#automatic-creation
https://doc.babylonjs.com/How_To/setup_visualStudio
https://doc.babylonjs.com/How_To/shadows
https://doc.babylonjs.com/advanced/Shader_Material.html
https://doc.babylonjs.com/api/classes/babylon.sceneloaderprogressevent
https://doc.babylonjs.com/api/classes/babylon.webxrcontroller
https://doc.babylonjs.com/babylon101/Environmentt#changing-the-background-color-sceneclearcolor
https://doc.babylonjs.com/babylon101/cascadedShadows
https://doc.babylonjs.com/extensions/Using_The_Canvas2D
https://doc.babylonjs.com/extensions/oceanpostprocess
https://doc.babylonjs.com/features/(/How_To/CreateBox_Per_Face_Textures_And_Colors
https://doc.babylonjs.com/features/Observables
https://doc.babylonjs.com/features/Using_The_Physics_Engine
https://doc.babylonjs.com/features/customize_debug_layer
https://doc.babylonjs.com/features/observables#multiobserver
https://doc.babylonjs.com/features/physically_based_rendering
https://doc.babylonjs.com/features/webvr_camera
https://doc.babylonjs.com/generals/File_Format_Map_(.babylon
https://doc.babylonjs.com/generals/Framework_versions
https://doc.babylonjs.com/how_To/Particles/Animate.md
https://doc.babylonjs.com/how_to/%22http:/localhost:1338/Playground/index-local.html%22
https://doc.babylonjs.com/how_to/%22http:/localhost:1338/inspector/index.html%22
https://doc.babylonjs.com/how_to/%22http:/localhost:1338/localDev/index.html%22
https://doc.babylonjs.com/how_to/%22http:/localhost:1338/materialsLibrary/index.html%22
https://doc.babylonjs.com/how_to/%22http:/localhost:1338/postProcessLibrary/index.html%22
https://doc.babylonjs.com/how_to/%22http:/localhost:1338/proceduralTexturesLibrary/index.html%22
https://doc.babylonjs.com/how_to/%22http:/localhost:1338/sandbox/index-local.html%22
https://doc.babylonjs.com/how_to/%22http:/localhost:1338/tests/validation/index.html%22
https://doc.babylonjs.com/how_to/WebXR_Controller_Support
https://doc.babylonjs.com/how_to/debug_layerEnable
https://doc.babylonjs.com/how_to/how%20to%20start%20contributing
https://doc.babylonjs.com/how_to/scene/Optimizing_your_scene#turning-adapttodeviceratio-offon
https://doc.babylonjs.com/how_to/several%20includes%20in%20Babylon
https://doc.babylonjs.com/how_to/solid_particle_system
https://doc.babylonjs.com/how_to/webxr
https://doc.babylonjs.com/img/extensions/dynamicTexture.jpg
https://doc.babylonjs.com/page.php?p=22081
https://doc.babylonjs.com/page.php?p=22531
https://doc.babylonjs.com/page.php?p=22581
https://doc.babylonjs.com/page.php?p=22591
https://doc.babylonjs.com/page.php?p=22601
https://doc.babylonjs.com/page.php?p=22611
https://doc.babylonjs.com/page.php?p=24822
https://doc.babylonjs.com/page.php?p=24824
https://doc.babylonjs.com/page.php?p=24825
https://doc.babylonjs.com/page.php?p=24827
https://doc.babylonjs.com/page.php?p=24828
https://doc.babylonjs.com/page.php?p=24829
https://doc.babylonjs.com/page.php?p=24830
https://doc.babylonjs.com/page.php?p=24831
https://doc.babylonjs.com/page.php?p=24832
https://doc.babylonjs.com/page.php?p=24833
https://doc.babylonjs.com/page.php?p=24834
https://doc.babylonjs.com/page.php?p=24837
https://doc.babylonjs.com/page.php?p=24840
https://doc.babylonjs.com/page.php?p=24841
https://doc.babylonjs.com/page.php?p=24847
https://doc.babylonjs.com/page.php?p=25088
https://doc.babylonjs.com/page.php?p=25090
https://doc.babylonjs.com/page.php?p=25091
https://doc.babylonjs.com/page.php?p=25094
https://doc.babylonjs.com/page.php?p=25096
https://doc.babylonjs.com/page.php?p=25109
https://doc.babylonjs.com/resources/Creating_Cinematic
https://doc.babylonjs.com/resources/Creating_Materials
https://doc.babylonjs.com/resources/Creating_Particle_Systems
https://doc.babylonjs.com/resources/File_Format_Map_(.babylon
https://doc.babylonjs.com/resources/Installing__the_Babylon_Exporter
https://doc.babylonjs.com/resources/Managin_Lens_Flare_Systems
https://doc.babylonjs.com/resources/Managing_Animations
https://doc.babylonjs.com/resources/Managing_Materials
https://doc.babylonjs.com/resources/PBT_Writing
https://doc.babylonjs.com/resources/PBT_previous_and_next
https://doc.babylonjs.com/resources/PBT_slider
https://doc.babylonjs.com/resources/Unity
https://doc.babylonjs.com/resources/Using_Actions_Builder
https://doc.babylonjs.com/resources/Using_Materials_Builder
https://doc.babylonjs.com/resources/Using_Post_Processes_Builder
https://doc.babylonjs.com/resources/[![image](https:/user-images.githubusercontent.com/954596/59141279-63c8f400-896f-11e9-9f2a-177b451f069f.png
https://doc.babylonjs.com/resources/hiding_editor_lines
https://doc.babylonjs.com/resources/how_to/how_to_use_gamepads
https://doc.babylonjs.com/resources/samples/OpenUrl

created time in 2 months

issue commentandyhall/noa

Consider using SoildParticleSystem for terrain chunks

I put noa in a directory of the codebase for the game itself and made some other modifications to it (removing most usages of anonymous functions which the profiler showed it reduced memory usage. Also I got meshing to work in a worker but it wasn't faster because remeshing happens often). I'd honestly be fine with sharing repo access or sending you a link to try it. The game itself is not open source though.

Jarred-Sumner

comment created time in 2 months

issue commentandyhall/noa

Consider using SoildParticleSystem for terrain chunks

TLDR: This is complicated and maybe impractical to generally support

Truthfully, there've been rendering artifacts from day one for me (https://github.com/andyhall/noa/issues/108)

I wrote a custom shader just now, mostly copy pasted from SimpleMaterial. I didn't think it was necessary to do that when I first opened this issue

That blog post was written before WebGL2 – WebGL2's sampler2DArray gives you array textures so you can avoid needing most of the tricks the author wrote about. In Babylon.js, this is a RawTexture2DArray

The downside is...WebGL 2 is not supported on Safari.

The code for initializing the texture looks like this:

const atlasTexture = new RawTexture2DArray(
      await createImageBitmap(img),
      TILE_WIDTH,
      IMAGE_HEIGHT,
      TILE_COUNT,
      Engine.TEXTUREFORMAT_RGBA,
      scene,
      false,
      true,
      Texture.NEAREST_SAMPLINGMODE
    );

To make the image work, instead of being a square, its just a really tall image. One column

Most of the only differences really between the default SimpleMaterial and mine is:

Fragment Shader:

-uniform sampler2D diffuseSampler;
+uniform sampler2DArray diffuseSampler;

+varying float vTile;
-baseColor = texture2D(diffuseSampler, vDiffuseUV);
+baseColor.rgb = texture(diffuseSampler, vec3(vDiffuseUV, vTile)).rgb;

Vertex Shader:

+attribute float tile;
+varying float vTile;
+vTile = tile;

Then, when building the mesh, you pass it a FloatArray of the block IDs that is 4 per tile duplicated (so one dirt block is 1,1,1,1):

newMesh.setVerticesData("tile", submesh.tiles, false, 1);

This is what it looks like. There's a blue-ish hue but there's some environment color I need to pass through it that I'm missing demo 1

I still need to do the complicated things he describes in the article to support Safari though...

Jarred-Sumner

comment created time in 2 months

issue openedandyhall/noa

How to do LODs?

Do you have any sense for how hard it'd be to build this?

https://0fps.net/2018/03/03/a-level-of-detail-method-for-blocky-voxels/

I natively tried just running mesh.simplify but it seems to do nothing. Maybe I didn't configure the settings correctly though.

I might take a stab at it. I really want the game to work well on computers with without dedicated graphics cards and I suspect this is one of the things preventing that. But I'm really bad at algorithms & math stuff so I'm worried about how long it'd take me to build this.

There is a pop-buffers npm package and a couple ThreeJS demos of using them

The code he shows in the page looks simple enough, but I'm not really sure how to wire it up from the cells thing he describes to the way Babylon.js does it. cells seems related to simplicial-complex

My guess is:

  • Write a wrapper class for Mesh that accepts a PopBuffer and level for the VertexData and based on the level, it changes the offsets for what it passes through to VertexData.
  • In a ticker, it would loop through all the chunks and update the LODs based on the distance? I don't like adding another loop like that though in JavaScript. Maybe its better to do that in a vertex fragment and choose the level of detail based on distance. This would be fewer updates to send to the GPU but more GPU code to run. Probably a good tradeoff since JavaScript is so single threaded
  • Then, in terrainMesher, instead of new Mesh() it would be new TerrainMesh(submeshes, 5) or something.

created time in 3 months

issue commentandyhall/noa

Consider using SoildParticleSystem for terrain chunks

At a glance, presumably it looks like each chunk of terrain (which should be one mesh with a multimaterial and N submeshes) is taking N draw calls in noa and 1 call after SPS. I'm looking around the SPS source for a reason but nothing is jumping out so far..

Okay I think I understand now why this happens.

Two reasons:

  1. I recently added a texture atlas. I was reading this article and this passage stood out to me:

One naive solution might be to create a separate texture for each block type, and then do a separate pass for each of these textures. However, this would require a number of state changes proportional to O(number of chunks * number of textures). In a world with hundreds of textures and thousands of chunks, this would be utterly unacceptable from a performance standpoint. Instead, a better solution is to use a technique called texture atlases.

The texture atlas allows me to use a single material and texture for all terrain blocks. I just change the UV offsets appropriately for each block. This won't work if you have thousands of textures (rather than hundreds), but in that case, you can have multiple texture atlases and there still should be significant performance gains.

  1. This paragraph from the docs on Solid Particle System:

In order to have only one draw call to the GPU, these three systems use only one material/texture for all their particles.

So basically, a regular Mesh with several SubMesh seems to result in mulitple draw calls, even with a shared material/texture. Whereas a SolidParticleSystem will be O(unique material) draw calls?

What's not clear to me is why Mesh doesn't work like SolidParticleSystem this way

Jarred-Sumner

comment created time in 3 months

issue openedandyhall/noa

Consider using SoildParticleSystem for terrain chunks

SolidParticleSystem for large scenes seems to reduce GPU frame time & draw calls considerably.

I changed some of terrainMesher to use a SolidParticleSystem when there are multiple materials:

     const sps = new SolidParticleSystem("sps", scene, {
        updatable: false,
        isPickable: true,
        useModelMaterial: true,
        particleIntersection: true,
        enableMultiMaterial: mesh.material instanceof MultiMaterial,
      });

      sps.addShape(mesh, 1);
      mesh.dispose();

      return sps.buildMesh();
Before After
<img width=300 src="https://user-images.githubusercontent.com/709451/87242735-2f323200-c3e4-11ea-898c-b0d1e7379b1f.png" /> <img width=300 src="https://user-images.githubusercontent.com/709451/87242691-d6629980-c3e3-11ea-8a24-998ee1f5b7a8.png" align="top" />

created time in 3 months

push eventJarred-Sumner/Jarred-Sumner

Jarred Sumner

commit sha df062a5ba20188e4dad56f41661c33602e296f6c

Update README.md

view details

push time in 3 months

create barnchJarred-Sumner/jarred-sumner

branch : master

created branch time in 3 months

created repositoryJarred-Sumner/jarred-sumner

created time in 3 months

issue openedJustusThies/NeuralTexGen

Example output?

Do you have any screenshots of what the results look like?

created time in 3 months

issue commentfacebook/react

mouseEvent doesn't have offsetX/offsetY

As of 2020, this doesn't seem to need a polyfill. But SyntheticEvent's MouseEvent doesn't have offsetX or offsetY

I can submit a PR if you want

https://caniuse.com/#feat=mdn-api_mouseevent_offsetx

image

evgenyrodionov

comment created time in 3 months

startedHazyResearch/epoxy

started time in 3 months

issue closedtapio/obj-magic

Thanks for making this.

I spent like two hours googling for a CLI tool that lets me transform meshes without having to deal with figuring out how to do it in blender

This is the best one

If anyone else wants to use this with glb or gltf files, I use obj2gltf to convert it to the gltf file:

  • obj2gltf --checkTransparency -b -i filename.obj

You can get obj2gltf here: https://github.com/CesiumGS/obj2gltf

I use obj2gltf instead of the others because sometimes the image path is hardcoded into the .obj file and obj2gltf is smart enough to look for it in the local dir if absolute is unavailable

closed time in 3 months

Jarred-Sumner
more