Possbile to use Unity RenderTexture yet?

Is it possible to use Unity RenderTextures with Needle Engine? The threejs equivalent should be WebGLRenderTarget afaik. three.js docs

Original Post on Discord

by user 474974683163394049

Yes and no - we currently dont export RenderTexture assets from Unity to hookup and just use on materials. But you can render into WebGLRenderTargets yes. There’s a small example in the samples repo (in the misc scripting examples folder)

Just wanted to mention, when using the sample script, an error occurs. This error is very likely linked to the threejs type defs for TypeScript :thinking:

by user 474974683163394049

should already be fixed :sweat_smile:

by user 474974683163394049

If you happen to have a fix for it feel free to open a PR too :slightly_smiling_face:

happy to merge that

is it possible that it’s just necessary to update your @types/three npm package? :thinking:

by user 474974683163394049

and you can work around these type errors by adding //@ts-ignore in the line above, better than being blocked by incorrect types (the actual field is there)

Dont always fallback to this tho please :smile: it can cause headaches later on too and hide actual errors

Well, I mean only in this kind of case where some type is missing in the typedef and one is sure that it’s a typedef error :slightly_smiling_face: but good point to add

Speaking from experience ^^

the “official” three ts types have the samples parameter included. i’ll just copy that for now :wink:

by user 474974683163394049

by user 474974683163394049

I feel you :sweat_smile:

by user 474974683163394049