From de0914426c1d2ed7eb122a66650a9ba9b1b77885 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Thu, 18 Sep 2025 09:38:47 +0200 Subject: [PATCH] =?UTF-8?q?chore(=F0=9F=93=96):=20update=20README=20with?= =?UTF-8?q?=20Three.js=20and=20polyfill=20instructions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #246 --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7538378fd..7f46e3568 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,18 @@ Below are some examples from the [example app](/apps/example/). https://github.com/user-attachments/assets/116a41b2-2cf8-49f1-9f16-a5c83637c198 +## Three.js + Starting from `r168`, Three.js runs out of the box with React Native WebGPU. You need to have a slight modification of [the metro config](/apps/example/metro.config.js) to resolve Three.js to the WebGPU build. We also support [three-fiber](/apps/example/src/ThreeJS/Fiber.tsx). -For model loading, we also need [the following polyfill](/apps/example/src/App.tsx#29). +For model loading, we also need the following polyfill: + +```tsx +// The two lines below are needed by three.js +import "fast-text-encoding"; +window.parent = window; +``` https://github.com/user-attachments/assets/5b49ef63-0a3c-4679-aeb5-e4b4dddfcc1d @@ -190,7 +198,7 @@ device.queue.copyExternalImageToTexture( ### iOS To run the React Native WebGPU project on the iOS simulator, you need to disable the Metal validation API. -In "Edit Scheme," uncheck "Metal Validation." +In "Edit Scheme," uncheck "Metal Validation.". Learn more [here](https://developer.apple.com/documentation/xcode/validating-your-apps-metal-api-usage/). Uncheck 'Metal Validation'