[SOLVED] Manual PVR Convert

Hello,

I would like to convert textures for iOS myself (because texture auto resize isn’t handled by Playcanvas today)
I try many different encoding options with PVRTexTool SDK but I always have a black texture when I test my app
Could you give me exact settings of your PVR conversion format (pixel format, mipmaps options, vertical flip etc.) for have correct settings on PVRTexTool?

Here is my settings window :

Also, oddly, i can’t open your generated .dds PVR texture with PVRTexTool, i have this error :

Looks like when I open my own .dds with Notepad and replace PTC4 by P431 on line 1 it works on Playcanvas , any idea how to have this and what is this? I really need help here

Thanks :slight_smile:

Hi,

What do you mean by texture auto resize not being handled by PlayCanvas - what are you trying to achieve exactly?

I try to have a light version of my app with all textures size divided by 2 (4 for some) in order to keep high quality on desktop but have small pvr texture for iOS version

The PlayCanvas texture compression feature allows you to compress your textures in various encodings and depending on the platform the game is running on it will load the best format for that platform. Is this not adequate for you? You could maybe upload different texture resolutions, compress them using PlayCanvas and then depending on the platform choose which texture to load dynamically.

I tried to bypass the pvrtc compression but I can’t find the exact format you used, all my tries give me a DDS with PTC4 or PTC2 in header, since the Playcanvas compression have P431 or P441 (far alpha I guess) in the DDS header for pvr textures. if I manually change it, it works but it’s a hack, not a solution.

I will try the batch materials assignation with different texture sizes depending of the device during loading instead if I can’t get this solved

Hi!
Autoresize should be doable by uploading original/resized textures and enabling compression for both.Then load the right texture at runtime using scripting, and you don’t need to compress on your own.

We wrap PVR and ETC data with a DDS header, and there are no public tools compatible with such DDS files.
DDS header is like that: https://msdn.microsoft.com/en-us/library/windows/desktop/bb943982(v=vs.85).aspx
They’re 128 bytes describing width/height/mips/format/is it a cubemap/etc. Everything after the header is raw pixel data.
P431 and P441 are put into dwFourCC of the header, and are completely made up markers telling engine that’s texture format is a variation of PVR.

2 Likes

Thanks! that helped me :), still working on my workflow then, thanks for your help

In the configure function (before preload) i do this :

var materials_dyn = app.assets.findByTag("material_dyn");
        for (var i = 0; i < materials_dyn.length; i++) {
            materials_dyn[i].data.diffuseMap = null;
            materials_dyn[i].data.opacityMap = null;
            materials_dyn[i].data.glossMap = null;
            materials_dyn[i].data.normalMap = null;
            materials_dyn[i].data.metalnessMap = null;
        }

but i can still see all textures in my app, did I miss something?

I tried with resource instead of data but no result

You shouldn’t access data - just set textures on the material directly.
Also, calll material.update() after all changes to it are done.

If the app load with high res texture it’s too late for change texture, app is already off memory bounds.
I fixed my problem with a script who scan the config.json file and replace texture id on material, then I load the app with the config_mobile.json and high res texture are totally ignored so it’s ok :slight_smile: