Ray Posted October 9, 2006 Report Posted October 9, 2006 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. With leaf 1, everything is correct, there are no errors in viewing it 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 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. 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: "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 } 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. Quote
PhilipK Posted October 9, 2006 Report Posted October 9, 2006 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. Quote
hessi Posted October 9, 2006 Report Posted October 9, 2006 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 Quote
Defrag Posted October 9, 2006 Report Posted October 9, 2006 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). Quote
Warby Posted October 9, 2006 Report Posted October 9, 2006 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 Quote
Ray Posted October 10, 2006 Author Report Posted October 10, 2006 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.