smcameron / space-nerds-in-space

Multi-player spaceship bridge simulator game. Captain your starship through adventures with your friends. See https://smcameron.github.io/space-nerds-in-space
GNU General Public License v2.0
723 stars 73 forks source link

iCCP: known incorrect sRGB profile #318

Closed WASasquatch closed 1 year ago

WASasquatch commented 2 years ago

Is this warning anything to worry about? I am trying to Cloud Mode -C parameter.

As a side note, what OS do you use for Linux? Is it available for WSL?

../gaseous-giganticus --noise-scale 1.5 --velocity-factor 8000 --bands 12 --count 500 --particles 64000000 -C --input ../Input/Sample15.png -o 9/gas1_
Using 12 threads for particle motion
Allocating output image space
Loading image
libpng warning: iCCP: known incorrect sRGB profile
width, height, bytes per row = 38,1024,152
Initializing 64000000 particles
Calculating velocity field
WASasquatch commented 2 years ago

I am not sure if it's working correctly. I see a perlin like effect, but it doesn't seem to be changing, and then there is a faint overlay of the particles.

Screenshot_40

smcameron commented 2 years ago

I've never seen that warning before. Here's a stackoverflow question about it that might shed some light:

https://stackoverflow.com/questions/22745076/libpng-warning-iccp-known-incorrect-srgb-profile

I'm using Mint just because I like the Xfce window manager better than Ubuntu's window manager, but it really doesn't matter too much which linux you use. I like the debian based ones better than the SuSE or Redhat based ones just because I'm more familiar with the package manager, "apt", as compared to SuSE's "zypper" or Redhat's "yum". I used to use Fedora prior to about 2007 or so, then switched to Ubuntu for awhile, then switched to Mint after Ubuntu wrecked their window manager. Don't know about running mint under windows WSL... google it, I guess. But really, it doesn't matter much which distro you run, esp. if you're not running the linux window manager anyway, which I think under WSL, most people don't run the linux window manager.

smcameron commented 2 years ago

What image did you feed it?

Run "file" on the image and see what it says, e.g.:

$ file ~/jupiter-segment.png 
/home/scameron/jupiter-segment.png: PNG image data, 324 x 1971, 8-bit/color RGB, non-interlaced
smcameron commented 2 years ago

BTW, in future, you might want to open these issues on the gaseous-giganticus project instead of space-nerds-in-space. (Not that it really matters much.)

smcameron commented 2 years ago

Oh, I just noticed you said you're using cloud mode. That was an experiment, and now I do not even really remember what it does.

I think I was trying to generate an earth-like cloud layer for use in superimposing on top of earth-like planets. But eventually I found another way. So I haven't used cloud mode since probably 2014 or so, and I don't really remember what it's supposed to do. What I ended up doing for clouds is described in here: https://github.com/smcameron/space-nerds-in-space/blob/master/doc/howto-generate-earthlike-planets.txt

smcameron commented 2 years ago

I think here are some images of early earthlike planets using clouds from this cloud mode thing: 1, 2

The newer method produces things like this: 1, 2

WASasquatch commented 2 years ago

I am testing the sample image from the KSP forum https://i.imgur.com/pADA9Vy.png), I am trying to see how the default command he used differs in shapes from mine. Because I'm still having issues with my 4th iteration (bringing in back larger details) muddling all the smaller scale stuff until it basically doesn't matter, even when I do -I 5 to catch it early on.

But i came across the cloud paramater and was just curious. But it happens in my original simulation without it, so it must be the image itself. All my others are saved from my Photoshop as exported quick PNGs so I haven't noticed anything. This is the only one just downloaded and used.

Also sorry for posting this in the wrong project. I actually just noticed that when I went to check on a reply.

Off-Topic: You've given me actually a very good idea. If I can figure out how to make a Equirectangular map into a cube map, I can use that in conjunction with -k command on some exported global Terragen clouds. They produce very realistic clouds, but the only issue is, there is no global turbulence, no weather patterns, etc, and XYZ simple push/warping can't achieve it. However, Gaseous Giganticus can! I think you have given me the idea to finally achieve realistic global weather patterns. At least for still images.

