How to preserve/restore track materials+collision

flonch

New Member
Hello,

I'm trying to understand the process of importing .scne files into blender, making required changes to track geometry, then exporting back into .bgo3/.scne (using build_asset.bat). When I test the track in game the base scene is missing materials (magenta color), though the subscene objects appear fine as they were not modified. The result is basically what is shown at the bottom of the OP in the SCNE Importer thread, however I don't seem to be able to use bagedit to copy and paste things as described. Bagedit gives me a fatal assert error when trying to copy anything more than an individual component or value as described in this thread.

Could someone please explain what the workflow is in order to resolve the issue? My goal is to be able to import/export/build a base scene file and keep the material, collision, etc. as it was. Essentially make no actual changes but confirm the workflow is correct.

Here is the current procedure I am using:
- Import "mods\example\data\track\exampletrack\exampletrack_base.scne" into blender (default import options)
- Export as .bgo3
- build_asset.bat on file exported above

Any help would be appreciated.

Edit: I forgot to mention that when I try enabling the "material (partial, no uv) checkbox while importing, the resulting .bgo3 file fails to build with the following error.
Code:
Building Scene: c:/program files (x86)/steam/steamapps/common/wreckfest/mods/example2/data/track/exampletrack/exampletrack_base.bgo3
Validating verts for: #static_cube_map
Validating verts for: driving line001#decal
Warning: Surface Settings does not exists: decal ()
Validating verts for: great_decal#decal
Validating verts for: inner_wall1
Validating verts for: inner_wall2
Validating verts for: outer_wall
Validating verts for: track_surface
CommandLine: "C:\Program Files (x86)\Steam\steamapps\common\Wreckfest\tools\bgeometry.exe"  -v -input "C:\Program Files (x86)\Steam\steamapps\common\W
reckfest\mods\example2\data\track\exampletrack\exampletrack_base.bgo3" -output "C:\Program Files (x86)\Steam\steamapps\common\Wreckfest\mods\example2\
data\track\exampletrack\exampletrack_base.scne"
Assert failed! ..\Library\blib\src\btoolcore\Bgo2Scne.cpp(1555): "strstr(get_relative_path(blend_c->file).c_str(), "_blend_c.tga")" invalid terrain bl
end material
Regardless of whether that material checkbox is enabled during import, the exported .bgo3 is about 12% the size of the one which is supplied by the bugbear example itself.
 
Last edited:

Mazay

Member
The "Models" part is mostly useful for reference as the SCNE importer destroys material's Uv-mapping and high quality models.

If Bagedit fails to copy paste parts alternative way to combine files is using subscenes. You can have for example, exampletrack_base.scne and exampletrack_base_mychanges.scne

Delete in original base file using Bagedit parts you are planning to change (set number to 0).
Then export the changed parts to separate file, and add that as subscene to original base.

In bagedit, right click subscenes > prepend first item
Add following matrix and refer the new subscene:
bagedit add subscene.png
 
Last edited:

Mazay

Member
- build_asset.bat on file exported
If you set paths in addon preferences Blender will run build_asset.bat for you.

when I try enabling the "material (partial, no uv) checkbox while importing, the resulting .bgo3 file fails to build with the following error.
To get material importing fully working import only to .Blend file that have been already saved to disk and make sure you have latest bgo exporter.

Also as there is not UV-map materials won't show anyways, unless you use them on your own model. for example.


Exported .bgo3 is for if you made a new object for Wreckfest or did a new track from scratch.
Subscene exporter is the older tool, it's basically equivalent to using .Bgo Exporter with only subscenes checked:

a1424m.png

I recommend bgo exporter most of time as it exports all parts.
 
Last edited:

flonch

New Member
Thanks Purple, your guide is what helped me get started with modding but unfortunately I could not find the answer there.
Thanks for the insight Mazay, however I'm not entirely sure subscenes will accomplish what I'm trying to do.
Just to reiterate, I'm editing the track/terrain itself which does not appear to be considered a subscene.
This is the extent of the track modifications currently:
Untitled.png

Looking in bagedit, I can find the terrain data under models > # - terrain > Base mesh > 0 > Meshes > Batches. Is it possible to use a similar technique for a model opposed to a subscene?

