wasabia / three_dart

three.js rewrite by Dart, Dart 3D library. an easy to use, lightweight, cross-platform, general purpose 3D library.
MIT License
450 stars 80 forks source link

all screens except geometry shapes are black + loading gltf have shader error #71

Closed ghost closed 1 year ago

ghost commented 2 years ago

all screens of loading objects,gltf,text,maps are black and on console I see alot of work and frames count

wasabia commented 2 years ago

Hi @magacayga123 flutter 3 on web? upgrade flutter_gl 0.0.20 maybe fixed

JohnnyRainbow81 commented 2 years ago

Hey wasabia, thank you for your great work!

Unfortunately same issue for me, the gltf loader doesn't work, neither for your example app nor for my own experiments. I use flutter 3.3.3

In your example when this line gets called var _hdrTexture = await _loader.loadAsync('royal_esplanade_1k.hdr');

then in function RGBELoader.parse()

in this line var chunk = String.fromCharCodes(buffer.sublist(p, p + chunkSize));

an Exception is thrown:

Exception has occurred. "Error: RangeError (end): Invalid value: Only valid value is 0: 128 dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49 throw_ dart-sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart 1816:5 _checkValidRange dart-sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart 1062:16 sublist] packages/three_dart_jsm/three_dart_jsm/loaders/RGBELoader.dart 70:46 <fn> packages/three_dart_jsm/three_dart_jsm/loaders/RGBELoader.dart 133:23 <fn> packages/three_dart_jsm/three_dart_jsm/loaders/RGBELoader.dart 336:43 parse packages/three_dart/three3d/loaders/DataTextureLoader.dart 22:26 <fn> dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 352:37 _checkAndCall dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 357:39 dcall packages/three_dart/three3d/loaders/FileLoader.dart 199:67 load dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 46:50 <fn> dart-sdk/lib/async/zone.dart 1660:54 runUnary dart-sdk/lib/async/future_impl.dart 147:18 handleValue dart-sdk/lib/async/future_impl.dart 767:44 handleValueCallback dart-sdk/lib/async/future_impl.dart 796:13 _propagateToListeners dart-sdk/lib/async/future_impl.dart 567:5 [_completeWithValue] dart-sdk/lib/async/future_impl.dart 640:7 callback dart-sdk/lib/async/schedule_microtask.dart 40:11 _microtaskLoop dart-sdk/lib/async/schedule_microtask.dart 49:5 _startMicrotaskLoop dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 167:15 <fn> "

wasabia commented 1 year ago

@JohnnyRainbow81 Hi! which example did not work?

JohnnyRainbow81 commented 1 year ago

This errorneous code is from the

web_loader_gltf.dart

example, but none of the examples works where 3D model data is loaded. I only picked this example because I was experimenting with the code.

JohnnyRainbow81 commented 1 year ago

In general your compiled example app behind this link

https://wasabia.github.io/three_dart_example/#/

only works on my Mac book and on my Windows pc. But only those examples work where no 3d model data is loaded.

On my iPhone 8 or my iPad Pro Generation 1 unfortunately none of the example works.

wasabia commented 1 year ago

seems RGBELoader has bug.

wasabia commented 1 year ago

@JohnnyRainbow81 Hi! I can not reproduce this error, but when i run webgl_loader_gltf.dart example, found another bug,

you can remove this line. then the example worked as expect on my iPhone device

   //  _hdrTexture.mapping = THREE.EquirectangularReflectionMapping;
Execution of the command buffer was aborted due to an error during execution. Ignored (for causing prior/excessive GPU errors) (00000004:kIOGPUCommandBufferCallbackErrorSubmissionsIgnored)
GLDRendererMetal command buffer completion error: Error Domain=MTLCommandBufferErrorDomain Code=4 "Ignored (for causing prior/excessive GPU errors) (00000004:kIOGPUCommandBufferCallbackErrorSubmissionsIgnored)" UserInfo={NSLocalizedDescription=Ignored (for causing prior/excessive GPU errors) (00000004:kIOGPUCommandBufferCallbackErrorSubmissionsIgnored)}
JohnnyRainbow81 commented 1 year ago

Hi!

I tested all examples on my MacOs and compiled them to Chrome.

These examples do not work in Chrome:

webgl_loader_gltf
(but seems to work when you kill this line as you said, but then a material quality is missing I guess ) // _hdrTexture.mapping = THREE.EquirectangularReflectionMapping;

webgl_loader_obj_mtl (black screen. In VSCode I get a code execution stop (but no Exception) at function Future<List<int>> getEgl_interface(int textureId) // in flutter_gl_web.dart

webgl_animation_keyframes (black screen. In VSCode I also get a code execution stop (but no Exception) at function Future<List<int>> getEgl_interface(int textureId) // in flutter_gl_web.dart

webgl_animation_multiple (black screen. In VSCode I get a code execution stop (but no Exception) at function ImageLoaderLoader.imageDom.onLoad.listen((e) // ImageLoaderForWeb.dart

webgl_clipping_advanced (black screen. In VSCode I get a code execution stop (no exception) at function Future<List<int>> getEgl_interface(int textureId) //flutter_gl_web.dart

webgl_clipping_intersection (black screen. In VSCode I get a code execution stop (no exception) at function Future<List<int>> getEgl_interface(int textureId) //flutter_gl_web.dart

webgl_clipping_stencil (I get an abstract star-like shape, drawn with lines (definately not the model in the preview pic). In VSCode I get a code execution stop (no exception) at function Future<List<int>> getEgl_interface(int textureId) //flutter_gl_web.dart

webgl_clipping (black screen. In VSCode I get a code execution stop (no exception) at function Future<List<int>> getEgl_interface(int textureId) //flutter_gl_web.dart

webgl_animation_blending_skinning (black screen. No error message or code execution stop.)

webgl_animation_skinning_additive_blending (I see the character running, but only as a black silhouette with no lighting whatsoever. No error message or execution stop)

webgl_animation_skinning_morph (I only see the skeleton /bones drawn as lines, but no rendered model. No error message or execution stop)

webgl_loader_svg (In only see the grey checkerboard background, not the tiger svg, no error msg, no code break)

webgl_morphtargets (blue screen. In VSCode I get a code execution stop (no exception) at function Future<List<int>> getEgl_interface(int textureId) //flutter_gl_web.dart

webgl_morphtargets_sphere (black screen. In VSCode I get a code execution stop (but no Exception) at function ImageLoaderLoader.imageDom.onLoad.listen((e) // ImageLoaderForWeb.dart

webgl_morphtargets_horse (white screen. In VSCode I get a code execution stop (but no Exception) at function FileLoader.load(url, (buffer) { completer.complete(buffer); }); // FileLoader.dart

misc_controls_arcball (yellow box with gizmo on grey background. The cannon model is not loaded. No Exception or code execution stop)

webgl_loader_fbx (black screen. No Exception or code execution stop)

The rest works just fine! Thank you for your great work man!

wasabia commented 1 year ago

@JohnnyRainbow81 Hi! fixed some bugs, black screen with no exception maybe need wait more time or try click render button,

for flutter web, webgl_animation_multiple debug mode work ok, but release mode has error.

JohnnyRainbow81 commented 1 year ago

Cool! Just checking your example web app from my iPhone and there are working examples now! Even those containing a loaded 3d model :) (Before on iOS on my iPhone/iPad, not a single example could be loaded).