Jump to content

Mirror the render image


PacoMontanes

Recommended Posts

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 by PacoMontanes
Link to comment
Share on other sites

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)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...