Live data from Hacker News

React Renderer for Three.js

github.com

131–136 of 136 posts

Re: React Renderer for Three.js

#131
For what its worth I've been very impressed and happy with what I've been able to achieve with R3F [1]

Its an online IDE for a number of CodeCAD packages to help lower the barrier to this paradigm.[2]

Going from knowing nothing about 3d, just hacking up example code it's been easy to put something respectable together without much dedicated learning. Im super grateful to the pmndrs team

[1] https://cadhub.xyz/dev-ide/cadquery [2] https://news.ycombinator.com/item?id=27649270

Re: React Renderer for Three.js

#132
post #98

Earlier quoted context omitted.

I was scratching my head over this one too. Other answers in the thread don't seem right. I then realized this: const mesh = useRef(... assigns an instance of something (`React.mutableRefObject`) to a variable in scope, but after compiling into normal JavaScript and becomes (0, _jsxRuntime.jsxs)("mesh"... (see `console.log(__SANDBOX_DATA__.data.transpiledModules['/src/App.js:'].source.compiledCode) `) So that's why y…

I’d answer the original question… > Is there an error in the examples? You have const mesh = useRef() ... > You'll be rendering an undefined element (before the ref has a chance to attach). …as follows: 1. On that last line, is just a regular element[0]. 2. Ref assignment makes this element’s instance accessible within component code[1] under a constant, here coincidentally (and confusingly, I must say) named “mesh”.…

Excellent explanation, thank you!

Re: React Renderer for Three.js

#133
post #5

When AR/VR finally happens, UI developers will have to deal with complexity from a completely different paradigm. For me, React's biggest strength has always been its ability to organize complexity into a manageable order. Combine this with the large pool of developers and extensive ecosystem, I think React will be the go-to tool for AR/VR apps. For this reason, I'm super hyped for R3F.

I really don't think React will be the go-to tool for VR; it's based on the DOM and trees of function calls, which are both hierarchical, which necessarily means you have the gorilla-banana problem. If you have a coffee cup on a table in VR, is that coffee cup a child of the table? How do you move the coffee cup off the table and put it onto another table? Is it now a child of that other table? What about the coffee…

AFAIK Unity has scene tree(items on table belong to table for example), so it seems compatible. Usually 3D transforms work on scene subtrees.

Re: React Renderer for Three.js

#134

Earlier quoted context omitted.

> otherwise it would have been pretty widely adopted across the industry I'm not sure that's a fair explanation for why. It's totally possible to come up with new paradigms that are useful even though nobody's thought of them before. I would think the main issue will be around JavaScript's tendency (cultural, syntactic, etc) to casually create and release objects all over the place, constantly. There's nothing intrin…

Practically, if that function is somewhat hot, I wouldn't be surprised if V8 omitted the allocation altogether when generating optimized bytecode — internally, properties on objects already have an "order," so V8 could push each property into the stack in that order/reverse order (depending on calling convention). And if it doesn't yet, that's not a difficult optimization to make.

It seems like it would be easy to optimize, but it's one of those things where I know the V8 devs are much smarter than I am so I assume if they haven't figured out how to optimize it, it must be harder than it seems :P

Re: React Renderer for Three.js

#135
post #5

When AR/VR finally happens, UI developers will have to deal with complexity from a completely different paradigm. For me, React's biggest strength has always been its ability to organize complexity into a manageable order. Combine this with the large pool of developers and extensive ecosystem, I think React will be the go-to tool for AR/VR apps. For this reason, I'm super hyped for R3F.

React is one of the worst choices of doing something like that. The underlying abstraction model of having a tree of components and re-rendering only the parts that have changed between renders doesn’t map to the hardware at all, meaning you’ll waste most of the HW performance just on maintaining the abstraction. You’ll also get zero benefits from the third-party libraries - there’s nothing in them that can help you…

What is wrong with scenegraphs? And what is the graphics programming using instead?

Re: React Renderer for Three.js

#136
post #94

The age of WebGPU is almost upon us. Chrome 94 comes out this quarter. I doubt React will be the major player in this next epoch. It will be something new that can pull off an instant load shared world game.

Threejs already has a webgpu renderer.

And a gltf2/glb loader! Web frameworks will become game engines now.
Post reply on HN