Bugbear Community

Wreckfest => Modding => Topic started by: Dalags on August 12, 2017, 11:24:11 PM

Title: Alpha Texture Issues On Track Scenery
Post by: Dalags on August 12, 2017, 11:24:11 PM
Hi all,
I'm having a few strange problems with alpha channeled textures not displaying correctly on my track, as shown in this video:
https://www.youtube.com/watch?v=ngOwQp-dZEs (https://www.youtube.com/watch?v=ngOwQp-dZEs)

1.
Objects with alpha channelled textures that are furthest away are showing infront of objects that are nearest. The crowd texture showing through itself is pretty weird too.
In a game called NASCAR Heat, when using alpha channelled textures on tracks we had to set numbered 'priorities' whilst converting them to the ingame texture format. This essentially gave them a numbered order in which to appear. Is there anything similar in Wreckfest?

2. (0:23 in video)
The order in which textures ares displayed seems to change on certain parts of the track!
I've tried moving the entire track incase objects in a certain set of coordinates were causing problems, but this made no difference. I've tried moving Objects backwards and forwards incase there was some Z-axis clashing causing this, but this made no difference.

3. (1:00 in video)
When the camera is on the spectator side of the catchfence, the cars on track are showing before the catchfence texture.


Additional info:
I'm using 3ds Max 2016 and Adobe Photoshop CC with the provided BugBear exporting tools provided. The .tga's are 32bit and have RGB, Red, Green, Blue, and Alpha 1 channels.
The .tga and .bmap textures with alpha channels have the _c5 suffix, catchf_c5.tga/.bmap, crowd_c5.tga/.bmap, fence_c5.tga/bmap etc.
I've tried adding a "decal_" prefix to the texture names, i.e decal_catchf_c5.tga, like the skidmarks in the exampletrack, but this made no difference.

In the material editor, the material for the object with the alpha channel has the #decal suffix, catchf#decal, crowd#decal, fence#decal etc.
I've put the .tga texture in the diffuse and opacity slots on each object, making sure the padlock icon is selected. I've tried adding #decal to the object name too, but this made no difference.

I've tried only having the texture in either the diffuse or opacity slot, flipping normals, resetting the xforms, but none of these methods made any difference.

I'm sure it must be something really obvious I'm doing wrong or missing; any help would be massively appreciated!
Thanks,
Mark
Title: Re: Alpha Texture Issues On Track Scenery
Post by: findRED on August 13, 2017, 07:28:10 AM
The first thing that comes to mind:

Are you running an AMD graphics card?
if so...
do you have msaa enabled ingame?

AMD graphics card running this game with msaa enabled causes stuff like this to happen.  It's a known issue.
The fix:  Disable all msaa.  (unfortunate, but you can still run fxaa)
Title: Re: Alpha Texture Issues On Track Scenery
Post by: sam223 on August 13, 2017, 05:37:28 PM
Its something to do with the way they are setup. I have the same problem with a nvidia card



Have you tried using a .png with transparency and then packing with breckfest instead of .tga (+ alpha) and asset_builder?
Title: Re: Alpha Texture Issues On Track Scenery
Post by: RickyB on August 13, 2017, 06:00:06 PM
This reminds me of a screenshot I made a long time ago ... probably the same issue?
1) The windows (glass) of the cars seem to be infront of the fence - and also the smoke / dust.
2) (...) When there's a car or something in focus-length behind the fence, the fence is focused as well. Otherwise it's blurred.


Compared to screenshots from Bugbears own tracks - made today ...



Notice the windows of the car - looks like they are in front of the fence. Fence has alpha channel, car window has alpha channel.. I guess.

I'm afraid this issue might be something that is caused by the Wreckfest graphic engine itself. So we may not be able to do anything about it. I really hope I'm wrong though.

