MX Bikes Official Forum

Mods => Track Editing => Topic started by: тғc on July 28, 2016, 03:07:10 PM

Title: See through edges of alpha textures
Post by: тғc on July 28, 2016, 03:07:10 PM
I'd like to re-open this discussion please  ;)

http://forum.mx-bikes.com/index.php?topic=104.msg11174#msg11174

I've recently started learning Blender so figured I'd give it a proper try. There is absolutely no way I've found to get rid of these 'halo's'.

I understand that Snappe has said the problem will always be present to some degree, and I understand PiBoSo has said that the reason stock tracks don't have this issue is because of the way the trees are made, but I'm not convinced.

I've also seen the odd video of GP Bikes where a custom track is used and the issue is not present.

Some trees on the stock tracks are indeed made using a trunk, but others are not, and the ones that are just 2 planes (or 4 if each are flipped to get the texture on both sides) and these don't suffer with this issue at all.

The problem I have right now is that I can no longer work on a track because the issue is so visible.. So..

Any tips for fixing this in Blender?

Anything I can do to reduce the effect to the level seen in the stock tracks?

Please  :(
Title: Re: See through edges of alpha textures
Post by: Asdrael on July 28, 2016, 04:03:08 PM
HELP THAT MAN! He needs it  ;D
Title: Re: See through edges of alpha textures
Post by: тғc on July 29, 2016, 08:51:58 AM
Please, I'm really trying here..

This morning I've experimented with Blenders 'Alpha Clamp' although my guess is that only applies to the viewport. Some people have said it helps with the Blender Game engine but since I think it only exports using the internal render engine that's not the answer.

I've also tried a premultiplied alpha image again with no luck. Looks perfect in Blender but the same result in game.

Please help :( as I said, there must be something to this as stock tracks trees, X shape with no trunk don't have this problem. I'm pulling my hair out!
Title: Re: See through edges of alpha textures
Post by: Sandbiter on July 29, 2016, 09:10:31 AM
This is probably not the answer you're looking for. But might the mask just be a little too small? By that I mean that it leaves an edge around the tree, which you don't want. Try making the mask a little bigger so you definitly have no background color.

That probably doesn't make any difference though. But I'm just trying to help :/
Title: Re: See through edges of alpha textures
Post by: тғc on July 29, 2016, 09:14:42 AM
Thanks, but no that's not it.

My mask is literally black and white, no blur, no antialiasing.. I'm also using a plugin similar to Flaming Pear for PS to ensure the tree colour extends outside the mask edges.

Thanks though :(
Title: Re: See through edges of alpha textures
Post by: Sandbiter on July 29, 2016, 09:34:57 AM
Hm, okay. I hope Piboso or Snappe (or maybe someone from gp-bikes or KRP) can help you out. There has to be a way I think..
Title: Re: See through edges of alpha textures
Post by: тғc on July 29, 2016, 09:47:27 AM
Yes, there must be a way..

Even if something was done to fix this on the stock tracks after the scenery was imported to the map that we are not capable of doing, I'd rather know so I can not waste any (more) time on this..:(
Title: Re: See through edges of alpha textures
Post by: Asdrael on July 29, 2016, 12:53:17 PM
Stupid question:

Are you rendering with or without shadows? Maybe the problem becomes less with shadows on, or maybe changing the shadow settings would help?
Title: Re: See through edges of alpha textures
Post by: тғc on July 29, 2016, 01:34:48 PM
Gave it a try.. No change unfortunately :(
Title: Re: See through edges of alpha textures
Post by: Asdrael on July 29, 2016, 01:42:21 PM
What about rotating the light source or trees?

It would be interesting putting trees in a blank map with different rotations (aligned, 10, 20, 30, 40, 45 degrees) in relation to the light direction to see if there is any link, since it's only on certain faces (and seem to be always the same one from your picture).
Title: Re: See through edges of alpha textures
Post by: тғc on July 29, 2016, 01:46:57 PM
Yeah it's always the same affected faces.. Weirdly though in blender I built a tree, duplicated it, rotated and scaled to get many different variations of the same tree. In game all trees work from one angle but not from another..

I'm not sure what relavence light source may have if any, but my guess is that like shadows probably none :( may experiment though.
Title: Re: See through edges of alpha textures
Post by: Asdrael on July 29, 2016, 01:53:11 PM
Then I don't have any more ideas.

Try changing the light XYZ when compiling the track, maybe the shadow sampling... and do the same with the .amb file.

Sorry :/

- Maybe the rendering doesn't like your tree. Tried with another one, maybe a from a free database?
- Suggestion two: if it works better using SketchUp, why not do a scene with trees in SketchUp and one with the rest of the objects in Blender? 2 2D planes intersecting, I am sure SketchUp will not be that heavier.
Title: Re: See through edges of alpha textures
Post by: тғc on July 29, 2016, 02:02:00 PM
No prob mate, thanks anyway!

Yeah I've tried with lots of trees.. Even made my own textures from scratch (very basic) to guarantee there were no bleed issues and same problem..
Title: Re: See through edges of alpha textures
Post by: Asdrael on July 29, 2016, 02:03:10 PM
edited my post as you replied with this:


Suggestion two: if it works better using SketchUp, why not do a scene with trees in SketchUp and one with the rest of the objects in Blender? 2 2D planes intersecting, I am sure SketchUp will not be that heavier.

Title: Re: See through edges of alpha textures
Post by: тғc on July 29, 2016, 02:16:13 PM
Oh no, they already look better than 2d trees in SU ;D that's one positive I guess..
Title: Re: See through edges of alpha textures
Post by: Sandbiter on August 02, 2016, 06:56:57 PM
I made some 3d trees for Southwick. I also got the problem.
Kinda makes me sad to be honest. Trees can look a lot better if we didn't have this problem.
Title: Re: See through edges of alpha textures
Post by: тғc on August 06, 2016, 07:04:07 AM
Ok, so I think I've found a solution.. Think!

I got this working last night to where there were virtually no visible errors but the method is a bit cumbersome.

Firstly, I experimented with different formats, initially BMP but had no luck getting transparency to work so I moved on to DDS. I ended up doing some reading and after trying 8 or 9 different format settings I got the best results from DXT5 with a bunch of other settings using a DDS gimp plugin. I think the biggest help here is the way it blends the alpha edges.

The Next thing I did was break a 3d tree into individual faces making them their own objects. This is the frustrating part at least for me. A 2d tree, broken in two down the middle, separated into loose parts to make two objects. Copy and flipped 180 as blender can't export two sides faces, then copy the whole lot and rotate by 90* to make the 3d X shape. This results in 8 objects for one tree, all loose. This makes having more than a couple of trees fill up the outliner and makes them very hard to select.

But.. It works so thought I'd share.

I will continue to experiment later today, maybe I can join them together, maybe I don't need to use DDS when splitting up all the faces, not sure yet.

Does this sound about right PiBoSo/Snappe? Anything I can do to refine this process?
Title: Re: See through edges of alpha textures
Post by: Sandbiter on August 06, 2016, 10:07:08 AM
Great to hear!
Title: Re: See through edges of alpha textures
Post by: PiBoSo on August 06, 2016, 10:41:30 AM

Have you tried using the "CK_" prefix in the filename of the foliage textures?
http://docs.piboso.com/wiki/index.php/Track_Creation_Rules#Textures
Title: Re: See through edges of alpha textures
Post by: тғc on August 06, 2016, 10:45:19 AM

Have you tried using the "CK_" prefix in the filename of the foliage textures?
http://docs.piboso.com/wiki/index.php/Track_Creation_Rules#Textures

Pib, I love you, you know that, but I do sometimes wonder if you actually read my posts  ;D
Title: Re: See through edges of alpha textures
Post by: тғc on August 07, 2016, 09:10:49 AM
I thought I'd figured it, but I tried to add a different tree last night and for some reason this one is showing entirely semi see through in game.. Must have got something wrong as it looks just fine in blender and in mapview..

The original tree I did which works still shows up fine.

Any thoughts on what I might have wrong? And yes, I am using the CK_TREE prefix and it's working just fine ;)
Title: Re: See through edges of alpha textures
Post by: PiBoSo on August 07, 2016, 11:25:49 AM
I thought I'd figured it, but I tried to add a different tree last night and for some reason this one is showing entirely semi see through in game.. Must have got something wrong as it looks just fine in blender and in mapview..

The original tree I did which works still shows up fine.

Any thoughts on what I might have wrong? And yes, I am using the CK_TREE prefix and it's working just fine ;)

If the trees are better in the latest Map Viewer, then the next build of MXB should fix the problem.
Title: Re: See through edges of alpha textures
Post by: тғc on August 07, 2016, 11:44:55 AM
That sounds good.. In the meantime I'll see if I can figure out why the current ones I have are now transparent..

There's a lot to this track making business! Suddenly remembering why I stuck to desert style tracks for so long lol
Title: Re: See through edges of alpha textures
Post by: Sandbiter on August 07, 2016, 01:58:46 PM
That sounds good.. In the meantime I'll see if I can figure out why the current ones I have are now transparent..

There's a lot to this track making business! Suddenly remembering why I stuck to desert style tracks for so long lol
If you have a full black alpha channel on your texture, your texture is transparent for some reason. At least that's a problem I had with my banners on Southwick.
Title: Re: See through edges of alpha textures
Post by: тғc on August 07, 2016, 02:17:58 PM
Thanks mate! Will try it out later.. So what make it like 1 1 1?
Title: Re: See through edges of alpha textures
Post by: Sandbiter on August 07, 2016, 04:57:02 PM
Thanks mate! Will try it out later.. So what make it like 1 1 1?
I'm using no alpha channel on my texture at the moment.
Title: Re: See through edges of alpha textures
Post by: тғc on August 07, 2016, 04:59:04 PM
Thanks mate! Will try it out later.. So what make it like 1 1 1?
I'm using no alpha channel on my texture at the moment.

Care to elaborate?
Title: Re: See through edges of alpha textures
Post by: Sandbiter on August 07, 2016, 05:10:39 PM
Without alpha channel:
(https://gyazo.com/0dec76698b14ec830c48d9f86dc5c8ca.png)

With alpha channel:
(https://gyazo.com/3a96c6dd02bf7a51617099f9b74552bc.png)
Title: Re: See through edges of alpha textures
Post by: тғc on August 07, 2016, 05:12:56 PM
Ok but if you don't have an alpha channel how are you getting transparency?
Title: Re: See through edges of alpha textures
Post by: Sandbiter on August 07, 2016, 07:35:16 PM
Ok but if you don't have an alpha channel how are you getting transparency?
Didn't think of that unfortunately.

It's really weird my banners where half transparent while I had a full black alpha channel then. From some angles I could see the textures with a lot of shiny-ness on them.
Title: Re: See through edges of alpha textures
Post by: тғc on August 07, 2016, 08:04:04 PM
Well this is the problem I'm having with this new tree image. Alpha mask I've tried upping the black by 3, no joy.. Its no different from the one that works as to the process I used to make it.

From about 20 feet (estimate) the object becomes transparent.. Must be something I'm missing.

Edit.. Thanks geo, will give it a try
Title: Re: See through edges of alpha textures
Post by: тғc on August 07, 2016, 08:32:16 PM
Nope no joy.. thanks for the suggestion though geo :)
Title: Re: See through edges of alpha textures
Post by: тғc on August 07, 2016, 08:44:38 PM
Lol geo.. well how about this  :o

OK so Blender only draws one side of a plane, so you have to duplicate the plane and flip the normals to get it to paint both sides for use in game. It seems as though MX Bikes doesn't like this.

If I copy a plane, put it in it's original position and flip the normals to get a 2 sided face I get a ton of errors.

If I copy a plane, flip it 180* I get NO ERRORS...

So, when using a symmetrical tree, this works great.. When using a tree with an odd shape it doesn't work as well but that's something I can live with, and hardly noticeable once you rotate around.

Wow.. and my guess is that as SketchUp DOES draw both sides of a plane, it does this by flipping the normal causing the errors. I don't think there's a way around that, but man oh man am I glad to have figured this one out..

Title: Re: See through edges of alpha textures
Post by: тғc on August 07, 2016, 09:07:30 PM
I guess we're talking about the same amount of faces though, and even then I just did it with 2 image planes, so totaling 4 planes.. What's that, 8 tris? that's pretty good for a tree, I had about 200 with 8 planes last night and it didn't affect FPS one bit.
Title: Re: See through edges of alpha textures
Post by: тғc on August 08, 2016, 07:09:38 AM
Strange.. Got this working last night briefly then it all stopped.. Is something bugged?

My guess is there is an order to it, or a vital step I'm not noticing.. Any hints?

If stock track (practice, maryland, forest etc..) scenery is made using blender, how about a step by step of how you guys add trees? (process, format etc..)

(https://cdn.meme.am/instances/500x/65204481.jpg)
Title: Re: See through edges of alpha textures
Post by: тғc on August 08, 2016, 10:23:57 AM
(https://i.gyazo.com/8add2eda3d9394595c6fe75264ac349c.png)
Title: Re: See through edges of alpha textures
Post by: Asdrael on August 08, 2016, 10:28:57 AM
Spooky.
Title: Re: See through edges of alpha textures
Post by: тғc on August 08, 2016, 10:49:58 AM
Joining the object and doubling it up works..

Seems like an expensive way to make 'low poly' trees, but then I guess we're talking about 16 planes instead of 8.. 16 planes per tree, 32 tri's.. I guess that's worth it for the good looks..
Title: Re: See through edges of alpha textures
Post by: тғc on July 09, 2018, 09:10:39 PM
Hey PiBoSo / Snappe, I'd like to re-address this topic.

When I started this topic I was working on the JS7 Compound. Back then, as you can see from my above message I only had to make a double sided X style tree and duplicate it in the exact same spot to make it 'solid' with no see through edges or weird alpha glitches.

After that and in a later beta (6 - 7) I made Unadilla. When I first added trees on Unadilla (b6) I had to not only double up my tree but actually triple up to get them to behave.

Now I'm working on Hawkstone.. :(

I've made my trees, duplicated them 3 times in the exact same spot and I'm getting alpha glitches.

So my conclusion and the reason for ressurecting this old thread. It seems to be getting worse each beta. When you guys released the game with The Practice Track, Maryland and MXB Club your trees looked amazing and if you remember, I asked how they were done. Since you'e released other tracks over the course of the beta's your trees now all suffer with this alpha issue. You can even see it on the screenshot of Mantua used on the Tracks page..

(http://www.mx-bikes.com/images/tracks/mantua.jpg)

Is this something that's ever going to be looked at? It looks horrendous and really brings the visual quality of the game down. Stock 3d grass has ALWAYS suffered with this as I've pointed out above. It seems to me that if it's getting worse, something is causing it, and if it can be fixed by duplicating the meshes then it's a sorting problem and not a bad texture problem.

Thoughts?

Thanks for reading  :)
Title: Re: See through edges of alpha textures
Post by: тғc on July 20, 2018, 08:20:29 PM
Please?
Title: Re: See through edges of alpha textures
Post by: тғc on July 29, 2018, 06:24:29 PM
Please :(
Title: Re: See through edges of alpha textures
Post by: тғc on September 22, 2018, 07:15:30 PM
Seeing as the daily dev is filled with swathes of rendering fixes, do you think this could be one of them?