Sign in to follow this  

KW X-port, specular always 0.9?

This topic is 1532 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

This topic is 1532 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this