I've made a small png (100x30) and added it as a texture in Unity. I've also added it to a script so I can poll it, but if I print out its width and height it now states its 128x32. What happened?
I've tried to adjust the camera, but it does not seems to have anything to do with it. Any clue?
Generally textures are scaled to a power of 2 on both sides for performance reasons.
For example multiplication and division are faster if the GPU can assume that you are working with POT textures. Even mipmaps generation process relies on that because division by 2 never produces a remainder.
Old GPU (I don't know exactly but probably even several mobile GPU these days) requires strictly POT textures.
Unity by default will try to scale the texture to a power of 2. You can disable or tweak that setting switching texture import settings to "Advanced".
For more details checkout the doc.
Note that generally you want NPOT textures only for GUI, where you need to control exactly the resolution on screen and mipmap aren't used. For everything in the 3D scene power of 2 performs better.
Related
I have this image generated thanks to PowerPoint:
We can see here, the image is not pixelated.
But when I import this in Unity 3D, the result is:
Here you can see the sprite's parameters:
Am I using the correct tool for my sprite creation? (PowerPoint)
If the answer is "No", which tool can I use for avoid this kind of problem?
If the answer is "Yes", how can I avoid this pixelization of my sprite in Unity 3D?
Thanks a lot for your help!
PowerPoint is not the best image editor :D But your sprite looks correct, possible you just set small scale in Unity Scene window for it.
Try increasing your sprite Scale in Scene window. Select it, next in Inspector increase X Y Z Scale parameters in Transform component (it should be on top).
I just tried your image in my Unity editor and it seems fine. Make sure your Sprite Renderer transform scale is set to (1,1,1). For me even that seems not to affect the quality but it is a best practice not to have different distorted scales for everything in your scene.
One tip for improving your sprite quality is to export it in a POT resolution. Meaning that the resolution of the image should be divisible with 4. This way Unity will be able to compress the image with a much higher precision and quality. One resolution example of that is 800x800 or 1920x1080 etc.
Make sure your build target is set to Standalone and not other platform. If you are set to Android for example. check the Android specific compression in your sprite import inspector. That might also affect the quality.
To answer your question on what image editor to use, the best one, in my opinion, is Adobe Photoshop. If you don't want to pay for it, just search for any free image editing tool. But stop using PP, I'm not exactly sure how you have come up with that.
So in the configurations of the Lightmapping I have a lot of strange settings and can't quite understand how they work together:
First off texels = pixels, right? So texel is just a fancy name for a
pixel?
Lightmap Resolution in texels per unit. What is unit in this
context? And how does it fit that stuff in the constant Lightmap Size
(let's say 256 texels=pixels)?
What is the difference between Indirect Resolution and Lightmap Resolution? And why I can't adjust Indirect Resolution in Progressive CPU?
Indirect resolution is the fidelity of indirect lighting, light that comes from stuff like a bright surface being lit by the sun. Lightmap resolution is the fidelity of general lighting (basically direct lights)
I'm fairly sure You can't set it in progressive CPU because it'll eventually reach your lightmap resolution anyway. Progressive CPU does a low quality lighting pass as you edit your scene, and over time improves the quality, so you can get a rough idea of your lighting as you edit, but eventually (particularly in areas you aren't playing around in) the lighting will reach your max resolution. It's purely to improve your workflow, so you can edit your scene without waiting for a slow light pass.
I recommend reading the relevant pages:
https://docs.unity3d.com/Manual/ProgressiveLightmapper.html
https://docs.unity3d.com/Manual/Lightmapping.html
Unity's lighting system is powerful, but also quite complex, take your time and read up on the documentation, when I first started working with it I spent a few days just absorbing all the information, there's a lot to take in.
My daydream app is working fine when used slowly. But when I rotate my head too quick it starts giving glitches first and then the app gets crashed. I am guessing it has to do something with frames/sec loaded during high quality objects rendering or something similar. If someone has a solution, please help me out.
Assuming you have no errors in logcat, visual glitches are generally indicative of extremely high per frame GPU load.
It would be good to profile your app and share the crash report - but the only way I've ever been able to actually crash an app this way is with very large textures.
Check the size and number of textures in your scene - it's possible rapid head rotation could be causing a large number of textures to need to be loaded as objects become visible. You can also see a good list of how large the assets are at build time in Unity by inspecting the editor log after a build. This can help make sure you aren't running out of RAM on device.
Make sure you have texture compression and mipmaps enabled on all textures. Disabling mip-maps on minified textures can easily overload the GPU.
Make sure you don't have too much transparency. Adding a lot of overdraw to the scene can overload the GPU.
Follow performance optimization guidelines https://docs.unity3d.com/Manual/OptimizingGraphicsPerformance.html
https://unity3d.com/learn/tutorials/topics/virtual-reality/optimisation-vr-unity
Make sure renderViewportScale is around 0.7, MSAA is at 2x or less, and you aren't using post-process effects, shadows, or any kind of deferred rendering
Stay below 100 draw calls, 200k vertices on screen.
I'm creating an app to show 360 images with Cardboard.
I created a scene in Unity using Cardboard camera and sphere. I mapped 360-image to a sphere texture.
When viewing the texture is low quality and has sawtooths so the details are not good quality.
Any ideas to solve this texture problem? I tried a script which creates a different kind of sphere but it didn't solve the problem.
You need to use an icoshpere for this to work, you'll still gonna get some distortion near the polls, but it's far better than the uv ones that Unity provides.
The second thing is that you'll need a high detail icoshpere for this to work, as you'll need more vertexes.
The third thing is the textures quality and size. I think the default fov for Unity is around 60, but you'll map the texture for a fov of 360, so you'll need textures of higher size compared to the on screen texture you are using.
You can look over this article if you want more details about the differences between icoshperes and uv spheres, or just go to the bottom of the article and download the unity project. The project includes already made icoshperes and you can experiment with them to find out which one is best suited for your project. I'm using the Octahedron Sphere 4 R1. Any less polys and there are too many distortion, any higher one and the fps drops to much.
I have a model with 3 elements, each one has a different texture, when in real time everything looks awesome (both in designed and playing) but if I go and bake my lights I get the ugly mess you can see in the bottom part of the picture.
I'm pretty new to blender/unity. The game is aimed to android phones (google cardboard)
BAKED GI true
Using: Blender 2.7
Unity 5
Backed resolution 1 (increasing doesnt help)
Baked padding 2
Compressed true
Indirect Resolution 2
Ambient occlusion 0
I don't even know what parameters are really helpful here. Can someone help?
Setting Generate Lightmap in the importsettings should solve the problem.