renderTexture -> can't make it work in 3.0.0 official

Hey there.

I can’t get Render Texture working in the 3.0.0 official.
(render a 2D label texture from UI canvas onto 3D geometry)
I had no problems in CC3 preview.

I don’t get any error messages but it just doesn’t work, I tried for 2 hours now,
I just don’t know what I am missing here.

*(I noticed that when upgrading a project from preview to official *
there is an additional script attached to migrate the canvas, looks like quite a lot has changed.
I also know that the cc.render target moved from canvas to camera, but I am still stuck…)

Any ideas?

You should have your render texture setup as render target in a dedicated camera which looks at the Label. Then the label should be rendered to the target RT

Please check:

  1. Your label’s layer should match the capturing camera’s visibility, ideally one dedicated layer for each capturing camera, this will avoid mismatch and over draw.
  2. Your target RT should be set to a material as main texture to be rendered, normally you will be using quad geometry with an unlit material.

Your issue is probably due to the first notice, in previous version the engine handles canvas camera visibility and its nodes’ layer automatically, during the render process, we assign a layer for each canvas as the camera’s visibility and its contents’ layer. In v3.0, as you noticed, camera is separated from canvas and we leave the control to user. There are two reasons

  1. We need camera to be free controlled for 2d tiled games and parallel scroll games
  2. We will support 3D UI soon, 2D elements like sprite, label should be able to be rendered outside canvas, so node’s layer must be considered.

Anyway, now the Camera visibility and Node layer is the only relation determines which camera renders a given node.

1 Like

I still can’t get it to work… I don’t know, it should work.
Maybe I still miss something but I really have no idea what that should be.

Can someone please look at this?
I recreated a very simple test here.

It’s just a quad facing the cam on a plane with a script attached
to the camera that only has the necessary steps included.
(btw: I null checked all the objects in the script, they all passed…)

(DL Size is 1,1 MB)

(Edit: If one of you has a windows machine it would also be interesting
to cross-check my other problem → if you can import this OSX project on a windows machine. As mentioned in another thread, I can’t import
OSX projects on Windows.Only difference: no FBX in here.)

Hi, you need replace a material effect with builtin-standard, so the texture will work.

Really? Did that change as well?
Before (in preview) it seems to be unlit, just checked.

Also when I change to standard, I have no
MainTexture property anymore.

So what do I need to put in instead of this
mat.setProperty('mainTexture', tex);
mat.setProperty('AlbedoMap', tex);

EDIT: Yes. Indeed. Thanks a lot, got it working now…

Sorry, this is my mistake. the effect of builtin-unlit just need enable “USE TEXTURE” and will work OK.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.