How to set the screen resolution in Unreal Engine 4? - unreal-engine4

I am making a settings menu for my game. I have created every graphics setting I want, except changing the screen resolution. This is what I tried first. I didn't know what I should provide for the target, though.
What I tried first
For some reason, this didn't work. I'm guessing I should have provided a different target. Can somebody help me with this?

Since this is one of the highest results on google I figured I'd reply here.
Using console commands to set resolution absolutely DOES NOT WORK for shipping builds where console commands are disabled. It's better to use Get Game User Settings + Set Screen Resolution + Apply Resolution Settings nodes.

Is this a PC game? If so, this is the node I've used for altering resolution in the past, utilizing the r.setRes command:
If you have variable [width] x [height] parameters, have a function build the string and pass the return value to that node. Note: after the WxH, the f stands for fullscreen.
Credit for image: https://answers.unrealengine.com/questions/26895/how-can-i-change-games-resolution-in-blueprints.html

Related

How do I create a test app to create many screenshots in UE4?

I'd like to create a test application for my Unreal Engine based game to create screenshots. I'd like to place many (possibly thousands) of cameras throughout the maps and then have my test application enumerate them all and take a screen capture at each camera location.
I came across Taking Screenshots, but wanted to first check to see if this isn't already built into UE4 in the editor, or some tool. I'm also aware of the Screenshot Comparison Tool, but that doesn't seem to be what I need because I don't really want to use UE4 to do the image matching, but instead just want a directory full of images that I can do with what I want.
Any suggestions?
This is not directly what you want to do but I found this article very interesting: https://www.unrealengine.com/en-US/blog/capturing-stereoscopic-360-screenshots-videos-movies-unreal-engine-4?sessionInvalidated=true
It explains how people at Ninja Theory Ltd proceeded to produce their 360 video trailer which is, in the end, producing two 360 screenshots per frame.
So what they did was having everything exported in a folder (as a sequence of images) and then did what they wanted with it. (In this case put them all together with ffmpeg to make a video)
They used a plugin, I do not know if it can be tweaked not to make 360 captures but the built-in "take screenshot" from UE4 could work for you.
More specifically to what you need, you could probably store all positions/transform in an array, loop over it when you want to make the screenshot. Each step, you place your Camera at the specific position, make sure it is the current active camera to change the "view" and take a screenshot.
Taking screenshots and setting parameters such as export folder, resolution etc. ... can be called via console commands and console commands can be executed from code or blueprint using the "execute console command" node (there is an example in the article).
I hope it helps.
I think the best bet you have is rendering camera to a texture.
this way you can have multiple inactive camera then iterate through them, activate them, capture their screen view and going to the next one.
for basic tutorial have a look at
https://www.youtube.com/watch?v=a9iho861SlY

Getting Retina Screen Resolution on Macs with HiDPI in Unity

I am making a custom Unity Editor GUI window and I just want it to stay and the exact center of the screen. Surprisingly, this is harder than I thought it would be on Macs.
This is my code:
....
windowRect.center = new Rect(0, 0, Screen.currentResolution.width, Screen.currentResolution.height).center;
....
The problem is, on a 5K iMac, which has a native resolution of 5120*2880, by default the macOS uses HiDPI to scale everything to 2560*1440. In Unity, Screen.currentResolution returns 5120*2880 without considering HiDPI scaling, but I need that sweet scaled resolution.
I've tried other functions as well. Display.main.systemWidth returns 1920 instead of 5120 or 2560.
Is there a way to do this? Or am I just out of luck? I am using Unity 2018.1.9f1.
Also, if there is a way to get the size of the whole Unity Editor Window(not the game window), I would be fine with it. Thanks in advance!
In Editor, Screen.currentResolution show the resolution of game window. You can enable Maximize On Play to use the maximized window resolution.
And if you deploy to MacOS app, it should be the 5K resolution correctly.
This in an old thread, but in case someone is still wondering, I found out that the highest resolution returned by Screen.resolutions on a retina device is the « magic » resolution. It’s the one that you see in the device settings as « Looks like X x Y ».
This is not mentioned in the doc as far as I could see, so I am not certain in can be relied upon in the long run, but it’s the case currently with Unity 2018.3.
Not quite the same as centre of the screen, but I was having a similar issue and solved it using:
EditorGUIUtility.GetMainWindowPosition().center;

compare images on different OS

As part of automation, I want to compare images by taking screenshot and the baseline image. Will be executing the same on different OS(linux, win). On executing in different OS, the screen resolution changes and image comparison fails. Currently I am doing it with Selenium+java. Can anybody suggest me any way or a different tool to achieve it?
So make baselines for each environment you're testing on and have the test compare with the correct one for that platform (or just with all of them and flag as passed if any of them matches).
I'm not so sure this entire "compare screenshots" is a good way to test things (you just hit one snag, another one can be that different browsers (and even versions of the same browser) render things slightly differently.
The key thing here is the resolution, you must ensure that resolution is the same for base images and those you capture during test.
Set size of the browser window to fixed size, eg. (1920x1080),
Make all screenshots in this resolution,
During the test: before each image-comparison check if the window size is (1920x1080) if not I change it temporarily,
Take screenshot,
Compare image with original one
Do window maximize
Other solution is to capture screenshots of single WebElement rather
than whole page, because WebElements often are resolution independent.

google glass camera parameter settings

I'm working on an app that includes a custom camera application on Glass. I want to be able to hard-set different camera parameters, but I'm having difficulty figuring out which ones I actually have access to.
I tried calling parameters.flatten() and got a whole bunch of options that I thought I would be able to use, but when I tried testing them, nothing happened. (For example, when I tried setting the color effect to sepia, the result was still in normal color). Is there any documentation or code I can look at that will tell me which parameter options I actually have?
There are a few open issues on our issue tracker about camera parameters that do not behave as expected:
Issue 302: GDK: Camera effects not registered or take affect
Issue 303: GDK: Request: Additional camera focus modes (with auto focus)
Issue 304: GDK: Camera scene mode does not register or take affect
You may want to follow those so that you can be updated as the GDK evolves.

ios zxing with front or rear camera

Im using ZXing, is working fine on my new app, but i would like to integrate the option of front or rear camera,
so far the only reference to this i've found is on the google group
But is not very clear what they mean with that,
so any pointers on what i have to do to accomplish this?
thanks !
ZXWidgetController doesn't provide that functionality and it's not really set up to make it easy to change.
The code that needs to change is in - (void)initCapture. It calls [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]. This returns the default camera and you don't want the defalt.
You need code similar to that in - (ZXCaptureDevice*)device in ZXCapture.mm. That code won't work out of the box (it's designed to work with both AVFF and QTKit) but it's the same idea. Instead of using the default video input device, go through the devices and look at device position to find the device you want.
Be nice to port that code to the widget but that hasn't happened at this point.