Take this example from my Mars project. It looks fairly decent for global cloud coverage, but you'll immediately notice the warping doesn't provide realistic weather patterns. 4096 x 2048 - Global Cloud Map A3

smcameron commented 2 years ago

If I can figure out how to make a Equirectangular map into a cube map

I have a program for that, in here: https://github.com/smcameron/space-nerds-in-space/tree/master/util/EquirectangularToCubic

Type "make help" to see how to use it:

scameron@wombat ~/github/space-nerds-in-space/util/EquirectangularToCubic $ make help
java -jar EquirectangularToCubic.jar -h

Generate six cubemap images which represent the six orthogonal directions of
a sphere using a Gnomonic Projection with 90 degree field of view.  The input
file is a Cylindrical Equidistant Projection with a 2:1 width to height ratio.
The six cubemap images are in Space Nerds in Space numbering format:

  +------+
  |  4   |
  |      |
  +------+------+------+------+
  |  0   |  1   |  2   |  3   |
  |      |      |      |      |
  +------+------+------+------+
  |  5   |
  |      |
  +------+

java -jar EquirectangularToCubic.jar [options] <input_image>

Options:
  -verbose         extra info output
  -debug           extra debug output
  -outputdir       directory to put generated cubemap images
  -overlap         pixels to overlap cubemap images
  -interpolation   pixel sampling method ()
  -quality         0.0 - 1.0, jpeg compression level
  -width           height and width of generated cubemap images

Invalid command: No input files given
WASasquatch commented 2 years ago

Oh thank god. I found convert360 for Python but python is all sorts of messed up on this Ubuntu build. It's an older one, but the biggest issue is anything isntalled can't be ran from it's commands. No clue why. Always unrecognized.

WASasquatch commented 2 years ago

I am getting the following running the command

was@SKYNET-MASTER:/mnt/d/linux/gas/space/util/EquirectangularToCubic$ java -jar ./EquirectangularToCubic.java -quality 1.0 -width 4096 ../../../Gaseous/Input/Cubemaps/global_clouds_1.png
Error: Invalid or corrupt jarfile ./EquirectangularToCubic.java

Running Open JRE 11.

I double-checked the file itself and redownloaded the project.

smcameron commented 2 years ago

Try "make clean; make" You have to compile the java file to make the jar file.

WASasquatch commented 2 years ago

Ah, probably cause I just installed OpenJRE so initial compilation couldn't compile the Java. It's recompiling now.

smcameron commented 2 years ago

You'll have to install the java compiler too... I don't really remember how to do that.

Maybe "apt-cache search jre" will give some hints. Will probably need to google how to do it for your distro, I guess.

WASasquatch commented 2 years ago

Since Ubuntu simplified things a little finally I think it's the default-jdk build which is mentioned when I installed default-jre.

These packages supposedly have the most stable and secure versions for Ubuntu.

This package is specifically installing openjdk-11, where openjre-11 was installed with default-jre

WASasquatch commented 2 years ago

The java compiler gives me a lot of garbage

Errors removed as unrelated to code

WASasquatch commented 2 years ago

Hmm. Somehow the file itself is just messed up. Partially HTML it looks like. Cloning the repo again. Looks like it got accessed by something that tried to parse it as a web page. Very strange.

WASasquatch commented 2 years ago

Yep. It compiled fine this time around. Still now sure how files became parsed into HTML.

smcameron commented 2 years ago

Eh, I dunno, I haven't used this thing in awhile.

I get a few warnings, but it does compile for me:

