How to load compressed .dds images as collada textures? - webgl

Do you have any idea how could I use compressed .dds images as collada textures?
Which part of the library should be updated to do this?
Any help would be appreciated!

DDS
Three.js can already read in dds files.
just call THREE.ImageUtils.loadCompressedTexture:
https://github.com/mrdoob/three.js/blob/master/src/extras/ImageUtils.js#L39
Collada
This line needs to be updated to detect wether the the file is a dds file or a normal image and use the corresponding method to read that file.
https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/ColladaLoader.js#L3116

Related

glTF models are red in sceneform

So I have some gltf models I generated and have uploaded them to a url to load them at runtime within Sceneform. When I open the models on windows, it looks great, but when I try to place the objects within Sceneform the models become red. I am unsure why this is happening and would appreciate any pointers.
Object opened in 3D Viewer
Object when placed in Sceneform
The jellyfish gltf model example in case those got corrupted somehow: GLTF Model
.bin file is here, however I don't think looking at this will help much: GLTF .bin
Thanks!
I discovered the issue was due to a malformed glTF file. You can use Kronos' glTF online validator at this link.
https://github.khronos.org/glTF-Validator/
In case anyone is having the same issue, make sure the file is not malformed or try using a different file format like GLB.

Modifying JPEG Metadata without Recompressing Image in iOS

I'm trying to use
CGImageSourceCreateWithData
CGImageDestinationCreateWithData
and then
CGImageDestinationAddImageFromSource
but this discards any thumbnails or other embedded information in the original file. What I want to do is read in the file, alter its metadata, and write it out with the alterations only. But I'll settle for reading everything out of it, and putting it back again. Right now a 1.2MB image file gets converted to a 437kB file with the loss of additional data.
Is there something other than CGImage I can use? Can this even be done with the iOS API?
The problem you face is that the structure of the metadata depends upon the specific JPEG file format you are using.
You need to look at CGImageProperties. You're going to have to make sure the properties for your specific file format get copied as well.
What I was looking for was a read-modify-write operation for image files that allowed changes but otherwise maintained unaltered data. I've determined through research and testing that this is not possible in iOS. The closest mechanism available is CGImage processing, but this only allows you to read selected information from a source image (such as image, thumbnail, properties), and then use some of that information (image, properties) to create a new destination file. There's no way to include a thumbnail in the new destination file, and no way to get around recompressing the image.
As of iOS 7 you can use CGImageDestinationCopyImageSource "to modify EXIF and other image metadata in JPEG, PNG, PSD, and TIFF files without recompressing the image data"
https://developer.apple.com/library/archive/qa/qa1895/_index.html

How can I recover PNG images from a .pvr.ccz file?

I have an existing Cocos2D game that uses sprite images taken from a .pvr.ccz file, probably generated by TexturePacker. However, I don't have the original PNG images used to create that file, and I need to make some changes to the images in the game. Are there any tools or techniques that I can use to pull the images out of the .pvr.ccz file, or do I need to write my own tool?
Not possible if they use the encryption option of Texture Packer:
I've added a new feature to TexturePacker which helps you to prevent all this from happening. It's called ContentProtection and simply encrypts the images.
Your app will still be able to decrypt the data, but somebody else is going to have a hard time getting it done.
Source: https://www.codeandweb.com/texturepacker/contentprotection

Why do we need to call jpeg_write_marker() and jpeg_write_header() after jpeg_start_compress() ? [libjpeg]

From my understanding, libjpeg is a library used to compress the image data. I should be able to write the marker metadata without calling jpeg_start_compress() function.
I have 2 questions:
Why doesn't libjpeg allow that?
If I have a source jpeg file (which is already compressed), how can I just modify the metadata details? Is there any flag which I can set to notify the library that we are dealing with compressed images and we just need to modify the metadata details?
Please help.

how separate files from an uncompressed zlib stream

I have buffered a zlib stream in a std:vector.
I have uncompressed programmatically this stream in a new std:vector named "UncompressedZlibStream".
I know that my stream contains multiple files.
I would like to knwo how "cut" (separate) my files in the stream.
I think zlib use a separator ? but why caracter or sequence !?
Anyone have any informations about this ?
Thanks a lot,
best regards,
CrashOverHead
Zlib itself is only a compression library. It is typically only used to compress a single file. Putting multiple files into zlib requires that you use a format like tar and then compress the result. Zlib compressed tar files are pretty common in the Unix world. You may want to have a look at LibTar. If it's anything else it's likely proprietary and you're kind of on your own for how to dice the stream.

Resources