Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


KW X-port, specular always 0.9?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 cozzie   Members   -  Reputation: 1657

Like
0Likes
Like

Posted 02 November 2013 - 10:58 AM

Hi,

I've just replaced using Pandasoft X exporter by KW X-port, which for sure works better for complex scenes (in my case).

What I don't understand is that when I export a material with specular level = 0, it Always export RGB 0.9 / 0.9 / 0.9 as specular color.

 

For now I've fixed this by setting materials without specular reflection to 1 (scale 1 - 100) and only send float arrays to the shader if the R, G or B is higher then 0,01.

 

Does someone know how to solve this?

Any help appreciated.

 



Sponsor:

#2 belfegor   Crossbones+   -  Reputation: 2690

Like
0Likes
Like

Posted 02 November 2013 - 11:52 AM

You are aware that "Specular level" and "Specular color" are different things?

Exporters probably export "Specular color" only, not taking "level" into account.

If you export max material as DX shader you can see how it is composed (0.9,0.9,0.9 is default specular color i change it to full white 1,1,1):

 

defaultshader.jpg

 

 

I'd recommend writing your own exporter and format so you have full control and whatever you wish to be exported.



#3 cozzie   Members   -  Reputation: 1657

Like
1Likes
Like

Posted 02 November 2013 - 05:21 PM

Hi Belfegor,

Thanks.

 

I've did some tests to see what 'comes out of max'.

 

1st test:

test1.jpg

 

Gives me:

 

   Material floor {
    0.588235;0.588235;0.588235;1.000000;;
    9.999999;
    0.447059;0.419608;0.815686;;
    0.000000;0.000000;0.000000;;

    TextureFilename Diffuse {
     "america001.jpg";

 

2nd test:

test2.jpg

 

Gives:

 

   Material floor {
    0.588235;0.588235;0.588235;1.000000;;
    9.999999;
    1.000000;1.000000;1.000000;;
    0.000000;0.000000;0.000000;;

    TextureFilename Diffuse {
     "america001.jpg";

 

Test 3:

test3.jpg

 

Gives:

 

   Material floor {
    0.588235;0.588235;0.588235;1.000000;;
    9.999999;
    0.020000;0.020000;0.020000;;
    0.000000;0.000000;0.000000;;

    TextureFilename Diffuse {
     "america001.jpg";

 

From this I conclude (just now though....) that the selected specular color, is what's in my output (see test 2 with the blue).

 

At the moment I only apply specular lighting when specular color R, G or B is > 0.0.

When I have a specular level other then 0, then the RGB seems to be divided by the level.
Test 3:

 

1,0 1,0 1,0 = white

2 = specular level

 

result = 0.02, 0.02, 0.02

 

I have to think of a good way to find out when a material 'has' specular reflections and when not.

Maybe I should use the power or RGB values, although power says more about the 'size' of the reflection.



#4 hplus0603   Moderators   -  Reputation: 5537

Like
1Likes
Like

Posted 02 November 2013 - 11:19 PM

I put the code on github if you want to read it: git@github.com:jwatte/kwxport

 

Here's how it calculates the specular color:

 

        matProp = theMat->GetSpecularData();
        if (!matProp) goto not_stdmat;
        matProp->GetPropertyValue(p3);
        type = matProp->GetType();
        assert(type == IGAME_POINT3_PROP);
        matProp = theMat->GetSpecularLevelData();
        if (!matProp) goto not_stdmat;
        matProp->GetPropertyValue(f);
        if (f > 0) {
          p3.x = f; p3.y = f; p3.z = f;
        }

 

 

Translation: If the specular level is 0, use the specular color, else use the specular level as grayscale. This is likely because 3ds Max has both grayscale and color options for the properties.

You could probably change it to multiply specular color with specular level instead. (Note that specular level "2" in Max comes out as "0.02" inside the application -- the UI multiplies by 100.)


Edited by hplus0603, 02 November 2013 - 11:23 PM.

enum Bool { True, False, FileNotFound };

#5 cozzie   Members   -  Reputation: 1657

Like
0Likes
Like

Posted 03 November 2013 - 05:58 AM

Thanks hplusplus, that really helps.

So now it's either one of them:

 

A. you select a level, and that comes out Always, as grayscale

B. you keep level to 0 and select a color, then that comes out (without a 'level')

 

What you suggest sounds like a perfect option for me:

 

A. Always export selected color multiplied by level

 

Is it a possibility that you release a version 1.5.1 with this as a checkbox option? smile.png

 

Ps.; other then this the exporter works quite nice. Before I was using panda, but that got messy for my larger scene, normals we're being screwed up somehow, affecting my lighting terribly. That problem's completely gone now with your exporter.


Edited by cozzie, 03 November 2013 - 06:00 AM.


#6 cozzie   Members   -  Reputation: 1657

Like
0Likes
Like

Posted 06 November 2013 - 01:37 PM

@Hplusplus: do you see possibilities?




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS