Gradient alpha channel transparency question

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

  1. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    Apart from those white ambient / diffuse colors I see nothing out of ordinary here, but if you say it makes no difference than I can only suspect your texture's alpha channel.

    Try the "High Luminance Sun" shader. It's used by ISI for headlights / brake lights in Clio. Perhaps it will be simplier this way.

    Here's headlight material from Clio:

    Code:
      <MATERIAL>
        <NAME>CLIO_BULBGLO</NAME>
        <FLAGS>FLAG_1;FLAG_2;Blend;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>1.00000</R><G>1.00000</G><B>1.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>10.00000</FSPECULAR>
        <SHADER>L2HIGHLUMSUN</SHADER>
        <TEXTURE0>
          <NAME>clio_lbulb.dds</NAME>
          <FLAGS>AutoMip;Trilinear</FLAGS>
          <UNKNOWN1>FFFFFFFF</UNKNOWN1>
          <ANIMATION>
            <TEXTURECOUNT>2</TEXTURECOUNT>
            <FRAMECOUNT>2</FRAMECOUNT>
            <FRAME0>0</FRAME0>
            <FRAME1>1</FRAME1>
            <ANIMATIONTYPE>5</ANIMATIONTYPE>
            <FREQUENCY>1.000000</FREQUENCY>
          </ANIMATION>
          <ACTOR>1</ACTOR>
          <ACTION>3</ACTION>
          <APPLY>1</APPLY>
          <TEXSTAGE0>0</TEXSTAGE0>
          <TEXSTAGE1>0</TEXSTAGE1>
          <COLORKEY>0</COLORKEY>
          <UNKNOWN2>0</UNKNOWN2>
          <LODBIAS>-1</LODBIAS>
          <UNKNOWN3>0</UNKNOWN3>
          <UNKNOWN4>0</UNKNOWN4>
          <FRESNELMIN>0.1</FRESNELMIN>
          <FRESNELMAX>0.9</FRESNELMAX>
          <FRESNELEXP>5</FRESNELEXP>
        </TEXTURE0>
      </MATERIAL>
    As you can see, material flags are the same (except for "Two Sided"), only different shader is used.
     
  2. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    Hmm, that shader isn't in the shader list in 3DSimED. What was the name of the GMT file where you found that material?
     
  3. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    It was in the Clio - headlights and brake lights.

    And this shader is on the list in 3DStudio. Perhaps 3DSimEd doesn't support it.
     
  4. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169
    The shader is "High luminance sun" and 3dsimed not support yet.
     
  5. Oleg

    Oleg Registered

    Joined:
    Sep 19, 2012
    Messages:
    20
    Likes Received:
    0
    Remove "FLAG_18" from textures. Remove "FLAG_31" from materials. then inject these material settings XML into GMT file.
     
  6. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    Wow, thank you, those were detailed instructions! :) However, at the moment I only have two options:

    1) Through the 3DSimED beta, which would mean that I would have to know what "FLAG_18" and "FLAG_31" corresponds to in the UI.

    2) By hex-editing the GMT file. (Which would require an exact definition of the material section of a GMT file, where can I find that?)

    Or, are there other ways? (Besides 3DS Max, which I don't have, so that's a no go)
     
  7. Oleg

    Oleg Registered

    Joined:
    Sep 19, 2012
    Messages:
    20
    Likes Received:
    0
    I think GMT <-> XML tool can do this for you, doesn't it?
     
  8. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    Not yet as far as I know, it's export only at this point. K Szczech can probably fill us in on the details here.
     
  9. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    Yes, it only exports materials for now.

    I made it so that I learn the new GMT file format, but I made it available so modders can debug their GMT files or look at material settings in other GMT files without importing them.

    I know this tool is a bit raw, but while not as convenient as editing GMT files in 3DSimEd or 3DStudio, it's more direct and you don't have to wonder if something got exported properly or not, because you see contents of GMT file.

    I may add import functionality sometime soon - depending if and when I find the time for it.
     
  10. Oleg

    Oleg Registered

    Joined:
    Sep 19, 2012
    Messages:
    20
    Likes Received:
    0
    Ok, I see. Jorgen, you can attach your rF2 .gmt file here with the buggy flare effect, I can make a quick hex-edit to check whether any of settings mentioned above really makes effect.
     
  11. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    I just wanted to say thanks so far for all the help, it's much appreciated!

    Since the track isn't mine to start with, coupled with the fact that it's a conversion from another game, I will post as little as possible from it. Therefore I extracted just the faces and the glow spots material plus the DDS texture into a new GMT file which you can find here:
    http://www.racehub.se/f1-2012/glow_spots.zip
     
  12. Oleg

    Oleg Registered

    Joined:
    Sep 19, 2012
    Messages:
    20
    Likes Received:
    0
    Three files for test. check if any of them solve the issue.
     
  13. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    Thanks Oleg! I'll give it a thorough test and report asap.

    EDIT: I have now tested all three, and they all come out exactly like the original flares. I even removed all other objects with the glow_spots material just to make sure they wouldn't interfere in some way. I wonder if there's any way to test that "High luminance sun" shader?
     
    Last edited by a moderator: Oct 6, 2012
  14. blakboks

    blakboks Registered

    Joined:
    Oct 20, 2010
    Messages:
    843
    Likes Received:
    30
    Another thing to try is to quickly create a new flare texture without the radial gradient to see if it truly is the texture or if it's the lighting. Just do something really rough just for testing purposes.
     
  15. Oleg

    Oleg Registered

    Joined:
    Sep 19, 2012
    Messages:
    20
    Likes Received:
    0
    the attached .dds looks fine for me. at least the standard SrcAlpha/InvSrcAlpha produces correct flare effect (like in rFactor1 screenshot). It's just something with rF2 material settings or shader itself.

    One more thing, you have used standard T1 shader, what will happen if you disable emissive lightting before exporting? (change it to black and/or lower level). May be "emissive" produces this strange effect in rf2?
     
  16. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    I'll have a go at experimenting with the four lighting properties soon. However, when looking at the Clio HLGLO_DS.GMT/HLGLO_PS.GMT materials and their textures, I noticed that both the bulb and the glass "glow" materials have three textures, one base, and two others with a 00 and a 01 suffix, much like the old rFactor1 event animations. Both the 00 and the 01 textures are pure white and do not feature any alpha channels. Could these be properties of the "High luminance sun" shader, or are they related to the alpha blending? In the latter case, maybe this is what is missing from my flare?

    EDIT: Looks like I was wrong, the 00 and 01 textures do have alpha channels, one of them is all white, and the other one looks similar to the main texture in size and shape.
     
    Last edited by a moderator: Oct 8, 2012
  17. Oleg

    Oleg Registered

    Joined:
    Sep 19, 2012
    Messages:
    20
    Likes Received:
    0
    I would suggest to try "T1 add T2" shader and load your texture onto both texture slots. Then disable emissive lighting (black/off). I don't know the shader code for T1 with emissive you've used, but I can guess the code for regular T1 add T2 and it's expected to produce the effect you need.
     
  18. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    Ok, thanks, I'll try that first. One other thing I might also try is to change the light blue texture color to black, because the flare "color" that isn't supposed to be there is very reminiscent of exactly that color. It's similar with HDR off, only that it's light gray instead of light blue.

    EDIT: No news yet, there hasn't been any time to continue testing, but I'll hopefully get some more work done tonight.
     
    Last edited by a moderator: Oct 10, 2012
  19. Jorgen

    Jorgen Registered

    Joined:
    Oct 5, 2010
    Messages:
    558
    Likes Received:
    3
    I've just located an object in Malaysia that looks a bit like the flare I have been struggling with, and it uses a texture that looks similar as far as the alpha channel goes, but the rgb part is completely different, and the material uses a different approach to blending. I'm going to try this and see if I can make it work.

    EDIT: Finally some progress.

    [​IMG]

    The ring effects is just because the texture is an extremely quick hack where the rgb channels are identical to the alpha channel. I'm convinced that the issue is more related to how the texture is composed rather than how the material is set up. In this case the shader is still a t1, but the transparency is custom blend with Source alpha, Target one. The texture is a DXT3 now. I'm going to play with the texture for a while until I'm happy.

    Many thanks to all who helped out during this effort!
     
    Last edited by a moderator: Oct 10, 2012
  20. MaXyM

    MaXyM Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,774
    Likes Received:
    29
    Is there already shader dedicated for flares? Or am I missed something?
    I mean pixel+vertex shader allows flare to face camera and change size depending on view angle?

    BTW I hope final version of rf2 will make possible to get flare as result of bloom postprocessing effect rather than with using objects
     
    Last edited by a moderator: Oct 10, 2012

Share This Page