Planer Reflections: Cannot set property 'renderTarget' of null

Hi, been trying to get planer reflections working by following the example demo, i plug all the assets in, in the same way presented in the demo but i keep getting an error which is:

Cannot set property ‘renderTarget’ of null

Editor here: https://playcanvas.com/editor/project/822043

I’m trying to understand how to use planer reflections for a big product configuator projects I’m working on so getting this working would be fantastic.

Where am I going wrong?

Thanks

Hi @Arnie,

Make sure to create the required scene layers in your project as well, check the example project on that:

image

After you create them and order them as required, don’t forget to add the Mirror layer to your active camera and any other entity that will be casting reflections.

image

1 Like

To add to Leonidas, I think the example needs an update, as it is probably using an old API for render target. Perhaps, @yaustar can update at some point.

@Arnie you can grab an updated mirror.js from this project:
https://playcanvas.com/project/713058/overview/planar-reflections

1 Like

Thanks for this updated version, it did indeed fix some deprecation API warnings. :slightly_smiling_face:

Okay so took a look at all this layering and replicated it, no compile errors anymore, and its rendering “something” but its not quite working as expected.

It looks like this: https://launch.playcanvas.com/1212528?debug=true

Is there something I need to modify in the code?

Thanks

After some fiddling it seems that the example shows a checkbox ticked that should’nt be ticked in order for reflections to work.

checker

Please make sure that that tickbox is unchecked and it should work once all your layering and render order is set up :grinning:

So nearly there but another issue has reared its head, the planer reflections work perfectly when the reflection plane is horizontal, but once the reflection plane is vertical, the reflections become upside-down and offset positionally.

https://launch.playcanvas.com/1212528?debug=true

Is this just a limitation of planer reflections?

Thanks

Thanks for sharing that!

I vaguely remember somebody else had the same issue, not sure if it was resolved. @LeXXik any idea?

1 Like

Ah, yes, I think it was discussed here:

@Arnie you can check out that thread, and see if it helps you.

2 Likes