![Need assist with mirror reflection rendering – Cocos Creator Need assist with mirror reflection rendering – Cocos Creator](https://thefuntrove.com/wp-content/uploads/https://discuss.cocos2d-x.org/uploads/default/optimized/3X/b/5/b5691bc24bf8b7267e389dfb8df7be70f81d6e93_2_1024x651.png)
[ad_1]
Hi all, I need to create water reflection in my recreation. I learn few tutorials and understood I would like to make use of second mirrored digital camera and render texture than I’ll render in aircraft, however I get bother with the mistaken dimension of render texture, or with aircraft I don’t know precisely.
Here is what I achieved:
Here is my world with 2 cameras (first essential, 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’ll see my rendered texture in aircraft:
As you see, the rendered texture, smaller than 3D hexagons.
My render texture has 1024×1024 dimension, and aircraft scale is (1, 1, 1), so I don’t know what I’m doing mistaken.
One factor I observed that my essential digital camera has isWindowSize property true, when my reflection digital camera doesn’t have this one, as a result of it has render texture. I attempted to vary the dimensions of reflection digital camera and render texture to match essential’s digital camera width and top within the code, however the dimension nonetheless was mistaken.
please present each digital camera settings, the digital camera 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 essential digital camera isWindowsSized, when my reflation digital camera isn’t:
Reflection digital camera misplaced its isWindowsSize after I connect targetTexture to it.
Also, it could possibly be some downside with aircraft the place I render the feel. But it has scale(1, 1, 1)
Can you submit the venture so we are able to see the reason for the issue?
If it’s a dimension downside, you may name the resize perform of renderTexture
If the digital camera has a renderTexture then isWindowsSize will likely be set to false as a result of it’s going to name the digital camera object’s setFixedSize perform
Thanks for reply, here’s a small venture I created, you may see mistaken reflection:
water_reflaction_test.zip (2.6 MB)
I attempted this one to set dimension by my essential digital camera width and top, however on this case I bought very huge view in texture…
I can get appropriate view simply by modifying scale of water aircraft, however it’s mistaken resolution I feel, additionally it’s magic numbers:
[ad_2]