Scaling Object turns the textures white (Unity3D) - unity3d

I'm trying to figure out why my Object's textures keep turning white once I scale the object down to 1% (or less) of its normal size.
I can manipulate the objects realtime with my fingers and there is a threshold where all the textures (except a few) turn completely ghost white, as shown below:
https://imgur.com/wMykeFw
Any input to fix is appreciated!

One potential cause of this issue is due to how certain shaders can miscalculate how to render textures when scales are set to low values.
To be able to render this asset so small using the same shader, re-import the mesh with a smaller scale factor (in the mesh import settings), and that may fix it.

select ARCamera then camera, in the inspector, select the cameras clipping plane and increase it(you want to find the minimum possible clipping that works to save on memory, so start at 20000, and work your way backwards til it stops working, then back up a notch).
next (still in the cameras inspector), select Rendering Path and set it to Legacy Vertex Lit
this should clear it up for you

Related

FPS drops when scale object. How fix? Unity Android

There is an empty scene with one standard cube. If you change its scale to (5;5;1), then the fps does not drop.
But if I change it to (5; 10; 1) my fps drops to ~30.
If I move the camera away from the cube with the scale (5;10;1), then the fps is again 60.
Maybe I have wrong camera settings or something else.
How to achieve high fps without moving the camera away?
p.s. The fps does not drop in the editor. Only after launching on android.
Unity version 2020.3.18f1. Tried on another version same problem.
cube with scale(5;5;1)
cube with scale(5;10;1)
cube with scale(5;10;1) and camera is distant
The problem may be due to the fact that more pixels is rendered (fragment shader is executed for every one) when the object is scaled up. The other hint is that when you move the camera far from the object the frame rate is increased as the rendered object generates fewer pixels.
As you mentioned that the program runs on Android, changing a regular shader to mobile shader may improve the performance.
From some of Unity's documentation on transforms
Performance Issues and Limitations with Non-Uniform Scaling
Non-uniform scaling is when the Scale in a Transform has different values for x, y, and z; for example (2, 4, 2). In contrast, uniform scaling has the same value for x, y, and z; for example (3, 3, 3). Non-uniform scaling can be useful in a few select cases but should be avoided whenever possible.
Non-uniform scaling has a negative impact on rendering performance. In order to transform vertex normals correctly, we transform the mesh on the CPU and create an extra copy of the data. Normally we can keep the mesh shared between instances in graphics memory, but in this case you pay both a CPU and memory cost per instance.
I'm not certain if your Z's scale matters in this case, because you're only rendering the x-y plane. I can't comment for certain on why the performance hit is reduced as you increase your camera distance. I suspect Unity has some intelligent vertex manipulation going on to simplify rendering of distant objects, saving you on CPU cost.
That being said, try to avoid non-uniform scaling. Primitives should typically only be used as placeholders.

How to add a a get a simple flag with 3 stripes on a Cube in Unity

is there any way to give a simple 3D cube in Unity the look of a flag without displaying the whole flag on every side. So that as example the top stripe also fill's the whole top?
The default mesh unity provides for cubes always show the same texture an all6 sides, so they are always all the same. Whatever material/texture you apply.
The one material is used an all sides, with UV values from 0 to 1 (whole texture).
Even fiddling the UV scales on the material does not help as the 6 sides all start with the same range.
I you wish to change this, you need to edit/create you own mesh for a cube which allows different UV settings for the 6 surfaces, or multiple materials. You could make one which has a second material for one of the 6 faces and assign your flag texture there.
(Unity does not really provide mesh editing. I used blender for this.)
In Unity, you could create an empty gameobject, add 6 'quad' objects, and use different textures on these. Then this set of 7 objects behaves like a cube, but with different textures (and less performance when using lots)
Why not just use a single quad for the flag?

Shader Graph, texture not looping

I would like to make a shader using shadergraph, but i got a little problem.
I have a texture like this
I would like to move over that texture over time to make some sort of laser effect, but it works only at start, cause when the time goes too high, my texture is a become a simple line
This lane appear even in shadegraph, if i go to much left or right on the offset of the texture, it doesn't loop, it just show the last point infinitely. I would like that when my texture end it loop back to the same texture forever
What do I miss pls ?
Select your texture in the inspector, and set the Wrap mode to "Repeat".
(Or use a sampler state in the shader graph)
There is a node "sampler state" that you can pull out from/to the third input of Sample Texture 2D. which has a wrap:repeat field.

.dae model disappears when approaching

When I move towards my .dae imported model, it disappears. I'm not "inside" the mesh yet, visibly at least, so I don't know what the deal is.
It looks like your object is closer than the scene-view camera's "Near Clip Plane", and is not being rendered as a result. The default editor "near clip plane" distance is around 0.3 units, so it shouldn't normally interfere with your objects.
Check that your object scale is correct. If your object is very small, the scene camera's near clip plane will seem much farther in comparison, and will appear to clip objects more aggressively.
You can create a default "Cube" primitive to check the size of your objects. Cubes are 1 unit in all dimensions by default, and most of the time it's a good idea to roughly map one unit to a real-world scale of 1 meter. If your object is considerably smaller than the cube, you may want to try scaling them up and seeing if that helps.
F key is a shortcut key that will automatically zoom and focus to an object. Select the GameObject and press F. This problem should be gone.
If the problem is still there, select the Camera and change the Clipping Planes Near to 0.3 and Far to 50000. You can mess with these values until Object stops disappearing. Although, pressing F should solve it.

Unity - Avoid quad clipping or set rendering order

I am using Unity 5 to develop a game. I'm still learning, so this may be a dumb question. I have read about Depth Buffer and Depth Texture, but I cannot seem to understand if that applies here or not.
My setting is simple: I create a grid using several quads (40x40) which I use to snap buildings. Those buildings also have a base, made with quads. Every time I put one one the map, the Quads overlap and they look like the picture.
As you can see, the red quad is "merging" with the floor (white quads).
How can I make sure Unity renders the red one first, and the white ones are background? Of course, I can change the red quad Y position, but that seems like the wrong way of solving this.
This is a common issue, called Z-Fighting.
Usually you can reduce it by reducing the range of “Clipping Planes” of the camera, but in your case the quads are at the same Y position, so you can’t avoid it without changing the Y position.
I don't know if it is an option for you, but if you use SpriteRenderer (Unity 2D) you don’t have that problem and you can just set “Sorting Layer” or “Order in Layer” if you want modify the rendering order.