Monday, August 29, 2022
HomeGame DevelopmentNeed assistance with mirror reflection rendering - Cocos Creator

Need assistance with mirror reflection rendering – Cocos Creator


Hello all, I wish to create water reflection in my sport. I learn few tutorials and understood I want to make use of second mirrored digicam and render texture than I’ll render in aircraft, however I get hassle with the mistaken measurement of render texture, or with aircraft I don’t know precisely.
Here’s what I achieved:
Right here is my world with 2 cameras (first important, second mirror reflaction)

within the backside is blue aircraft what I’m utilizing for render texture, now in play mode I’ll disable haxagons and you may see my rendered texture in aircraft:

As you see, the rendered texture, smaller than 3D hexagons.
My render texture has 1024×1024 measurement, and aircraft scale is (1, 1, 1), so I don’t know what I’m doing mistaken.

One factor I observed that my important digicam has isWindowSize property true, when my reflection digicam doesn’t have this one, as a result of it has render texture. I attempted to alter the dimensions of reflection digicam and render texture to match important’s digicam width and top within the code, however the measurement nonetheless was mistaken.


please present each digicam settings, the digicam fov and projection should even be aligned

Thanks for reply, I’m utilizing this code in lateUpdate, so they need to be the identical:

I feel the issue is my important digicam isWindowsSized, when my reflation digicam isn’t:

Reflection digicam misplaced its isWindowsSize once I connect targetTexture to it.
Additionally, it could possibly be some drawback with aircraft the place I render the feel. Nevertheless it has scale(1, 1, 1)

Are you able to put up the challenge so we will see the reason for the issue?

If it’s a measurement drawback, you possibly can name the resize perform of renderTexture

If the digicam has a renderTexture then isWindowsSize shall be set to false as a result of it can name the digicam object’s setFixedSize perform

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments