1. Forums
  2. Discord
  3. About Mapcore
  4. Patreon Supporters
  • Login
  • Register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • More Options
  1. Mapcore
  2. Discussions
  3. Level Design

Problems with Alpha-Channel in HL2

  • Ray
  • October 9, 2006 at 10:41 AM
  • Ray
    • October 9, 2006 at 10:41 AM
    • #1

    Hi there!

    I'm currently working on a fern in 3dsmax for a HL2-mod. I started modelling 1 low-poly leaf of it and then put some together to get a bunch of them

    For the leaf I simply use a picture of a real leaf, saved as a tga-file with alpha-channel.

    Well, the alpha-channel kinda works, but not the way it's meant to be. In 3dsmax, everything looks fine, but in-game there is some strange error:

    The first leaf I put for the model is shown correct. The second one is almost perfect, but doesnt work correct when being on front of the first leaf. The third one is correct except when it is in front of the first or the second leaf and so on... here's a picture showing the converted fern via hlmv with different rotation:

    The numbers are for better orientation and show the order I placed the leafs within 3dsmax.

    [Blocked Image: http://img82.imageshack.us/img82/7809/fern1fs2.th.jpg]

    With leaf 1, everything is correct, there are no errors in viewing it

    [Blocked Image: http://img174.imageshack.us/img174/884/fern2cp1.th.jpg]

    Leaf 2 is shown correct for leaves 3-5, but on this picture u might see that leaf 1 is somehow shown IN FRONT of leaf 2, but should be hidden by leaf 2

    [Blocked Image: http://img82.imageshack.us/img82/5541/fern3en7.th.jpg]

    Leaf 3 isn't shown correct if leaf 1 or leaf 2 are behind it. Somehow leaf 1 can be seen at the front, the viewer places leaf 3 BEHIND leaf 1 and leaf 2, but it should be at the front.

    [Blocked Image: http://img183.imageshack.us/img183/5436/fern4ft6.th.jpg]

    Here's some close-up screenshot. There's leaf 4 in the front, but get's rendered by hlmv in the back, showing leaves 1-3 first.

    I don't know what I'm doing wrong and it's really weird. Here is my complete .vmt for the fern-texture:

    Code
    "VertexLitGeneric"
    
    
    {
    
    
    	"$baseTexture" "(removed)\plants\fern\Fern3"
    
    
    
    
                    // Used by a model
    
    
    	"$model" 1
    
    
    
    
                    // Using alpha-channel
    
    
    	"$translucent" 1
    
    
    
    
                    // Shows back-faces. Needed, because otherwise I can't see
    
    
                    // the downside of the leaf.
    
    
    	"$nocull" 1
    
    
    
    
    	"$compilepassbullets" 1
    
    
    }
    Display More

    Is there anything wrong or missing here?

    Another problem is that white line around my texture. The line isn't visible when viewing the model very close (see picture 4), but from some distance the white line gets ever thicker, making the model look stupid and not fitting the green / brown-colored rest of the forrest. But the alpha-channel fits perfectly...

    Hopefully someone can help me I would be REALLY thankful for any help I get!!!

    I already wasted 3 days with reading tons of pages of Valve's documentation and trying many things, but couldn't find anything useful.

  • PhilipK
    • October 9, 2006 at 10:49 AM
    • #2

    Yes this is the culling problem with 8-bit alpha.

    Although your model doesn't seem that complex so I'm kind of surprised you get this. Perhaps there could be some other reason for it in this case.

    But generally you would need to use 1-bit alpha instead (meaning you will use "$alphatest" 1 instead of "$translucent" 1).

    This will make the model look jaggier in the edges because 1bit alpha is simply black and white.

    The white stripes around it probably occurs when the texture starts to mip.

    You could prevent this probably by having a background colour in the diffuse a colour that is close to the color of the leaves (in this case I'd chose a rather light green colour). This should help. Mip steps can be edited by hand tho, but shouldn't be necessary on this kind of texture.

    Hope that helps.

  • hessi
    • October 9, 2006 at 1:06 PM
    • #3

    those white edges are mipmapped levels of your texture as phil already said.

    as i can see you are working on plants so i would recommend you my (video-)tutorials on tree modelling and texturing. in the texturing tutorial you can learn a pretty easy way to prevent your mipmaps from screwing your colors.

    i got a html tutorial in german which might be usefull too (lots of pictures)

    http://forum.counter-strike.de/bb/thread.php?TID=98929

    and all my video tutorials:

    http://www.thomashess.net/index.php?cat=4 -> "Photoshop - Creating tree textures" would be the one i'd recommend you

  • Defrag
    • October 9, 2006 at 3:29 PM
    • #4

    I've seen quite a few problems with z-ordering and transparency in Source and, as has been said, the only way to fix some of them is to use the 1-bit alpha (unless there's a trick everyone is missing).

  • Warby
    • October 9, 2006 at 3:47 PM
    • #5

    leaves are not actualy transparent ( there migth be some subsurface scattering going on but as far as i know source and no other engine can do that quite yet) so go with 1 bit alpha masks - alpha test materials

    you should only EVER use alpha-blend materials if its ABSOLUTLY neccesary since "ALL" engines have sorting and masking problems ... its the worst when people use alpha textures for metal fences ... ?? why the hell are those supposed to be semitransparent ? even alot of "PRO" studios do that shit in their games including valve

  • Ray
    • October 10, 2006 at 8:18 AM
    • #6

    Thank you very much, guys That was real fast help!

    Yeah, with "$alphatest" 1 it's working. The model is low-poly coz a map is supposed to have like hundreds of them (using LOD, too).

    hessi: Thx, gonna watch ur tuts right now

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!

Register Yourself Login
Discord

The Mapcore Discord is our lively IRC channel of the 2000s reborn. Chat about level design, gaming, and more.

Latest Posts

  1. Custom Gamemodes Contest

    Angel
    July 20, 2026 at 11:46 AM
  2. FAQ

    Angel
    July 20, 2026 at 10:14 AM
  3. Tangerine

    Harry Poster
    July 18, 2026 at 11:10 AM
  4. Any of the old guard still around? D:

    Warby
    July 12, 2026 at 8:23 PM
  5. About our archived forums

    Thrik
    June 30, 2026 at 2:12 PM
  6. Mapcore Discord

    mason_fan123
    June 24, 2026 at 8:52 PM
  7. [CS2] Valley

    Serialmapper
    June 22, 2026 at 11:56 AM
  8. Free Music / SFX Resource - Over 2500 Tracks

    Eric Matyas
    June 18, 2026 at 12:32 PM
  9. Pango [WIP]

    Elowen
    June 11, 2026 at 10:13 AM
  10. [CS2] Dvina

    Jeremy Rivera
    June 11, 2026 at 10:03 AM

Users Viewing This Thread

  • 4 Guests
  1. Privacy Policy
  2. Contact
Powered by WoltLab Suite™