I have a scrollbar with a mask.
Inside there are over 1000 UI elements scrolled - each has bg, icon, and text.
on top there are several UI elements spreaded out
when static, it runs at arounf 80fps
while scrollng, it runs at about 30fps
What i've tried
Atlassing all images
uniying materials - giving the same material to all elements (either 1 for all or 1 for the list and 1 for all the rest)
seperating canvases - 1 for the list and 1 for all the rest (only increased batches).
removed pixel perfect from canvas
Changed canvas from screenspace: camera to overlay.
Issues:
there are seperate batches for 2 objects under the reason "Different material instance"
although both objects are under the same canvas, same Z same material and same Image (and both read the same image from the same atlas on start).
the list of elements all contain an image taken as an index from a unified atlas.
However, I see 2 separate batches - 1 for the 15 elements not masked, and 1 for all the masked elements. is there a way to batch them together?
I'm looking for a way to optimize the masking of the element (for this is the heaviest component)
With the pixel perfect off - the fps moved from ~30fps while scrolling to anything between 60fps to 0.7fps
Related
Following this seat
https://youtu.be/eH-PdFKgctE?t=2046
I have a scroll of UI items masked at the top to buttom of the screen
So far I've failed to reduce the batching past 10 batches
What I did was:
I Created 2 components (for now both are UI/Default) 1 for the scrollElements and 2nd for the rest of the screen.
I've set all the UI elements to the 1st material.
I've tried to llok on the web and failed to understand how to tween the alternate the shader into UI-fast which prevent's masking
I am about 4 hours into debugging this, time to ask!
I have this nest of objects:
- Game Object
|--- Canvas
| |---Panel
| | |---Element 1
| | |---Element 2
With my current configuration, Elements 1 and 2 are showing up separate with one completely off screen, rather than evenly spaced out next to one another within the specified space. It is a Horizontal Layout Group specified to:
Child Alignment: Middle Center
Child Controls Size & Force Expand: None.
The Canvas is set to Screen Space - Camera, with my only camera specified.
Those settings are here as well:
The Panel is a Rect Transform set to around the bottom of the screen.
Those settings - The panel has the Horizontal Layout Group component on it.
Next are the child objects, those settings are here:
In terms of what I have done, here are just a few:
Tried to remove the Canvas components from the children
Unpacked the prefabs completely to make further edits.
Rebuild the children
Tried Render mode of the Canvas to World Space
Tinkered with the anchor points to see if positioning was an issue
Hierarchy is here for clarity:
This ultimately leads to this result, the graphic on the right should be in view (on the yellow screen).
Thank you in advance!
EDIT: With Horizontal Layout Group and the rest of the object it is on:
I have a vertical Scroll List. I have developed this app for resolution 768*1024. In this resolution my List is working fine. But when I run my app in higher resolution(1440*2960) it leave some space around all 4 direction.
I have also tried with changing Layout element min height dynamically, but Spacing issue is still exist.
Vertical and horizontal layout set element position in (screen width/height divided by a number of elements) * element number, in other words, they space out all elements evenly across canvas space. To achieve what you want you either have to enable child control size -> height option or write a script that aligns your elements in the center of the screen and one after another taking in consideration their height.
HOW THE Viewports look after loading the file:
I am having an issue caused by extremely large objects (in terms of physical size not polycount etc.) that I imported from a game using ninjaripper (a script used for extracting 3d models from games). When I open the file containing these large objects, the objects are only rendered in the left orthographic viewport. All other viewports/views do not show the geometry regardless of which rendering mode (wireframe, edges faces etc.) I have selected on said viewports. The objects are also not visible in perspective views. When I unhide all items apart from a single object (of normal size) I am able to see the object in all viewports including perspective viewports. When I unhide all again, the object which could previously be seen disappears. When switching to perspective view when these extremely large objects are present, the 'viewcube' disappears for an unknown reason. Zooming in or out in a perspective viewport also results in the viewcube disappearing. This is the only scene I've had so far which shows these issues, all my graphics drivers are up to date (specs listed below). The scene contains 3602 objects and has 1,957,286 polygons and 1,508,550 vertices.
This is the furthest I could zoom out in 3ds max:
Viewcube has disappeared on top right and bottom right viewport:
I tried removing all of the extremely large objects by hand, after which the remaining (normal sizes) objects could be seen in 2 of the viewports (top left and top right viewport did render correctly).
Viewports after having deleted all extremely large objects:
I tried resetting the scene, after which I merged the scene containing all 'normal sized objects' into an empty scene. This resulted in all viewports rendering the objects correctly. However, after saving the file and re-opening the saved file, 2 of the 4 viewports did not render the objects as was the case after just having deleted all but the 'normal sized' objects.
My question is: how should I deal with these extremely large imported objects in order to fix the viewport rendering issues they cause?
I wrote a simple bit of maxscript code to print out the maximum size of the biggest object in the scene, which resulted in a value of 2.6*10^38 [generic units], which, according to my calculation corresponds to a value of 6.6*10^36 [meters], in summary: extremely large. (I suspect the ninjaripper script or the script which imports the files produced by the ninjaripper into 3ds max had some sort of error causing some of the vertices to have extremely large position values). When I switch to the measure tap in 'utilities' and press Ctrl+A to select all objects in the scene (the scene containing all objects including the extremely large objects), 3ds max crashes due to the large object size (error message: "Application error- An error has occured and the application will now close. No Scene changes have occured since your last save.").
I could write some maxscript code which deletes all objects which are larger then a certain size (for example: 10^5 [meters]). However, as afore mentioned this for some reason does not fix the issue completely (after saving the scene with only 'normal sized' objects and re-opening the scene only 2 of the 4 viewports render the objects correctly. I ran the code for measuring the max size of the largest object in the scene again after having deleted all extremely large objects to check if I had indeed not skipped over one of these large objects, the result was a value of: 121.28 [generic units] (corresponding to object: "Mesh_3598") which is a relatively normal size, however 2 of my 4 viewports are not rendering my objects even after deleting the large objects (only when the left orthographic view is selected they can be seen in the 2 viewports that do not render part of the time).
Code for checking largest object (also prints out maximum size of this object):
global_max=0
largest_obj=undefined
for obj in geometry do(
obj_max_x = (obj.max.x-obj.min.x)
obj_max_y = (obj.max.y-obj.min.y)
obj_max_z = (obj.max.z-obj.min.z)
local_max = amax(#(obj_max_x, obj_max_y, obj_max_z ))
if local_max > global_max do
global_max = local_max ; largest_obj = obj
)
messagebox ("global max = " + global_max as string)
messagebox ("largest obj = " + largest_obj as string)
See the following links for the 3ds max scene files I have mentioned:
https://drive.google.com/open?id=1bAilmaHAXDr4WuD8gGS4piQfPzzJM9MH
Any suggestions/help will be greatly appreciated. Thank you very much!
System specs:
-Autodesk 3ds max 2018 x64
-Windows 10 PRO x64
-i5 6600k #3.5ghz
-msi z170a gaming m7 - socket 1151 - atx
-coolermaster g750m -750watt
-msi radeon r9-390x gaming -8gb
-noctua NH-D15
-kingston hyper-x fury black 16gb-pc-21300-dimm-4x4gb#2666mhz
As it turns out the extremely large objects were indeed causing the viewport rendering error. After removing all object's with a maximum size of 100000 [generic units] the viewport rendering errors were gone. I suspect the issue was caused by the objects not being in between the viewport's far and near planes due to the extremely large object sizes.
Does Unity 5 support partial hiding of a UI/Image?
For example, the UI/Image I have in my scene has 100 width and 100 height.
At time = 0, the UI/Image is hidden. When time = 5, the UI/Image only shows the first 50 pixels. When time = 10, the UI/Image is fully drawn.
The answer to the question is in this link
Set the image type to Filled
Set the fill method to horizontal
Set the fill origin to left
From the script, update the fill amount from 0 to 1 over the timespan
On first thought, I can come up with two workarounds for this.
If the background of the image-in-question is a solid color, you can use another image with the same color as background that covers the actual image, so that it looks like the actual image is partially revealed. Then, just reduce the length of this covering image over time to achieve a revealing effect using Coroutines.
You make multiple image files with alpha channels and change the textures of the UI/Image over time. Each image will act like an iteration of revealing effect. Say you have 11 images, the 6th image will have first half revealed, and second half as alpha=0. In this case, if you want smoothness, you will need a higher number of images.