NearInfinityBrowser / NearInfinity

An Infinity Engine Browser and Editor
https://github.com/NearInfinityBrowser/NearInfinity/wiki
GNU Lesser General Public License v2.1
87 stars 37 forks source link

I have a trouble with area viewer #151

Closed NightBreather closed 1 year ago

NightBreather commented 1 year ago

I am using nearinfinity for android modding when I want to load are files in area viewer. Field is all black I dont know how to fix this issue . I guess it is a memory issue

How to reproduce:

are

NightBreather commented 1 year ago
java.lang.Exception: Pixel format 'ETC2_RGB_A1' not supported
        at org.infinity.resource.graphics.PvrDecoder.decode(Unknown Source)
        at org.infinity.resource.graphics.TisV2Decoder.updateWorkingCanvas(Unknown Source)
        at org.infinity.resource.graphics.TisV2Decoder.renderTile(Unknown Source)
        at org.infinity.resource.graphics.TisV2Decoder.getTile(Unknown Source)
        at org.infinity.resource.are.viewer.TilesetRenderer$Tileset.init(Unknown Source)
        at org.infinity.resource.are.viewer.TilesetRenderer$Tileset.<init>(Unknown Source)
        at org.infinity.resource.are.viewer.TilesetRenderer.initWed(Unknown Source)
        at org.infinity.resource.are.viewer.TilesetRenderer.init(Unknown Source)
        at org.infinity.resource.are.viewer.TilesetRenderer.loadMap(Unknown Source)
        at org.infinity.resource.are.viewer.AreaViewer.setVisualState(Unknown Source)
        at org.infinity.resource.are.viewer.AreaViewer.setHour(Unknown Source)
        at org.infinity.resource.are.viewer.AreaViewer.initGuiSettings(Unknown Source)
        at org.infinity.resource.are.viewer.AreaViewer.init(Unknown Source)
        at org.infinity.resource.are.viewer.AreaViewer.access$000(Unknown Source)
        at org.infinity.resource.are.viewer.AreaViewer$1.doInBackground(Unknown Source)
        at org.infinity.resource.are.viewer.AreaViewer$1.doInBackground(Unknown Source)
        at javax.swing.SwingWorker$1.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at javax.swing.SwingWorker.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)java.lang.Exception: Pixel format 'ETC2_RGB_A1' not supported
        at org.infinity.resource.graphics.PvrDecoder.decode(Unknown Source)
        at org.infinity.resource.graphics.TisV2Decoder.updateWorkingCanvas(Unknown Source)
        at org.infinity.resource.graphics.TisV2Decoder.renderTile(Unknown Source)
        at org.infinity.resource.graphics.TisV2Decoder.getTile(Unknown Source)
        at org.infinity.resource.are.viewer.TilesetRenderer$Tileset.init(Unknown Source)
        at org.infinity.resource.are.viewer.TilesetRenderer$Tileset.<init>(Unknown Source)
        at org.infinity.resource.are.viewer.TilesetRenderer.initWed(Unknown Source)
        at org.infinity.resource.are.viewer.TilesetRenderer.init(Unknown Source)
        at org.infinity.resource.are.viewer.TilesetRenderer.loadMap(Unknown Source)
        at org.infinity.resource.are.viewer.AreaViewer.setVisualState(Unknown Source)
        at org.infinity.resource.are.viewer.AreaViewer.setHour(Unknown Source)
        at org.infinity.resource.are.viewer.AreaViewer.initGuiSettings(Unknown Source)
        at org.infinity.resource.are.viewer.AreaViewer.init(Unknown Source)
        at org.infinity.resource.are.viewer.AreaViewer.access$000(Unknown Source)
        at org.infinity.resource.are.viewer.AreaViewer$1.doInBackground(Unknown Source)
        at org.infinity.resource.are.viewer.AreaViewer$1.doInBackground(Unknown Source)
        at javax.swing.SwingWorker$1.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at javax.swing.SwingWorker.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
lynxlynxlynx commented 1 year ago

Yeah, as expected, a different type of DXT compression. The decompression is not supported yet.

NightBreather commented 1 year ago

how to fix this issue

lynxlynxlynx commented 1 year ago

If you can't code or find someone that can for you, then you can't fix it — it's a missing feature.

NightBreather commented 1 year ago

I can actually write code, but I can't say I know how to use java. I can say that I mostly use c# and python (especially recently python).

lynxlynxlynx commented 1 year ago

Language shouldn't be an issue, but if you haven't done any graphics yet, it could be hard for you. You can look at the code here: https://github.com/NearInfinityBrowser/NearInfinity/blob/devel/src/org/infinity/resource/graphics/PvrDecoder.java (PixelFormat, SupportedFormat and the various decoders for them)

Argent77 commented 1 year ago

Yes, as @lynxlynxlynx pointed out, this particular texture format isn't supported by NI. (Afaik) there is no ETC2 decoding library available for Java, which is the reason why it hasn't been implemented yet. NI currently supports DXT1, DXT5 and several PVRTC variants.

You'd have to use the desktop version of the game if you want to view areas in NI.

Alternatively you can download PVRTexTool from here: https://developer.imaginationtech.com/downloads/ It comes with a command line converter (PVRTexToolCLI) which can be used to batch-convert files between different texture encoding types. All you need is a way to decompress PVRZ to PVR, and back to PVRZ.

I'd suggest to get the PC versions of the game though, to spare you the headache of the conversion process. The games are very cheap nowadays when they are on sale.

NightBreather commented 1 year ago

Will a mod I designed for the pc version works on android?

Argent77 commented 1 year ago

Most likely, yes. I'd suggest to browse through these topics on the Beamdog forums which provide some help with this task:

The latter topic also provides a link to a mod I wrote several years ago, which automates conversion of tilesets to the right texture format for iOS and Android versions of the games.

NightBreather commented 1 year ago

Thanks for all help

Argent77 commented 1 year ago

ETC2 texture decoding will be available with the next NI release (Argent77@fdabee34f02c591942deb2b4d6f51f209125aacf).

NightBreather commented 1 year ago

you are a the best