I’d like to use a RenderTargetTexture as a diffuse texture for a project I’m working on. As a first step, I forked the sandbox demo from the documentation and (naively?) changed this:
rttMaterial.emissiveTexture = renderTarget;
To this:
rttMaterial.diffuseTexture = renderTarget;
Now it’s black. Here’s the URL to the modified sandbox:
By disabling lighting, I think what you were trying to do was make the material unlit; if so, it might be easier to use a PBR material, which works out of the box with a direct translation of the code you have.
Thanks everyone! You are both correct. That was very helpful.
The context is I’m trying to render BMFonts to a texture in a scene loaded from glTF (so yes to PBR materials). I’ve already done an experimental port of the MSDF text renderer from three-bmfont-text. I have it rendering to plane meshes, one for each glyph.
Now I need to render that text together onto a single, arbitrary, non-plane geometry, and I thinkRenderTextureTarget is the way to do it. (Feel free to suggest other ways of going about it.)
I’m fairly new to graphics programming, so I’m still learning some basics and making a lot of mistakes as I go. In this case, I took the original sandbox from the RenderTextureTarget documentation and completely missed line 51: