[SOLVED] Is Render to Texture Broken?


#1

Hello,

I tried using the render to texture functionality to create the illusion of a mirror-like floor (for product visualization purposes). I understand that there are other ways of going about this such as duplicating your model with a negative scale, but that’s besides the point.

I tried copying code from these 2 examples which are actually working with render to texture (Play the published builds to see them working):
https://playcanvas.com/project/528262/overview/render-to-texture-test
https://playcanvas.com/project/335444/overview/tutorial-render-to-texture

However, I couldn’t get the code to work in my own personal project so I figured I must be doing it wrong. I decided it was smarter to Fork these examples and re-publish just to make sure, but that didn’t work either, even though I made no changes to the scene.

Am I missing something really obvious here or is compatibility with the code in these projects gone? The first link isn’t even that old, it’s from January this year.

Can someone point me in the right direction on how to get render to texture to work again?

Here is the link to the fork:
https://playcanvas.com/project/560768/overview/render-to-texture-fork1


Render to texture
#2

Rendering to a texture works differently now that we have support for Layers in the engine.

Here is an example similar to one of the above projects that shows how to use layers to render to a texture.

https://playcanvas.com/project/560797/overview/tutorial-render-to-texture


#3

Thanks for your help Dave, I managed to get Render to Texture working!

A future shader that allows the image to look like an inverse reflection instead of a flat TV Screen will be amazing once it comes in the form of a tutorial project.

Again, thanks for your help :smiley:


#4

Wow.

did I just break a read only project by removing the “RenderTexture” layer???

-> https://playcanvas.com/editor/scene/618912

Fix that please…


#5

Oh, that’s quite bad. You shouldn’t be able to edit any project with read only but it appears that layers aren’t protected! I’ve just tried this with my own projects to confirm :frowning: @dave @vaios


#6

This is now fixed. Thanks for bringing this to our attention.


split this topic #7

2 posts were merged into an existing topic: Render to Texture not working on VR