mesh simplified but what about textures? - png

I am new to MeshLab. I have simplified a mesh created in Meshroom but the png textures now take a disproportionate amount of disk space and I cannot upload the model (stl and pngs) to Sketchfab as a result. I tried saving the textures as jpegs in Photoshop and changing the filenames in the stl export dialog but Sketchfab gives me a white model. Is there an easy way to achieve what I am trying to do?

Related

MTKTextureLoader causing banding in grayscale image

I'm trying to implement a simple LUT color grade in a metal shader. It works with a color LUT, but when the LUT is grayscale, problems crop up. First, loading the grayscale image causes an "image decoding failed" error, which is fixed with this bug workaround.
By recharacterizing the image as a texture in the asset bundle, it loads successfully, but there's banding on the output image. Sure enough, capturing a GPU frame shows that banding has been introduced in the texture:
This banding doesn't appear when doing a Quick Look in the asset bundle, or on the source PNG. Inspecting the texture's pixel format shows that it's been encoded as ASTC_4x4_sRGB, which Apple documentation states is a compressed format for low-dynamic range content. It seems as though this compression may be responsible for degrading the LUT texture. Normally when working with LUTs, I take care to avoid any compression, but I can't find a way to disable compression or force a pixel format in MTKTextureLoader.
I've also tried various MTKTextureLoader options, including enabling/disabling sRGB, mipmaps, etc.
Any ideas on how to fix the banding?
It's important to understand that when using MTKTextureLoader with texture assets in an asset catalog, most runtime texture loader options are ignored. This may not be documented, but it is currently the case.
You may be able to avoid this automatic compression (which is well-intentioned but both clumsy and too aggressive) by selecting your asset in the Xcode asset catalog editor and setting its Pixel Format explicitly to something like "8 Bit Normalized - RGBA", which maps to .rgba8Unorm at runtime.

PNG file looks completely different inside of Unity

I purchased the "Set Builder: Back street Manhattan" with came with some png textures such as this one.
When I open the file in the browser or any editing program, it looks completely transparent except for the windows. When I drag the image into Unity, it is completely opaque bricks (which is what I want) If I duplicate the image and drag that image into Unity, it is again completely opaque bricks. If I save a copy of the image with photoshop or another application, the information that contained the bricks is lost and it is now mostly transparent, except it has some blotchy white textures which also aren't seen in the photoshop interpretation. Every texture in this folder is doing this same behavior. Are these files corrupted or compressed? How do I retain the brick information into an image editing program besides taking a screenshot within Unity ? Here is an example : of dragging images onto cubes in Unity. Left is a Photoshop copy. Right is attached image
The developer has not replied to my direct questions.
it can be your texture import format
try changing its format to true color
I found a solution in Photoshop.
Layer>layer mask>from transparency. Then right click on the layer to disable the transparency.

Unity3d - How to do transparency images?

I have a unity application. When the user hover on the object, I want to change mouse image.So, I want to know how to make part of image transparent in unity3d? If I use directly .png image, the mouse looks like below image :
I don't want to show gray area. How can I do?
An image file can be saved with a crowd of formats. For your arrow can have transparent areas you should save it in a format that handles the so-called "alpha channel". This channel stores information about the degree of transparency (from 0% to 100%) of all and each of the pixels. Simple programs like Windows Paint eliminate this channel. I recommend you use "Gymp", is the one I use (It's free)
If you don't have that problem. Be sure you have selected the correct Shader Type. Not all the shaders are ready to transparency. I recomend you to use the "transparent Cutout" for 3D Objects:
And "Sprite (2d and UI)" for 2D Objects:
In Unity, in the asset explorer, if you click on your .png image, you should be able to select the texture type. It is definitely possible to have textures with transparency.
You should also simple check that you saved your png image with transparency
Transparency shows black when using a non transparent shader so that is not your case. Your image seems to be a jpg so it has no transparency (RGB only).
Unity does not use jpg and converts them to png but as the original has no transparency anyway, it is white pixels in the original and white pixels in the png conversion.
You need to rework the image in Gimp or Photoshop to remove the useless grey parts and make sure you save it as png so the transparency is stored (RGBA).
This is an old question but I guess people could like a more modern solution for most recent Unity versions (like I did).
Unity now supports Shaders Graphs, which means you can create a shader that gives transparency to a selected color in an image that normaly wouldn't have an alpha channel (like jpg or gif).
Sure if you are creating the image just make a .png with alpha channel, but sometimes free assets need a little tweak (as you didn't create them):
Make sure you installed a render pipeline that supports the shader graph (Window -> Package Manager -> Lightweight RP)
Create a render pipeline in your project (Create -> Rendering -> UniversalRenderPipeline -> Forward Render)
Make it active (Edit-> Project Settings -> Graphics -> Scriptable Render Pipeline Settings (select the one you created)
Create a new shader (Create -> Shader -> Unlit Graph), I created this one with good results:
Create a material, so we can actually use this shader in sprites (Create -> Material)
Configure the material to use the new created shader (with material selected, Shader Graphs -> [your shader name]
And voila!
I'm new to this shader graph thing but it looks really, really promising.
If everything went well you'll end up with a material like this:

Loading in a tileset with c#?

I've got a very large tileset with over 200 different 64x64 tiles. It would be practical to load them in a C# script, I've tried the following (for-loop):
tileset[x] = Resources.Load<Sprite>("Sprites/Tileset/Tileset_" + x);
Where in my asset folder, Sprites is the folder where Tileset.png is. Tileset.png is sliced in a grid (64x64) in I see Unity has sliced all the tiles correctly.
Is there a way I can load them, and put them in a Sprite array (Sprite[]) in code? What would be the correct path?
Looking for correctness? Then batching is caring...
If loaded individually, each tile will cost you a draw call. I would recommend that you look at creating spritesheets to batch the loading and rendering or these tiles. We have been using TexturePacker to load images for our apps and displaying 200+ images at once with one load call, one draw call and great performance. Alongside the app to create the spritesheets, there's a Unity Plugin on the asset store to load and manage them.
Note: we use the pro version.
Otherwise you can just load all the resources at a given path with Resources.LoadAll

How do I convert .pvr (PVRTC) files to .png in iphone?

I need to convert some images from pvr to a png, in run-time in iphone. I need to read them, decompress, transform some colors and then save then to pvr again or png. Any advice ?
This is apple example program that shows you how to load PVR texture files using the included PVRTexture class and then display them using OpenGL.
Do you specifically mean compressed PVRTC textures or any of the formats (e.g. 565, 1555) supported under the PVR? Also, what sort of transformations did you want to do to the colours?
The reason I ask is that, IIRC, there is code to read/manipulate PVR files on the Imagination Technologies dev web pages but if you want to change the colours of PVRTC compressed textures without actually recompressing the data entirely, there will be limits to what you can achieve. Certainly, changing the hue of regions etc will be possible, but manipulating individual pixels is likely to be too difficult.