Something wrong with alpha blend transparency..?

Discussion in 'Track Modding' started by Jka, Mar 24, 2012.

  1. Jka

    Jka Member Staff Member

    Joined:
    Jan 31, 2011
    Messages:
    954
    Likes Received:
    213
    I have a TSO, which contains some interior polys (walls, floor, roof etc.).

    I've assigned this TSO windows with alpha blend transparency.

    View attachment 1706

    All interior polys have disappear and you can see through whole building.

    TSO material is T1 with Source: Inv Scr Alpha, Dest: Scr Alpha and "sorted" is selected.

    Am I missing something or..?

    Cheers!
     
  2. mianiak

    mianiak Registered

    Joined:
    Oct 5, 2010
    Messages:
    691
    Likes Received:
    46
    I think you might have your source and dest. blends back the front.
    Try, Source: src alpha, dest: inv src alpha.
     
  3. Jka

    Jka Member Staff Member

    Joined:
    Jan 31, 2011
    Messages:
    954
    Likes Received:
    213
    Yep, but my (transparent) alpha is white. If I reverse it, building dissappears leaving only windows visible (as it should with those settings)...;)

    Should I reverse textures alpha channel B/W color? Does it matter how I build textures alpha channel? Can opaque be black and transparent white..?
     
  4. ethone

    ethone Registered

    Joined:
    Nov 30, 2011
    Messages:
    1,153
    Likes Received:
    37
    Black/white mean opaque/transparent depending on what source blend you have.
    Switching src/inv src to inv src/src has the same effect as inverting your alpha channel in the texture.

    Weird issue btw. Have you tried splitting up the TSO into more than one object (TSOoutside and TSOinside for example)?
     
  5. Jka

    Jka Member Staff Member

    Joined:
    Jan 31, 2011
    Messages:
    954
    Likes Received:
    213
    Yes, I have very same impression how source/destination blend should work.

    I will try next to detach TSO's windows to own GMT.
     
  6. Devin

    Devin Member Staff Member

    Joined:
    Dec 30, 2011
    Messages:
    235
    Likes Received:
    189
    Are interior and window objects src/inv src? interior shouldn't be :D
     
  7. Jka

    Jka Member Staff Member

    Joined:
    Jan 31, 2011
    Messages:
    954
    Likes Received:
    213
    No, interior polys are opaque, though TSO contains only one material with alpha blend. Blending should not affect material's opaque sections. It never did with rF1 and I assume that is the case with rF2 also.

    Still no-go.

    I detach windows to own gmt => windows start to flicker like two polys close to each other are z-fightning. Transparency acts same way as original problem.

    I reversed blend Scr/Dest => same result, flickering

    I reversed texture's alpha => same result, flickering

    I reversed blend Scr/Dest with new texture => same result, flickering

    I reversed back to original TSO with attached windows => reversed back to original problem, without flickering :rolleyes:

    I give up and move on for now. I hope devs could check this out in some point.

    Cheers!
     
  8. ethone

    ethone Registered

    Joined:
    Nov 30, 2011
    Messages:
    1,153
    Likes Received:
    37
    If you detach the windows to their own gmt there shouldn't be any flickering though as you have just detached that poly, not placed it above another one, right?

    If you want you could post the .max file of just that building so we can have a better look at it.
     
  9. mianiak

    mianiak Registered

    Joined:
    Oct 5, 2010
    Messages:
    691
    Likes Received:
    46
    I'd go with 2 separate materials.

    The problem will be the alpha on the interior, although it's opaque, having it being part of it will cause that.
     
  10. Luc Van Camp

    Luc Van Camp Track Team Staff Member

    Joined:
    Oct 4, 2010
    Messages:
    1,030
    Likes Received:
    15
    I'll agree with that one. In fact, it's more efficient to create a new material rather than forcing the engine to process (a large number of) triangles that don't require alpha blend transparency.

    It's like building a real wall made from glass, and then covering it with a simple wallpaper. It's an expensive solution compared to simply using bricks.
    If you only need to cover a square inch of the glass wall, then it would be cheaper to paste some paper on it, rather than cutting a hole in the glass and putting one brick in. In this case, it makes sense to split it into two materials.
     
  11. Jka

    Jka Member Staff Member

    Joined:
    Jan 31, 2011
    Messages:
    954
    Likes Received:
    213
    Okay then. I will need bunch of different windows anyway, so I will make single windows material for all buildings around the track and keep their opaque walls etc. on another material(s).

    I'll report back when I'm done with testing of this approach.

    Cheers!
     
  12. ethone

    ethone Registered

    Joined:
    Nov 30, 2011
    Messages:
    1,153
    Likes Received:
    37
    If you want to use reflections on windows you'll have to make them a separate material anyway. A small dds with alpha blending will suffice so you can reuse it everywhere with dynamic reflections being calculated for each one individually.
     
  13. Jka

    Jka Member Staff Member

    Joined:
    Jan 31, 2011
    Messages:
    954
    Likes Received:
    213
    With separate windows material, it works. And it doesn't matter which way textures alpha channel is created (black-ish or white-ish.) and Scr/Dest blend works both ways (depending texture alpha, of course...).

    Thanks guys for your help. Time to close 3dsmax now and start preparing on Malaysian Grand Prix, which starts in 25 minutes...;)

    Cheers!
     
  14. Jka

    Jka Member Staff Member

    Joined:
    Jan 31, 2011
    Messages:
    954
    Likes Received:
    213
    *sigh*

    Well, well... There is something really weird going on with alpha transparency. On my previous post alpha blending works, but now it isn't.

    Only difference between these two is, that previous building picture contains only T1 shader. Now when I added normal and spec map to the material (BumpSpecularMap T1), blending is messed up again. Separate windows material (with alpha transparency) is untouched.

    There is no transparency at all on building material and there is no alpha channel on it's texture either.

    I have double- and tripple checked building material settings and cannot find any error...

    Time to move on to the tire walls... ;)
     
  15. Luc Van Camp

    Luc Van Camp Track Team Staff Member

    Joined:
    Oct 4, 2010
    Messages:
    1,030
    Likes Received:
    15
    That shouldn't be happening :) . Have you tried putting the object near the top of the SCN, to make sure no other objects are interfering with the materials? Could you perhaps upload a screenshot of both material's gMat level (gTex stage info should make no difference)?

    Also, you may want to detach the windows to a separate object, and make the windows a Textured shadow Caster. A piece of general advice is to limit the use of the Textured option to an absolute minimum, for obvious performance reasons :) .
     
  16. Jka

    Jka Member Staff Member

    Joined:
    Jan 31, 2011
    Messages:
    954
    Likes Received:
    213
    Found it.

    I dont know if it's gMotor material feature or bug, but...

    If you setup alpha blending (Src/Dest) to material and set it "sorted" and afterwards revert back to normal (One/Zero), material editor do not clear "sorted" tickbox and grayes it out. If you export object with this setting, transparency is messed up. If you clear "sorted" tickbox and re-export, problem is solved... :rolleyes:

    Cheers!
     
  17. Luc Van Camp

    Luc Van Camp Track Team Staff Member

    Joined:
    Oct 4, 2010
    Messages:
    1,030
    Likes Received:
    15
    Interesting ... it shouldn't even use Sorted even if it is greyed out being enabled.
    Good to see you got it to work though :) .
     
  18. Jka

    Jka Member Staff Member

    Joined:
    Jan 31, 2011
    Messages:
    954
    Likes Received:
    213
    Yep, that is what I thought also. That's why I didn't bother stick to it earlier...

    Another thing to keep in mind. :)

    Cheers!
     

Share This Page