Edit: I just noticed that the exported .bgo3/built .scne only shows 28 batches for the terrain meshes, while the stock .scne contains 86, looks like some data goes missing during the process.

Side Note: The main topic of the thread has been dealing with missing textures from an exported base scene, however there are other big issues such as base scene collision not working, as well as the terrain surface feeling like ice at times. The issue is a bit bigger than just the visuals, but I thought this would help me solve the others. Is this just not a viable goal based on the current state of wreckfest modding?
 
Last edited:

Mazay

Member
Thanks for the insight Mazay, however I'm not entirely sure subscenes will accomplish what I'm trying to do.
Subscene is just reference to other .scne file, for example to model of tree.
But with subscene at 0,0,0 coordinate you can also combine two map files into one. Imagine it like layers. So you can have your changes in new one.

Just to reiterate, I'm editing the track/terrain itself which does not appear to be considered a subscene.
This is the extent of the track modifications currently:
View attachment 5945
You cannot change ground models, unless you plan to retexture them completely.
What you could do is cut out that new bumb you made, texture it, and export the bumb alone.
Then combine two files using subscene so new model gets added on top of original file.


there are other big issues such as base scene collision not working, as well as the terrain surface feeling like ice at times.
Surface physics might be affected by missing uv mapping.
Try make everything about square polygons when modeling driving surfaces.

Collisions can be enabled by adding Custom property > CustomData > col = true to object:
a1429J.png
Check also Bugmenu addon, it can do this with one click.

Also check the old example image, still applies to Blender 2.90 by all parts except materials slots:
 
Last edited:

flonch

New Member
With subscene at 0,0,0 coordinate you can combine two map files into one. Imagine it like layers. So you can have your changes in new one.
Ah I see, I've been correlating subscenes with props and stuff like that, but it's good to know that a subscene can be a scene itself.

You cannot change ground models, unless you plan to retexture them completely.
What you could do is cut out that new bumb you made, texture it, and export the bumb alone.
Then combine two files using subscene so new model gets added on top of original file.
Honestly at this point I'm seriously considering retexturing everything. The example image I shared was just an extremely simple test, but I'm really trying to modify/translate parts of the terrain opposed to simply adding on top of it.

I'm a bit confused whether I need to recreate the materials by hand in blender, whether I can import them, or whether it needs to be done in bagedit. Could you clarify that bit?
I'm able to check the "materials (partial, no uv)" option when importing, and successfully build the exported .bgo3 now thanks to the tip about saving .blend to disk before import.
Here's where I'm at now, before:
20201211135433_1.jpg
After:
20201211134815_1.jpg

It looks like the import/export process preserved some of the materials, but not quite sure what to make of the terrain. Seems like some minor progress, but it looks like the "missing" magenta color from before mixed in with terrain textures.

Also still hoping for some clarification on this observation below, I don't understand why I get less batches listed after import/export/build. This is the case regardless of whether materials are imported.
Edit: I just noticed that the exported .bgo3/built .scne only shows 28 batches for the terrain meshes, while the stock .scne contains 86, looks like some data goes missing during the process.
Edit: Some additional observations
- The number of triangles from the 28 batches (mod) matches the number of triangles from the 86 batches (stock).
- The 28 batches all only show "sandroad#gravel#blend" as their material (this is the first material of several on the terrain mesh).
- Many of the material textures contain "tmp" in the bitmap filepath, opposed to the track (i.e. "sandpit3").
- The specular color, and glossiness bitmaps are the same as the ambient color bitmap; while self-illumination, and specular level are the same as diffuse color bitmap (unlike stock base scene which uses different indices i.e. 01, 04, 05).
- Manually modifying a single batch material+textures via bagedit to match the data from the stock track resulted in some progress, however I don't understand why it is still magenta-ish.
20201211144932_1.jpg


Collisions can be enabled by adding Custom property > CustomData > col = true to object:
Check also Bugmenu addon, it can do this with one click.

Also check the old example image, still applies to Blender 2.90 by all parts except materials slots:

Surface physics might be affected by missing uv mapping.

Try make everything about square polygons when modeling driving surfaces.
Thank you.
 
Last edited:

Mazay

Member
What you need to do to get materials working is by minimum redo material mapping. (UV Editing > UV > Unwrap)
It's quite bit of work.
After that materials should show up in Wreckfest.

