PacoMontanes Posted October 2, 2021 Share Posted October 2, 2021 Hi, Where I have to add a minus in GuiTSCtrl to mirror the render image in vertical or horizontal? Does anyone know? Thank, Paco Quote Link to comment Share on other sites More sharing options...
PacoMontanes Posted October 3, 2021 Author Share Posted October 3, 2021 (edited) Hi, When I add worldToCamera.scale(Point3F(-1, 1, 1)); on GuiTSCtrl::_internalRender(), it' works, the image is flipped but all normals in the whole scene are reversed as well. There is a way to flip all normals again and fix it? I've tried swapping left and right on frustum, but it flips the normals too... Should I have to go to the shaders way? (Sorry, I forget mentioning it, I'm using Torque3D 3.10) Edited October 3, 2021 by PacoMontanes Quote Link to comment Share on other sites More sharing options...
PacoMontanes Posted October 4, 2021 Author Share Posted October 4, 2021 The reason for normals flipped is because the order in which vertices are defined will not change when you invert the projection matrix. The GPU will incorrectly cull all meshes if the culling mode isn’t inverted after inverting the projection matrix. But this happens only when a mirror is done in one axis. But if you perform the mirror in 2 axes the effect will cancel each other. Actually, I need mirror in 2 axes... So, problem solved. worldToCamera.scale(Point3F(-1, -1, 1)); But it will be great if there is a method to invert the culling mode. (I've realized that using a negative FOV do the trick as well) Quote Link to comment Share on other sites More sharing options...
Azaezel Posted October 5, 2021 Share Posted October 5, 2021 On 10/4/2021 at 2:37 AM, PacoMontanes said: But it will be great if there is a method to invert the culling mode. https://github.com/TorqueGameEngines/Torque3D/blob/b6a1acabf813e93979d2feb1f5982bd4f3126e76/Engine/source/lighting/advanced/advancedLightBinManager.cpp#L949 vshttps://github.com/TorqueGameEngines/Torque3D/blob/b6a1acabf813e93979d2feb1f5982bd4f3126e76/Engine/source/lighting/advanced/advancedLightBinManager.cpp#L951 Quote Link to comment Share on other sites More sharing options...
PacoMontanes Posted October 9, 2021 Author Share Posted October 9, 2021 Thanks, Azaezel! Unfortunately, I'm using basic lightning... I'm currently using another different approach. Before swapping I copy the backbuffer to a texture, and then draw it mirrored. There are some artifacts but I tinkered to minimize them. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.