Gradient alpha channel transparency question

Discussion in 'Track Modding' started by Jorgen, Sep 26, 2012.

  1. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    While converting an rF1 track to rF2 I have bumped into a problem with an object that simulates glow around a light source. It uses a DDS (DX5) texture with an alpha channel going from black to white in a gradient/circular fashion, with a star-type flare in the middle. This looks good in rF1 while in rF2 the whole circle becomes solid until it reaches the fully white part of the alpha channel. Only then does the transparency kick in. (Not sure if that made sense, if you want more info, I can post some screenshots)

    I suppose this can easily be done in rF2 too, but how would you set up the material? Or does the texture need changes? Any help would be much appreciated. :)
     
  2. ethone

    ethone Registered

    Joined:
    Nov 30, 2011
    Messages:
    1,153
    Likes Received:
    37
    Have you accidentally set it to also use chroma key transparency?
     
  3. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    No, I don't think so. It says Src Alpha/Inverted Src Alpha/Alpha Blending Transparency in the material edit pane. Shader is a t1 at the moment.
     
    Last edited by a moderator: Sep 26, 2012
  4. ethone

    ethone Registered

    Joined:
    Nov 30, 2011
    Messages:
    1,153
    Likes Received:
    37
    In the texture stage do you have "Chroma Color" ticked?
     
  5. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    Sorry, I forgot to write that I'm working in the new 3DSimED beta, not in 3DS Max since I don't have the original track source, just the packaged rF1 track, which is a conversion to begin with. This might of course be an issue with 3DSimED itself though, but it seems to have gotten almost everything else converted to rF2 in the first place, except for this material.
     
  6. mianiak

    mianiak Registered

    Joined:
    Oct 5, 2010
    Messages:
    691
    Likes Received:
    46
    Use the no shadow shader.
     
  7. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    Thanks Mianiak, I just tried that but unfortunately it didn't help. Here's the difference in in-game rendering:

    [​IMG]

    As you can see there's a pretty big difference. It's almost as if the alpha transparency becomes chroma anyway, since it is somewhat transparent all the way from the center until the alpha becomes full white, and then the full transparency kicks in. I wonder if this is a 3DSimED issue or an rF2 issue, or a combination?
     
  8. blakboks

    blakboks Registered

    Joined:
    Oct 20, 2010
    Messages:
    843
    Likes Received:
    30
    Do you have bloom turned on at all?
     
  9. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    The screenshot is from the game, not from devmode. I don't think bloom is available outside devmode, is it? If it is, how do you control it?
     
  10. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    Does anyone have any ideas? ISI? Or perhaps these type of objects need to be re-done in a new way?
     
  11. Oleg

    Oleg Registered

    Joined:
    Sep 19, 2012
    Messages:
    20
    Likes Received:
    0
    looks like alpha blending is ok, but overal computations are different in rf1 shaders and rf2 shaders. HDR posteffects could be the case too.

    Try messing with material settings. Change ambient to black, change emissive to bright gray (there is probably emissive alpha/strength value too, right?). then try to paint texture alpha darker to see whether it makes any clue on final ingame renders.
     
  12. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    Yeah, it could be that your object is receiving some lighting. All lightflare objects should be done with black ambient / diffuse / specular and white emissive color.
    rF1 clamped lighting to white, so this error in material settings could go unnoticed, while rF2 properly adds all lighting and can produce brighter objects for HDR.
     
  13. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    Thanks for the ideas! I'll report back once I have tested them.
     
  14. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    And if that doesn't help make sure your flare doesn't receive lighting from nearby omnilight. I assume you have one placed there.

    We can clearily see that blending works, but either object is just brighter or blending is "stronger".
     
  15. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    Nothing seems to work unfortunately. What I did notice though, is that the texture is a DXT5 (interpolated alpha) and if I look at the alpha channel, it's white at the edges and then there are 15 very distinct rings of progressively darker gray towards the center, along with the flare in the center. (alpha has 16 unique colors) I tried various shaders for the flare too, like "t1 no light", "t1 no shadow" etc, but none of them work any better.

    I do have plenty of omni light sources in the track. How would I prevent the light from those hitting the flares?
     
  16. ethone

    ethone Registered

    Joined:
    Nov 30, 2011
    Messages:
    1,153
    Likes Received:
    37
    Were you using the exact same .dds file for your rF1/rF2 comparison above?

    If you weren't, perhaps the newer rF2 texture was saved with an erroneous setting in the dds exporter? Particularly Compression Quality (under Image Options) can screw texture quality up.

    To avoid your flares being "hit" by omni lighting, don't tag the .gmt that contains them as an omni receiver. T1 No Light would also make your flare not receive any of the normal rF lighting.
     
  17. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    I tried exporting one of the objects with the "Lit at night" property off, and this is what happened:

    [​IMG]

    The rig itself is black, as expected, but not the flare. I wonder if this could actually be a bug, or if it's still a bad combination of properties on the object?

    @Ethone: It's the exact same texture in all screenshots.
     
    Last edited by a moderator: Sep 30, 2012
  18. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    Try using this tool on your GMT file and paste material settings it exported for your flare here.
    The tool will not alter your GMT file - it will just create and XML file with all materials found in GMT files in current directory.
     
  19. mianiak

    mianiak Registered

    Joined:
    Oct 5, 2010
    Messages:
    691
    Likes Received:
    46
    I'm also curious to know what it would look like if exported from 3dmax. It could be a bug with simed. But I think KS' tool will find out if it is, as it can only be a material thing.
     
  20. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    Ok, thanks! Here it is:

    Code:
    <GMTMATERIALS>
      <MATERIAL>
        <NAME>GLOW_SPOTS</NAME>
        <FLAGS>FLAG_1;FLAG_2;Blend;TwoSided;FLAG_21;FLAG_24;specularM;emmissiveM;FLAG_31</FLAGS>
        <AMBIENT><R>1.00000</R><G>1.00000</G><B>1.00000</B><A>1.00000</A></AMBIENT>
        <DIFFUSE><R>1.00000</R><G>1.00000</G><B>1.00000</B><A>1.00000</A></DIFFUSE>
        <SPECULAR><R>0.00000</R><G>0.00000</G><B>0.00000</B><A>1.00000</A></SPECULAR>
        <EMMISIVE><R>1.00000</R><G>1.00000</G><B>1.00000</B><A>1.00000</A></EMMISIVE>
        <SRCBLEND>SrcAlpha</SRCBLEND>
        <DSTBLEND>InvSrcAlpha</DSTBLEND>
        <FSPECULAR>1.00000</FSPECULAR>
        <SHADER>L2DIFFUSET0</SHADER>
        <TEXTURE0>
          <NAME>GLOW_SPOTS.DDS</NAME>
          <FLAGS>AutoMip;Trilinear;FLAG_18</FLAGS>
          <UNKNOWN1>FFFFFFFF</UNKNOWN1>
          <ANIMATION>
            <TEXTURECOUNT>1</TEXTURECOUNT>
          </ANIMATION>
          <ACTOR>1</ACTOR>
          <ACTION>3</ACTION>
          <APPLY>1</APPLY>
          <TEXSTAGE0>0</TEXSTAGE0>
          <TEXSTAGE1>0</TEXSTAGE1>
          <COLORKEY>0</COLORKEY>
          <UNKNOWN2>0</UNKNOWN2>
          <LODBIAS>0</LODBIAS>
          <UNKNOWN3>0</UNKNOWN3>
          <UNKNOWN4>0</UNKNOWN4>
          <FRESNELMIN>0</FRESNELMIN>
          <FRESNELMAX>0</FRESNELMAX>
          <FRESNELEXP>0</FRESNELEXP>
        </TEXTURE0>
      </MATERIAL>
      <MATERIAL>
        <NAME>SIN_STREET_LAMP_01!0</NAME>
        <FLAGS>FLAG_1;FLAG_2;FLAG_21;FLAG_24;specularM;emmissiveM;FLAG_31</FLAGS>
        <AMBIENT><R>1.00000</R><G>1.00000</G><B>1.00000</B><A>1.00000</A></AMBIENT>
        <DIFFUSE><R>1.00000</R><G>1.00000</G><B>1.00000</B><A>1.00000</A></DIFFUSE>
        <SPECULAR><R>0.36078</R><G>0.36078</G><B>0.36078</B><A>1.00000</A></SPECULAR>
        <EMMISIVE><R>0.00000</R><G>0.00000</G><B>0.00000</B><A>1.00000</A></EMMISIVE>
        <SRCBLEND>One</SRCBLEND>
        <DSTBLEND>Zero</DSTBLEND>
        <FSPECULAR>5.00000</FSPECULAR>
        <SHADER>L2SPECULART0</SHADER>
        <TEXTURE0>
          <NAME>SIN_STREET_LAMP_01_D.DDS</NAME>
          <FLAGS>AutoMip;Trilinear;FLAG_18</FLAGS>
          <UNKNOWN1>FFFFFFFF</UNKNOWN1>
          <ANIMATION>
            <TEXTURECOUNT>1</TEXTURECOUNT>
          </ANIMATION>
          <ACTOR>1</ACTOR>
          <ACTION>3</ACTION>
          <APPLY>1</APPLY>
          <TEXSTAGE0>0</TEXSTAGE0>
          <TEXSTAGE1>0</TEXSTAGE1>
          <COLORKEY>0</COLORKEY>
          <UNKNOWN2>0</UNKNOWN2>
          <LODBIAS>0</LODBIAS>
          <UNKNOWN3>0</UNKNOWN3>
          <UNKNOWN4>0</UNKNOWN4>
          <FRESNELMIN>0</FRESNELMIN>
          <FRESNELMAX>0</FRESNELMAX>
          <FRESNELEXP>0</FRESNELEXP>
        </TEXTURE0>
      </MATERIAL>
      <MATERIAL>
        <NAME>SIN_STREET_LAMP_02!0</NAME>
        <FLAGS>FLAG_1;FLAG_2;FLAG_21;FLAG_24;specularM;emmissiveM;FLAG_31</FLAGS>
        <AMBIENT><R>1.00000</R><G>1.00000</G><B>1.00000</B><A>1.00000</A></AMBIENT>
        <DIFFUSE><R>1.00000</R><G>1.00000</G><B>1.00000</B><A>1.00000</A></DIFFUSE>
        <SPECULAR><R>0.00000</R><G>0.00000</G><B>0.00000</B><A>1.00000</A></SPECULAR>
        <EMMISIVE><R>0.00000</R><G>0.00000</G><B>0.00000</B><A>1.00000</A></EMMISIVE>
        <SRCBLEND>One</SRCBLEND>
        <DSTBLEND>Zero</DSTBLEND>
        <FSPECULAR>5.00000</FSPECULAR>
        <SHADER>L2DIFFUSET0</SHADER>
        <TEXTURE0>
          <NAME>SIN_STREET_LAMP_02_D.DDS</NAME>
          <FLAGS>AutoMip;Trilinear;Chroma;FLAG_18</FLAGS>
          <UNKNOWN1>FFFFFFFF</UNKNOWN1>
          <ANIMATION>
            <TEXTURECOUNT>1</TEXTURECOUNT>
          </ANIMATION>
          <ACTOR>1</ACTOR>
          <ACTION>3</ACTION>
          <APPLY>1</APPLY>
          <TEXSTAGE0>0</TEXSTAGE0>
          <TEXSTAGE1>0</TEXSTAGE1>
          <COLORKEY>0</COLORKEY>
          <UNKNOWN2>0</UNKNOWN2>
          <LODBIAS>0</LODBIAS>
          <UNKNOWN3>0</UNKNOWN3>
          <UNKNOWN4>0</UNKNOWN4>
          <FRESNELMIN>0</FRESNELMIN>
          <FRESNELMAX>0</FRESNELMAX>
          <FRESNELEXP>0</FRESNELEXP>
        </TEXTURE0>
      </MATERIAL>
      <MATERIAL>
        <NAME>TRKLIGHT</NAME>
        <FLAGS>FLAG_1;FLAG_2;FLAG_21;FLAG_24;specularM;emmissiveM;FLAG_31</FLAGS>
        <AMBIENT><R>1.00000</R><G>1.00000</G><B>1.00000</B><A>1.00000</A></AMBIENT>
        <DIFFUSE><R>1.00000</R><G>1.00000</G><B>1.00000</B><A>1.00000</A></DIFFUSE>
        <SPECULAR><R>0.00000</R><G>0.00000</G><B>0.00000</B><A>1.00000</A></SPECULAR>
        <EMMISIVE><R>1.00000</R><G>1.00000</G><B>1.00000</B><A>1.00000</A></EMMISIVE>
        <SRCBLEND>One</SRCBLEND>
        <DSTBLEND>Zero</DSTBLEND>
        <FSPECULAR>5.00000</FSPECULAR>
        <SHADER>L2DIFFUSET0</SHADER>
        <TEXTURE0>
          <NAME>SIN_STREET_LAMP_01_D.DDS</NAME>
          <FLAGS>AutoMip;Trilinear;FLAG_18</FLAGS>
          <UNKNOWN1>FFFFFFFF</UNKNOWN1>
          <ANIMATION>
            <TEXTURECOUNT>1</TEXTURECOUNT>
          </ANIMATION>
          <ACTOR>1</ACTOR>
          <ACTION>3</ACTION>
          <APPLY>1</APPLY>
          <TEXSTAGE0>0</TEXSTAGE0>
          <TEXSTAGE1>0</TEXSTAGE1>
          <COLORKEY>0</COLORKEY>
          <UNKNOWN2>0</UNKNOWN2>
          <LODBIAS>0</LODBIAS>
          <UNKNOWN3>0</UNKNOWN3>
          <UNKNOWN4>0</UNKNOWN4>
          <FRESNELMIN>0</FRESNELMIN>
          <FRESNELMAX>0</FRESNELMAX>
          <FRESNELEXP>0</FRESNELEXP>
        </TEXTURE0>
      </MATERIAL>
    </GMTMATERIALS>
    This is straight after conversion to rF2, hence the ambient and diffuse properties being white, but it doesn't matter if I set them to black, it still renders the same in-game.
     
    Last edited by a moderator: Sep 30, 2012

Share This Page