Only solution I can think of - some 3D spectators without alpha channels or xref'ing Bugbears assets (grandstands, spectators etc.)
Title: Re: Alpha Texture Issues On Track Scenery
Post by: sam223 on August 13, 2017, 06:13:14 PM
Its definitely possible to do it though.Bugbear do the same thing with their flat spectators except they rotate to view the camera. Maybe need to use a specific shader on them to get it to work?


 
Title: Re: Alpha Texture Issues On Track Scenery
Post by: RickyB on August 13, 2017, 06:50:25 PM
True... also the 2D foliage seems to work as well. Hmm looking at a sitting spectator .scne file, the material does not even have the #decal tag but instead #billboard#noshadow. Shader Id 89 ? No idea what that is about.

(https://s26.postimg.org/8q6mivbfd/spectator_sitting_material.jpg)

Changing the texture of the spectators and exporting it with PS still works...

Title: Re: Alpha Texture Issues On Track Scenery
Post by: sam223 on August 13, 2017, 06:58:32 PM
True... also the 2D foliage seems to work as well. Hmm looking at a sitting spectator .scne file, the material does not even have the #decal tag but instead #billboard#noshadow. Shader Id 89 ? No idea what that is about.

(https://s26.postimg.org/8q6mivbfd/spectator_sitting_material.jpg)

Changing the texture of the spectators and exporting it with PS still works...


Did you repack using alphas and official tools?
I suspect its something to do with shader id and #
Title: Re: Alpha Texture Issues On Track Scenery
Post by: RickyB on August 13, 2017, 07:08:22 PM
Did you repack using alphas and official tools?
I suspect its something to do with shader id and #

Yes, made "new layer from transparency", because the .png that I get with breckfest does not have 'Alpha 1' channel, then I add that layer mask as "Alpha 1" channel and exported with official tool.
Title: Re: Alpha Texture Issues On Track Scenery
Post by: Dalags on August 14, 2017, 08:32:45 PM
Thanks for the replies.

@findRed
I am on AMD, but MSAA was already disabled, I'm running on FXAA. Sounds like it's not an AMD issue though, going off Sams reply.

@RickyB
Alpha textures were used because the track was made for an older game with strict poly limits. I agree, using 3D spectators and geometry will be the best solution and is what I'll be doing.

@Sam223
Haven't tried Breckfest, but since it'll just reconvert the texture I doubt that'd solve it. You're right, I think there must be some shader or other paramater affecting this. Or maybe it's just an unfortunate quirk with the game engine.

I'm not very familiar with the game yet, but I looked at data/art/objects/prop_forest5_chainlink02.scne in BagEdit, and one of the models for the chainlink catchfencing has $p1 at the end. At the end of the track_modding.doc, it states that $ is a reserved character.
Do we know what the dollar $ or at @ symbols do yet? Or what the billboard shader is for? Perhaps they're clues.
Title: Re: Alpha Texture Issues On Track Scenery
Post by: sam223 on August 14, 2017, 09:14:30 PM
The # suffix defines what shader or custom property is used so e.g when making cars the part of the mesh that works with interchangeable skins has #car_body at the end of the material name. Then the game knows to link that part of the model to car paint shader and use skin reference file.

It also has an effect on the model and theres loads of different ones like #nodeform #car_tire etc etc. I assume the one they are using on their spectators is the one you want. As it will then organise the objects by distance from player cam,with whatever is closest to the cam being in the foreground. They'll probably also rotate to face the camera though like their flat spectators.

Maybe their mesh fences will give some clues aswell.

Maybe alpha channel is also automatically setup back to front,background first before foreground and $p1 means priority 1?

Ill try and get Janne to reply if possible
Title: Re: Alpha Texture Issues On Track Scenery
Post by: RickyB on August 14, 2017, 09:50:25 PM
As far as I "know" the $ character is for destructible objects - the parts that will show when object gets hit and gets destroyed.
The attached picture shows a box in bagedit that will fall into 9 different pieces when hit.
Title: Re: Alpha Texture Issues On Track Scenery
Post by: Mazay on August 15, 2017, 01:30:37 PM
I don't really know what's wrong, but I have couple of wild quesses what to try.

Probably the shader id is wrong. Does the material have _n.tga and _s.tga textures? Just loading the 1 pixel templates from textures folder can change shader to one that maybe works better at times.

Does 1 bit and alpha transparency make difference in how it's rendered? Atleast the buggy windows have alpha transparency so maybe switching to 1 bit could do something. Tree branches etc. have 1bit. I am not 100% sure how to change, but maybe saving as _c1.tga before .bmap conversion does it.
Title: Re: Alpha Texture Issues On Track Scenery
Post by: Dalags on September 01, 2017, 10:29:36 PM
I figured out how to fix the cars showing through the catchfencing from the spectators side of the fence. The catchfence had the material name catchf#decal. Getting rid of the #decal fixed this! So for reference, the material name is catchf, and has catchf_c5.tga in the diffuse and opacity slots. The object name is not relevant.
For some reason when removing the #decal for crowd#decal, the crowd planes lose their transparency. I'm not going to spend time working out why this is, so everything on my tracks with transparency (apart from catchfencing) will get remodelled.

Additionally, I noticed converting the catchf.tga with the BugBear Photoshop exporter resulted in a higher quality ingame texture. When I used Breckfest, it was really poor quality and quite distracting, as shown below. Not sure if it's been pointed out, but quite a few tracks on the Steam Workshop suffer from this, so hopefully this may help others improve their tracks visual quality. Thanks everyone who's given input or advice!

Bugbear exporter:
(http://i.imgur.com/JIOrbXu.jpg)

Breckfest:
(http://i.imgur.com/Nlu1bWN.jpg)
Title: Re: Alpha Texture Issues On Track Scenery
Post by: Mazay on September 01, 2017, 11:44:18 PM
The reason for lower quality with Breckfest is that it does not generate mipmaps. Also with such textures fps may be slightly worse and ingame texture quality setting will have none effect, so it's best to avoid Breckfest most of time.
Title: Re: Alpha Texture Issues On Track Scenery
Post by: Dalags on September 03, 2017, 11:38:03 PM
Managed to fix everything! I was putting another track into the game and didn't bother setting anything up for objects which have alpha channels on their textures, and everything worked perfectly.

The errors I had made were that:
The #decal tag shouldn't be on the end of the material name - that seems to make objects in the background appear before objects in the foreground which are obstructing them.
I had issues with the alpha channelling not working because when I originally converted the textures to bmap, they had _c as a filename suffix, and I renamed them to _c5 afterwards. when a texture is converted, if the filename ends in _c, the alpha channel is discarded. If a texture ends in _c5, the alpha channel is kept. So my game was reading from a bmap with no alpha data.

I also found out that:
If there is a _c5 texture in the materials diffuse and opacity slot, then the alpha channel works, but no shadow is cast.
If there is no texture in the materials opacity slot, the alpha channel still works if a _c5 texture is in the diffuse slot, and a shadow is cast.

The alpha'd textures still get shadows showing through them like in the 3rd reply, but that's a very minor issue.
Title: Re: Alpha Texture Issues On Track Scenery
Post by: The Very End on September 03, 2017, 11:46:49 PM
Great to hear you found a solution :) As you say, the tags are everything. You can do things like #noshadows and #xtree on spectators and "x-trees" to save performance (preventing shadows etc). There also is a tag like #billboard or something which will make an object turn where the camera is heading, making static objects such as flat spectators look more "alive" than what they really are.
STRmods posted a list sometime ago with a big number of tags, but there are still a lot out there to be used.
Title: Re: Alpha Texture Issues On Track Scenery
Post by: Mazay on September 14, 2017, 09:58:31 PM
I had issues with the alpha channelling not working because when I originally converted the textures to bmap, they had _c as a filename suffix, and I renamed them to _c5 afterwards. when a texture is converted, if the filename ends in _c, the alpha channel is discarded. If a texture ends in _c5, the alpha channel is kept. So my game was reading from a bmap with no alpha data.

How you came to that conclusion? I did testing, took example car lights_c5.tga > rename lights_c.tga > build_asset.bat > Breckfest, and alpha channel is still there.
I am confused about it. Maybe _c , _c5 affects something else, like shader?

About the Breckfest's poor quality, I wrote it in wiki https://dummiesman.com/wfwiki/index.php/Breckfest Hopefully more modders find it there.

Title: Re: Alpha Texture Issues On Track Scenery
Post by: Dalags on September 15, 2017, 08:30:07 PM
I found it strange too, but I double checked it before posting, and I've just checked it again to confirm this is the case.
(Throughout, I used the same .tga file, and deleted the .bmaps before conducting the next test, to ensure a new .bmap was being created)

On my track, in the diffuse slot is: crowd_c5.tga
I converted crowd_c.tga with the Photoshop plugin, to produce crowd_c.bmap. I then renamed it to crowd_c5.bmap - The alpha channel did not work ingame.
I renamed crowd_c.tga to crowd_c5.tga, and converted with the Photoshop plugin to produce crowd_c5.bmap - The alpha channel worked ingame.

I changed the diffuse slot to have: crowd_c.tga
I converted crowd_c5.tga with the Photoshop plugin to produce crowd_c5.bmap. I then renamed it to crowd_c.bmap - The alpha channel worked ingame.
I renamed crowd_c5.tga to crowd_c.tga, and converted with the Photoshop plugin to produce crowd_c.bmap - The alpha channel did not work ingame.

If a .tga is converted with the _c5 suffix, alpha is kept in the resulting .bmap.
If a .tga is conerted with the _c suffix, alpha is discarded in the resulting .bmap.
I did the same tests with having crowd.tga in the diffuse slot, converting crowd_c5.tga, renaming the .bmap to crowd.bmap, and the alpha worked ingame.
The _c5 only seems to matter during the texture conversion process.
Title: Re: Alpha Texture Issues On Track Scenery
Post by: Mazay on September 16, 2017, 12:59:45 PM
On my track, in the diffuse slot is: crowd_c5.tga
I converted crowd_c.tga with the Photoshop plugin, to produce crowd_c.bmap. I then renamed it to crowd_c5.bmap - The alpha channel did not work ingame.
I renamed crowd_c.tga to crowd_c5.tga, and converted with the Photoshop plugin to produce crowd_c5.bmap - The alpha channel worked ingame.

Thanks for answer. That clears it a bit. And you must be on something as most of example files with transparency have the _c5.tga at the end.

I did my testing and I am more confused again. On my track I am originally using wire grid derby1_fence2_c1.bmap for walls which I tried to replace with other textures.
I renamed car part lights_c5.tga and windows_c5.tga with different extensions, converted with build asset and renamed at the end to grid derby1_fence2_c1.bmap again.

_c.tga:
,
_c5.tga:
,
_c1.tga:
,

With lights_c5.tga, _c and _c5 are differently buggy but clearly have some transparency, _c1 does not have transparency at all probably because partial transparency is not allowed in that file.
With windows_c5.tga, _c seems be broken, but others work as I would expect them to.

Edit: Now it seems more clear. Probably _c1.tga should be used when there is not need for partial transparency and _c5 for rest of transparent surfaces, even tho it's bit buggy(?)

Edit2: All bugs with _c.tga seems to appear only at backside of #twosided material. Front side works ok, but without transparency.
_c5.tga keeps bugging whatever I do, but it's way less visible with the more transparent texture.

Edit3: The real difference between _c.bmap or _c5.bmap seems to be only in file path inside the file.
 _c.bmap with disabled transparency can be fixed just by adding c5 in bagedit:
(http://puu.sh/xB3C1/a32b005893.png)