cameron@wombat ~/github/space-nerds-in-space/util/EquirectangularToCubic $ make
javac *.java
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/Equi2Rect.java:126: warning: Unnecessary cast from int to double
    double d1 = 1.0 / (double) NSQRT;
                      ^^^^^^^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/Equi2Rect.java:136: warning: Unnecessary cast from int to double
    d1 = 1.0 / (double) NATAN;
               ^^^^^^^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/Equi2Rect.java:155: warning: Unnecessary cast from int to double
    double dist_e = (double) i / 6.2831853071795862D;
                    ^^^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/Equi2Rect.java:201: warning: Unnecessary cast from int to double
    double p = (double) vw / (2D * Math.tan(a / 2D));
               ^^^^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/Equi2Rect.java:396: warning: The value of the local variable x_center is not used
    int x_center, y_center, x_tmp;
        ^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/Equi2Rect.java:396: warning: The value of the local variable y_center is not used
    int x_center, y_center, x_tmp;
                  ^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/Equi2Rect.java:396: warning: The value of the local variable x_tmp is not used
    int x_center, y_center, x_tmp;
                            ^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/EquirectangularToCubic.java:14: warning: The import java.io.FileOutputStream is never used
    import java.io.FileOutputStream;
           ^^^^^^^^^^^^^^^^^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/EquirectangularToCubic.java:15: warning: The import java.io.PrintStream is never used
    import java.io.PrintStream;
           ^^^^^^^^^^^^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/EquirectangularToCubic.java:21: warning: The import java.awt.Graphics2D is never used
    import java.awt.Graphics2D;
           ^^^^^^^^^^^^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/EquirectangularToCubic.java:22: warning: The import java.awt.RenderingHints is never used
    import java.awt.RenderingHints;
           ^^^^^^^^^^^^^^^^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/EquirectangularToCubic.java:110: warning: The enum constant INPUTFILE needs a corresponding case label in this enum switch on EquirectangularToCubic.CmdParseState
    switch (state) {
            ^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/EquirectangularToCubic.java:191: warning: List is a raw type. References to generic type List<E> should be parameterized
    java.util.List fileList = java.util.Arrays.asList(files);
    ^^^^^^^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/EquirectangularToCubic.java:192: warning: Iterator is a raw type. References to generic type Iterator<E> should be parameterized
    for(java.util.Iterator itr = fileList.iterator(); itr.hasNext();){
        ^^^^^^^^^^^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/EquirectangularToCubic.java:194: warning: Unnecessary cast from File to File
    inputFiles.add( (File) f);
                    ^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/EquirectangularToCubic.java:218: warning: The value of the local variable pathWithoutExtension is not used
    String pathWithoutExtension = outputDir + File.separator + nameWithoutExtension;
           ^^^^^^^^^^^^^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/EquirectangularToCubic.java:235: warning: Unnecessary cast from BufferedImage to Image
    new ImageTo2DIntArrayExtractor (equiData, (Image) equi).doit();
                                              ^^^^^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/EquirectangularToCubic.java:323: warning: The method deleteDir(File) from the type EquirectangularToCubic is never used locally
    private static void deleteDir(File dir) throws IOException {
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/EquirectangularToCubic.java:387: warning: The value of the parameter quality is not used
    private static void saveImageAtQuality( BufferedImage img, String path, float quality) throws IOException {
                                                                                  ^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/EquirectangularToCubic.java:389: warning: Iterator is a raw type. References to generic type Iterator<E> should be parameterized
    Iterator iter = ImageIO.getImageWritersByFormatName("png");
    ^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/EquirectangularToCubic.java:415: warning: Unnecessary cast from String to String
    String ext = (String) itr.next();
                 ^^^^^^^^^^^^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/ImageTo2DIntArrayExtractor.java:35: warning: The constructor ImageTo2DIntArrayExtractor() is never used locally
    private ImageTo2DIntArrayExtractor() {
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/ImageTo2DIntArrayExtractor.java:77: warning: Hashtable is a raw type. References to generic type Hashtable<K,V> should be parameterized
    public synchronized void setProperties(Hashtable props){ // safely ignore this
                                           ^^^^^^^^^
/home/scameron/github/space-nerds-in-space/util/EquirectangularToCubic/ImageTo2DIntArrayExtractor.java:105: warning: The value of the local variable iyp is not used
    int iyp = iy+myYoffset;
        ^^^
24 problems (24 warnings)
jar cvmf MANIFEST.MF EquirectangularToCubic.jar *.class
adding: Equi2Rect.class (in=9,532) (out=9,532) (stored 38%)
adding: EquirectangularToCubic$CmdParseState.class (in=1,336) (out=1,336) (stored 48%)
adding: EquirectangularToCubic.class (in=10,356) (out=10,356) (stored 47%)
adding: FileListFilter.class (in=1,063) (out=1,063) (stored 43%)
adding: ImageTo2DIntArrayExtractor.class (in=2,049) (out=2,049) (stored 45%)

And I can run it...

scameron@wombat ~/github/space-nerds-in-space/util/EquirectangularToCubic $ java -jar EquirectangularToCubic.jar 
Invalid command: No input files given

So I grabbed this image: https://www.richleighton.com/wp-content/uploads/2018/04/BigBendNationalPark2016-1.jpg

Cropped a section in gimp, scaled it to be square, made it seamless (filters->map->make seamless), scaled it to be twice as wide as high, to make this image:

bbseamless

Which I then ran through EquirectangularToCubic like so:

scameron@wombat ~/github/space-nerds-in-space/util/EquirectangularToCubic $ java -jar EquirectangularToCubic.jar -width 1024 -outputdir xxx ~/bbseamless.jpg 
scameron@wombat ~/github/space-nerds-in-space/util/EquirectangularToCubic $ ls xxx
bbseamless-0.png  bbseamless-1.png  bbseamless-2.png  bbseamless-3.png  bbseamless-4.png  bbseamless-5.png

Which looks like this on a sphere:

bbseamless-sphere

So... works for me? Maybe they broke java as they improved it and you need an old java compiler?

WASasquatch commented 2 years ago

After I redownloaded the repo with git it worked fine. I am not sure how HTML got introduced into the java files. That just straight puzzles me. But it's all working now.

Does it matter what resolution the input is? I mean like can it be way bigger than my output width/height? Will it scale down?

smcameron commented 2 years ago

I don't know, give it a try. I didn't write this program by the way, my friend Jeremy @jv4779 got it from somewhere...

Top of the file says:

/*
Copyright 2009 Zephyr Renner
This file is part of EquirectangulartoCubic.java.
EquirectangulartoCubic is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License ...

But googling isn't turning up a whole lot more about the origins of this thing.

WASasquatch commented 2 years ago

It's the best tool for me considering it outputs the maps just like I need them (order wise). The only thing I wish Gaseous Giganticus had was a rotation feature or something. I haven't looked at the code yet, but it would be nice if the poles were the "Up and Down" maps rather than front and back. Most maps are where poles are on the top and bottom of the equirectangular map. So when I convert them, Gaseous Giganticus wants to warp the poles as faces. So I gotta add a third step in conversion and map the texture to a sphere, rotate, and export it as a 360 panoramic (equirectangular map) with the poles at the face/back.

On Sat, Dec 11, 2021 at 2:45 PM smcameron @.***> wrote:

I don't know, give it a try. I didn't write this program by the way, my friend Jeremy got it from somewhere...

Top of the file says:

/* Copyright 2009 Zephyr Renner This file is part of EquirectangulartoCubic.java. EquirectangulartoCubic is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License ...

But googling isn't turning up a whole lot more about the origins of this thing.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/smcameron/space-nerds-in-space/issues/318#issuecomment-991799650, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIZEZN5PLOZ7JTWOXPOUHDUQPH63ANCNFSM5J3J4VWA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- Sincerely, Jordan S. C. Thompson

smcameron commented 2 years ago

That's what this script is for: https://github.com/smcameron/space-nerds-in-space/blob/master/util/turn-cubemap-about-axis

gaseous-giganticus wasn't meant as a general purpose tool, I only made it so I could have gas giants in space-nerds-in-space. Sorry it doesn't fit exactly your needs. You can have your money back if you don't like it, I guess. :)

And it's open source, you can modify it to make it do whatever you want it to do.

I think the "--vertical-stripes" option essentially does such a rotation -- whether it's exactly the rotation you want, probably not. Odds are about 5 out of 6 that it's not.

WASasquatch commented 2 years ago

Oh! I should have seen that! I was looking over some of the tools in there.

And I don't mean to complain, it was just something I noticed. It's funny cause the idea I had in my head for a parameter would work just like your script, and you just feed it an axis. I'll need to brush up on C language though lol. Haven't done anything in it since high school.