Overdriven RGB values are replaced with V value when importing

Post Reply
User avatar
FierbetoN
Posts: 799
Joined: 22 Mar 2015 12:59
Location: Romania

Overdriven RGB values are replaced with V value when importing

#1 Post by FierbetoN » 18 Jun 2020 19:44

The title pretty much explains it. I made sure I have the latest versions of everything.

Say you have an Env Factor with RGB values of 1.3 (from SCS material), which shows up as V value of 1.121871 (in HSV tab). When importing after converting from game format, the RGB values will be of 1.121871.
Harven
Global moderator
Posts: 1055
Joined: 29 Sep 2016 10:24
Location: 127.0.0.1
Contact:

Re: Overdriven RGB values are replaced with V value when importing

#2 Post by Harven » 19 Jun 2020 11:21

This is not a bug. SCS material files use linear RGB values while blender uses sRGB values (non-linear). If you convert your model with scs_conversion_tools back to the game format, you will notice that your 1.3 value is back in your scs material file.

[edit]
hmmm maybe I misunderstood you, I need to test that :)

[edit 2]
looks like values above 1.0 aren't converted when converting to the game format. So if you set 1.3 env factor in blender it will get converted to 1.3 in the .mat file (should be 1.823259), then when you import using converter_pix it will be converted to 1.12 in blender and when you export that again it will be 1.12 in .mat file (should be 1.3) - so each conversion loop will decrease this value until it gets to (or below) 1.0 - then will stay at that value.

[yet another edit]
So now the question is, should sRGB values above 1.0 be converted to linear when converting to game format (by scs conversion tools), or maybe linear values above 1.0 shouldn't be converter to sRGB when converting from game format (by converter_pix).
User avatar
50keda
SCS Software
Posts: 1702
Joined: 07 Dec 2012 11:59

Re: Overdriven RGB values are replaced with V value when importing

#3 Post by 50keda » 22 Jun 2020 08:58

Did anyone try to just import/export? We need to know if it's a problem of converter_pix or blender tools first.
Harven
Global moderator
Posts: 1055
Joined: 29 Sep 2016 10:24
Location: 127.0.0.1
Contact:

Re: Overdriven RGB values are replaced with V value when importing

#4 Post by Harven » 22 Jun 2020 09:30

Yes I did like I said in my edits ;) when you import a .mat with a color value of 1.3, converter_pix converts it to 1.12 (so it's 1.12 in the .pit file). Then when you export it with blender tools it's still 1.12 in the .pit file. After running conversion tools it stays 1.12 in the final .mat file - so I would say it's conversion tools issue. Blender tools seems to be transparent - it reads 1.12 from the .pit file and writes the same value back to .pit file.
User avatar
50keda
SCS Software
Posts: 1702
Joined: 07 Dec 2012 11:59

Re: Overdriven RGB values are replaced with V value when importing

#5 Post by 50keda » 28 Aug 2020 15:30

Well this is how it's implemented. We convert srgb for 0-1 values. Everything above it, is just remapped value (max value in a color is identified, divide each color channel value by that max value, convert to linear and then multiplied with max value all channels again).
So to get it properly converterPIX should adopt that when converting from binary data (.mat files).
Harven
Global moderator
Posts: 1055
Joined: 29 Sep 2016 10:24
Location: 127.0.0.1
Contact:

Re: Overdriven RGB values are replaced with V value when importing

#6 Post by Harven » 02 Sep 2020 13:03

Thanks! I implemented this change in my fork of converter_pix and now I get proper values:

.pit file generated by blender tools:

Code: Select all

        Attribute {
            Format: FLOAT3
            Tag: "diffuse"
            Value: ( 1.600000023841858 0.30000001192092896 0.6000000238418579 )
        }
        Attribute {
            Format: FLOAT3
            Tag: "specular"
            Value: ( 0.18571430444717407 0.6214286088943481 1.0 )
        }
.mat file generated by conversion tools from the above .pit file:

Code: Select all

	diffuse : { 1.6 , 0.0469486 , 0.185626 }
	specular : { 0.028827 , 0.344133 , 1 }
and .pit file generated by converter_pix from the above .mat file:

Code: Select all

        Attribute {
            Format: FLOAT3
            Tag: "diffuse"
            Value: ( 1.600000  0.300000  0.600000 )
        }
        Attribute {
            Format: FLOAT3
            Tag: "specular"
            Value: ( 0.185714  0.621428  1.000000 )
        }
I will do a pull request to mwl4 as soon as he merges my previous pull request with a fix in ppd conversion.
User avatar
UCD
Posts: 3
Joined: 25 Jan 2019 02:50
Location: Canada
Contact:

Re: Overdriven RGB values are replaced with V value when importing

#7 Post by UCD » 10 Sep 2020 21:17

Damn. I'm glad you guys know what you're doing. Thanks.
Harven
Global moderator
Posts: 1055
Joined: 29 Sep 2016 10:24
Location: 127.0.0.1
Contact:

Re: Overdriven RGB values are replaced with V value when importing

#8 Post by Harven » 11 Sep 2020 10:42

No problem :) mwl4 merged this fix yesterday and compiled a new windows binary so if you're using converter pix wrapper it should be ok now.
Post Reply

Return to “Bugs”

Who is online

Users browsing this forum: No registered users and 5 guests