To see what you are doing in Blender you have to place correctly named .tga file in the folder path refered by Blender. (and restart Blender)
a1426I.png
Check the node properties to see the .tga assigned.
You can make your own image or convert one with help of Breckfest.

it looks like the "missing" magenta color from before mixed in with terrain textures.
Pink color is something I am not sure why it happens now because you have the textures.
Might be related to #Blend material requiring 2 uv maps.

I don't understand why I get less batches listed after import/export/build.
Batching is automatic process of slicing large models into pieces, maybe some change triggers different slicing.

One reason might be if there is lod models. Importer imports only the most low quality one (#lod2 here) :
a1430P.png
 
Last edited:

flonch

New Member
What you need to do to get materials working is by minimum redo material mapping. (UV Editing > UV > Unwrap)
It's quite bit of work.
After that materials should show up in Wreckfest.
Oh right, forgot about UV maps. It looks like all the vertices are assigned to the first slot as well (sandroad#gravel#blend), which explains why that was the only material I was seeing for terrain in bagedit.
This is going to take a while.

To see what you are doing in Blender you have to place correctly named .tga file in the folder path refered by Blender. (and restart Blender)
Definitely needed at this point, though I wonder if you can help me with 2 related issues.
1. Breckfest doesn't seem to like "..._n.bmap" files and results in an exception. Is there a way to resolve this, or do people just exclude those files since they aren't the diffuse texture/not as useful.
2. Breckfest doesn't seem to output .tga, any suggestions for batch converting the .png's? I haven't been able to find anything free which allows for offline batch conversions. Manually converting key files seems like my only option right now.

Pink color is something I am not sure why it happens now because you have the textures.
Might be related to #Blend material requiring 2 uv maps.
2 UV maps as in duplicate the first one?

Batching is automatic process of slicing large models into pieces, maybe some change triggers different slicing.

One reason might be if there is lod models. Importer imports only the most low quality one (#lod2 here) :
I'm not sure what could be changing in that case, considering it occurs even when importing and exporting immediately without really changing anything. From what I understand, either the BGO exporter, or whatever build_asset.bat is calling under the hood is causing the terrain to get sliced into larger sections. My fear is that I won't be able to get the textures to apply correctly because vertices which should belong to different batches might be getting merged together. Not sure if you saw the edits in my earlier post, but I noticed that the 28 batches contain the same number of triangles as is shown in blender for the terrain mesh.
Also I don't think it has anything to do with lod, at least there is no sign of it under terrain.
Stock vs modded
Untitled.png Untitledmodded.png
 

Mazay

Member
I'd say unless you plan to make your own custom textures, I would ignore the _n and _s textures. They may not look correct in Blender anyways.

I think Irfanview could probably do batch conversion from png to tga.

#Blend material have one uv for material placement/splat map and one for grass/sand/asphalt density etc.

Model batches seen in Bagedit is mostly performance optimization I think. It should not really affect anything. Perhaps updated build_asset use different batch size. When you import model in Blender all 86 batches are merged into one object. You can actually still find them if you go into edit mode and select linked vertices. (keyboard L).
 
Last edited:

flonch

New Member
I'd say unless you plan to make your own custom textures, I would ignore the _n and _s textures. They may not look correct in Blender anyways.

I think Irfanview could probably do batch conversion from png to tga.
Thanks, and Irfanview worked great.

#Blend material have one uv for material placement/splat map and one for grass/sand/asphalt density etc.
Are there any references for blend material grass/sand/asphalt/etc. density? Never used UV maps to convey density data before.

Model batches seen in Bagedit is mostly performance optimization I think. It should not really affect anything. Perhaps updated build_asset use different batch size. When you import model in Blender all 86 batches are merged into one object. You can actually still find them if you go into edit mode and select linked vertices. (keyboard L).
I see, that is good to know. Regarding my initial concerns about the batch count, it seems that as I start assigning vertices to the proper materials the amount shown in bagedit increases.

Some observations:
  • Assigning other materials to terrain vertices (opposed to the first slot, sandroad#gravel#blend) seems to export/build fine without any work necessary in bagedit.
  • Assigning the "sandroad#gravel#blend" material to vertices seems to not export/build correctly, and requires additional work in bagedit to correct.
    • In the stock track file, the other materials are shown to contain 12 textures while "sandroad#gravel#blend" only contains 10 (no refraction or displacement).
    • In the modded track file, "sandroad#gravel#blend" is shown to contain 12 textures. Removing the ones which are not needed, and adjusting the other bitmaps to match the stock file resolves that issue I had earlier since everything was assigned to that material originally (see image 2 and 3).
Any idea what would be causing that one material to need manual touch-ups in bagedit post export/build? I was looking at the material nodes in the shading workspace of Blender, but there doesn't seem to be any relation, maybe removing the transmission node might make a difference but I have a feeling that will cause some other bitmaps not to be included consequently.

20201212114709_1.jpg20201212120143_1.jpg20201212120556_1.jpg

Anyway thanks for all the help Mazay, couldn't have got this far without you.
 

Mazay

Member
Are there any references for blend material grass/sand/asphalt/etc. density?
There is the example track and track modding document in tools, but both are unfortunately for 3dsmax.

If you set up following nodes you should be able to see #Blend shading and mapping in Blender:


Here Princibled BSDF controls what exports and Diffuse BSDF is the Blender only shading.

Any idea what would be causing that one material to need manual touch-ups in bagedit post export/build?
#Blend material seems to always generate the 12 materials setup when exporting. I have no idea how to export #Blend with only 10 materials.
I have heard the extra materials may not cause problems and can be left there. But what else is wrong with material mapping? Wrong texture?

Anyway thanks for all the help Mazay, couldn't have got this far without you.
You're welcome. Great to see you making good progress!
 

flonch

New Member
#Blend material seems to always generate the 12 materials setup when exporting. I have no idea how to export #Blend with only 10 materials.
I have heard the extra materials may not cause problems and can be left there. But what else is wrong with material mapping? Wrong texture?
Looks like the extra 2 material slots were not causing issues as I originally thought, but it was due to the improper textures I mentioned. The exported scene was showing the following textures for the material slots, several missing.
Code:
data/art/levels/sandpit/textures/road_sandpit3_sand_01_c.bmap
data/art/levels/sandpit/textures/road_sandpit3_sand_01_ns.bmap <<< missing/invalid
data/art/levels/sandpit/textures/road_sandpit3_sand_01_c.bmap
data/art/levels/sandpit/textures/road_sandpit3_sand_01_ns.bmap <<< missing/invalid
data/art/levels/sandpit/textures/road_sandpit3_sand_01_c.bmap
data/art/levels/sandpit/textures/road_sandpit3_sand_01_ns.bmap <<< missing/invalid
data/art/textures/tmp_blend_c.bmap
data/art/textures/tmp_blend_c.bmap
data/art/textures/tmp_macro_ns.bmap <<< missing/invalid
data/art/textures/tmp_color_c.bmap <<< missing/invalid
data/art/textures/tmp_clutter_color_t.bmap <<< missing/invalid
data/art/textures/tmp_clutter_mask_t.bmap <<< missing/invalid
This is how the material slots were set in a stock scene file.
Code:
data/art/levels/sandpit/textures/road_sandpit3_sand_01_c.bmap
data/art/levels/sandpit/textures/road_sandpit_sand_04_ns.bmap
data/art/levels/sandpit/textures/road_sandpit3_sand_01_c.bmap
data/art/levels/sandpit/textures/road_sandpit_sand_04_ns.bmap
data/art/levels/sandpit/textures/road_sandpit3_sand_01_c.bmap
data/art/levels/sandpit/textures/road_sandpit_sand_04_ns.bmap
data/art/textures/tmp_blend_c.bmap
data/art/textures/detailblend_white_c.bmap
data/art/textures/ground_macro_soil_spec_01_ns.bmap
data/art/levels/sandpit/textures/color_road_sand_02_c.bmap
 

Mazay

Member
That's really interesting find. I didn't before realize such materials exist.

I researched and there is two ways to add #blend material. Shortcut way with 4 materials that turns into 12 materials after build_asset.
Long way is to fill all material slots in Blender.

I updated now the Importer so that when there is less than 12 materials all will import.

Tell me how it works
 
Last edited:

flonch

New Member
Tested out importer 0.8.1, and everything looks good to me, no missing/invalid textures for the 10 slot material anymore.
 
Top