[Unity][Windows] RenderTexture flipped
Hi there,
I've a strange behavior on Windows : When I render my main camera to a Texture2D using a RenderTexture / ReadPixels (e.g to save it as an image file), the Noesis GUI Panel attached to the camera is flipped vertically ! Of course, I cannot simply set up the "Flip vertically" property of the Noesis component, because it would impact the renderer GUI, which is good.
The issue occurs only on Windows Standalone, not on Android (I cannot test on IOS).
Any idea ?
Regards,
Roland Tomczak
I've a strange behavior on Windows : When I render my main camera to a Texture2D using a RenderTexture / ReadPixels (e.g to save it as an image file), the Noesis GUI Panel attached to the camera is flipped vertically ! Of course, I cannot simply set up the "Flip vertically" property of the Noesis component, because it would impact the renderer GUI, which is good.
The issue occurs only on Windows Standalone, not on Android (I cannot test on IOS).
Any idea ?
Regards,
Roland Tomczak
Re: [Unity][Windows] RenderTexture flipped
So, the issue is happening when you read the pixels of the texture using ReadPixels() ?
The 3D scene rendered by Unity is also flipped I suppose.
The 3D scene rendered by Unity is also flipped I suppose.
Re: [Unity][Windows] RenderTexture flipped
Please see the attached picture : Here, the "game" is running in the Unity Editor, but the issue persists in the final Windows build..
Every N ms, the application grabs its screen, using RenderTexture / ReadPixels (so, the main Noesis component must have EnablePostProcess = true), encodes it as JPEG and send it to another application (for supervision purpose).
You'll see that the virtual joypad is flipped, just on the screenshot. However, no issue with the "nested" GUI Panel, such as the car dashboard, and the floating white roadbook sheet.
Every N ms, the application grabs its screen, using RenderTexture / ReadPixels (so, the main Noesis component must have EnablePostProcess = true), encodes it as JPEG and send it to another application (for supervision purpose).
You'll see that the virtual joypad is flipped, just on the screenshot. However, no issue with the "nested" GUI Panel, such as the car dashboard, and the floating white roadbook sheet.
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: [Unity][Windows] RenderTexture flipped
Let me see if I understood correctly...
You have a NoesisGUIPanel attached to the main Camera game object.
At some point you set a RenderTexture on the targetTexture of that Camera object, and call camera.Render() to generate a screenshot.
And finally you restore the camera.targetTexture to null to render to the main screen again.
Is that correct?
Unfortunately we don't support that scenario right now, but you can workaround it by tweaking a bit our scripts.
Go to Assets/Plugins/NoesisGUI/Scripts/NoesisGUIPanel.cs script and create a new method:
Then, in your script that generates the screenshot do the following:
Hope this helps
You have a NoesisGUIPanel attached to the main Camera game object.
At some point you set a RenderTexture on the targetTexture of that Camera object, and call camera.Render() to generate a screenshot.
And finally you restore the camera.targetTexture to null to render to the main screen again.
Is that correct?
Unfortunately we don't support that scenario right now, but you can workaround it by tweaking a bit our scripts.
Go to Assets/Plugins/NoesisGUI/Scripts/NoesisGUIPanel.cs script and create a new method:
Code: Select all
public void Update()
{
LateUpdate();
}
Code: Select all
var gui = GetComponent<NoesisGUIPanel>();
gui.EnablePostProcess = true;
gui.FlipVertically = true;
gui.Update();
...
var cam = GetComponent<Camera>();
cam.targetTexture = screenshotTex;
cam.Render();
cam.targetTexture = null;
...
gui.EnablePostProcess = false;
gui.FlipVertically = false;
Re: [Unity][Windows] RenderTexture flipped
You're right, I can send you in private the snippet performing all the job.You have a NoesisGUIPanel attached to the main Camera game object.
At some point you set a RenderTexture on the targetTexture of that Camera object, and call camera.Render() to generate a screenshot.
And finally you restore the camera.targetTexture to null to render to the main screen again.
Is that correct?
Sadly, your solution doesn't really correct the issue :
* The screenshot is OK
* However, the GUI being displayed in the Unity application is "flicking" (switching vertically at a random frequency).
I'll try to workaround the issue with two camera, but the "supervisor" won't have the visual feedback of the GUI of the user (could be better).
Any other idea ?
Regards,
Roland Tomczak
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: [Unity][Windows] RenderTexture flipped
Please create a ticket in our bugtracker and attach everything I need to reproduce your scenario. I'll see if I can find a way to avoid the flickering problem.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot] and 26 guests