react-three-lightmap icon indicating copy to clipboard operation
react-three-lightmap copied to clipboard

Non react project

Open Hoodgail opened this issue 2 years ago • 11 comments

How would i use react-three-lightmap with a non react project

Hoodgail avatar Jan 04 '22 18:01 Hoodgail

Hey, this is a good question! I just recently finished a rewrite that decouples a lot of this code from React, so it is conceivable to expose completely a non-React API. I can take a look at it, but it will still take more work and planning, so I wouldn't expect this to happen soon, sorry!

If you are curious re: what this could look like, this is the entry point to main non-React-based baking logic:

https://github.com/pmndrs/react-three-lightmap/blob/38154da5693b4eb75226f02370e198b6e16c8211/src/core/Lightmap.tsx#L53

The requestWork function (it schedules slices of computation onto a responsive RAF loop) is currently provided via a React hook, but could be separated out as well.

unframework avatar Jan 05 '22 18:01 unframework

Thank you for your response, I'll check it out.

Hoodgail avatar Jan 06 '22 01:01 Hoodgail

@unframework I also wish your awesome tech was decoupled from React ! 🙋🏼‍♂️ 🙏🏼

In fact, I would have expected it to belong in the exemples considering it has no equivalent ( beside this GI exemple: https://threejs.org/examples/?q=global#webgl_simple_gi ), and the react-three-lightmap repo would have been a wrapper around it.

I hope you find time to decouple it, otherwise I'm sure someone will do it eventually ! 😄

wmcmurray avatar Jan 06 '22 13:01 wmcmurray

I'd also love to see this useable without React! Such a cool project

Not real-time but might be a solution to anyone finding this issue Blender Lightmaps https://github.com/Naxela/The_Lightmapper

lucas-jones avatar Jan 06 '22 14:01 lucas-jones

@unframework I also wish your awesome tech was decoupled from React ! 🙋🏼‍♂️ 🙏🏼

In fact, I would have expected it to belong in the exemples considering it has no equivalent ( beside this GI exemple: https://threejs.org/examples/?q=global#webgl_simple_gi ), and the react-three-lightmap repo would have been a wrapper around it.

I hope you find time to decouple it, otherwise I'm sure someone will do it eventually ! 😄

the problem with these examples is that they're often just that, not something readily usable or applicable or even sharable. i've spent so much time with that demo you linked and gave up making it re-usable. my finding are here: https://codesandbox.io/s/adaptive-lightmaps-wsg13 the biggest problem was mutation, it starts to dismount scene contents. things are usually hard to share because they need awareness of the environment they're in, lifecycles, etc, or else it will be limited. this may not apply to this use case i don't know but it's usually the case sadly.

tbh would rather like to see a react thing that's stable and actually usable, as opposed to yet another example that's being thrown into jsm where nobody uses and maintains it.

drcmda avatar Jan 06 '22 21:01 drcmda

@drcmda life would be very boring if everything where super-polished, cohesive and readily usable... there would be nothing left to fix and improve ! 😄

wmcmurray avatar Jan 07 '22 05:01 wmcmurray

Well, that's one way to look at it :P

drcmda avatar Jan 07 '22 09:01 drcmda

bump on this!

naive17 avatar Jun 30 '22 14:06 naive17

Is there any update on this? Hopefully it can be used for non react project.

evan526914448 avatar Aug 01 '22 13:08 evan526914448

Thanks everyone, I can see a lot of interest in this and I think there is a way to expose the necessary internals so that anyone can use them without React "at their own risk". July was super busy with work for me (I have been neglecting a few different feature/bug reports unfortunately 😭), but hopefully August will be more chill for me to revisit this. Thanks for waiting!

unframework avatar Aug 01 '22 21:08 unframework

I would also love to see this decoupled from React. Will definitely give credits if used in the XRSharp.io project (.NET wrapper around ThreeJS).

giovanni-a avatar Feb 25 '24 01:02 giovanni-a