Porting content - Stunt Rally tracks exporter

But is it possible now to have such packs?
E.g. I just packed 1 track terrain textures into terrain.zip, and I've put it in:
/home/ch/.rigsofrods/mods
/home/ch/_p/rigs-of-rods-dev2/content
/home/ch/_p/rigs-of-rods-dev2/resources
or all files in:
/home/ch/.rigsofrods/mods/terrain/
And I always see black terrain. Am I missing something? Seems only way working is having textures inside track dir.
Have you tried placing the textures in resources/textures.zip? Recently had to rename the texture used by Asphalt Wash as it conflicted with the default asphalt.dds.
Few questions for blendmap, just to confirm, I think all are yes:
1. How many terrain layers is max? Is 5 still okay?
2. Is R,G,B and A channel supported in blendmap.png?
3. Are different sizes okay? E.g. road blendmap 1024 and terrain blendmap 512?
1. 6 layers is max, however one layer is taken up by shadows so in reality you're limited to 5. This is why Auriga Proving Grounds is missing its detail texture when shadows are enabled.
2. Pretty sure blendmaps are only RGB, never seen one with an alpha channel.
3. Different sizes should work OK as long they're power of two.
I fixed it by having 0 for Alpha in diffuse+specular, so basically no specular at all. Only this gives me normal looking terrain now.
This is correct, specular is defined by the alpha channel. Diffuse and normal map textures must be exported in a RGBA format such as DDS or TGA.
On Linux (OpenGL), specular and normal maps are always enabled to prevent black terrains. This is why some terrains appear dark under OpenGL as they lack proper normal maps.
I have no fog or rain.
Fog and rain/snow are effects provided by Caelum sky. Fog hasn't worked since at least version 0.37 (see: #410). Rain requires loading a custom Caelum config with CaelumConfigFile terrn2 setting, you can use this config from the Community Map.
If you do use an .os file, make sure the caelum_sky_system name at the top matches the filename, otherwise it won't work.
 
Thanks. This explains a lot.
Oh man fog is gone since 2015 or so.

I see also a mention of Ogre 2.1. So what devs think of OgreNext now? Latest 3.0 is used in StuntRally3. But yeah took me a year to move. It's an enormous task. And ii you don't get support then it'd be even extremely difficult.

Diffuse and normal map textures must be exported in a RGBA format such as DDS or TGA.
Or PNG. But ugh, seriously I'd need an JPG option that skips A, and makes it 0. Or just disabled in shader.
I mean specular doesn't work properly so why use RGBA with A=0, since any other value does bad white shine. And it also is 3-5x bigger than JPG. I Checked parallax and height as A, and for me it's not that great, is an old method, I got it off always.

Yes, I am writting Caelum config file during export.
Wow is there an easier way here?
julian_day 2457560
time_scale 1
latitude 46 18 52
longitude 6 57 46
I basically have sun pitch and yaw angles, I would maybe translate them to these.
And I'd like to set time too. Some tracks are at sunset or dawn, how to set clock time for RoR map e.g. to 16:00 ?
For latitude and in longitude isn't just 1 value enough? So just degrees.

Okay I got blendmap working now fine.
Road is good too. Not much else possible.

Sometimes I need to tweak some height offset or such, so I added params with sliders to SR3 editor Gui.

As for objects. How do I set scale per object. This isn't possible? Would it be possible to add to code?
So only 1 scale can be set, inside .odef, it's that 1,1,1 on top right?
I mean on SR maps all buildings placed and big rocks have own different scale.
 
Okay I can set scale per object. If I create one .odef with scale for each object on map, still using same mesh.
Don't know how's the performance but works.
 
And I'd like to set time too. Some tracks are at sunset or dawn, how to set clock time for RoR map e.g. to 16:00 ?
julian_day sets the time, You can use a converter like this one to get the value. This would be for today at 16:00:
Code:
    julian_day 2460358.16667
    time_scale 1
Okay I can set scale per object. If I create one .odef with scale for each object on map, still using same mesh.
Don't know how's the performance but works.
That's the correct way to do it, you can set scale and override materials through the odef file.
 
OK, I'll try to put answers together.

Resource packs: at the moment we don't have that, but it wouldn't be a big deal to add - it just never became a priority, I guess somebody suggested it (SimMonsters people perhaps) but I don't have any specific memory. How I'd go about it: Considering how our modcache works (recognizing specific file extensions and then on-demand loading their parent ZIP [='bundle' in my jargon]), I'd introduce something like "*.assetpack" file for the bundle (to specify name and metadata) and `[AssetPacks]` section to the .terrn2 mix it in the terrain RG when loading. The code which loads the bundles: https://github.com/RigsOfRods/rigs-of-rods/blob/master/source/main/resources/CacheSystem.cpp#L1258, modcache doxygen info: https://developer.rigsofrods.org/#autotoc_md12

Object scaling in TOBJ: again not big deal to implement, but I'm sure nobody requested it so far. Parsing: https://github.com/RigsOfRods/rigs-...urces/tobj_fileformat/TObjFileFormat.cpp#L362, spawning: https://github.com/RigsOfRods/rigs-...ce/main/terrain/TerrainObjectManager.cpp#L150. I'd go our usual route of introducing another `set_default_foo` directive like this:
Code:
;set_default_scaling X Y Z (Y is up!; -1 resets the value to default 1.0)
set_default_scaling 1.1, 1.2, 1.3
7,0,7,            0, 0, 0,     crazycone-111
set_default_scaling -1, -1, -1

Port to newer OGRE: not hapenning easily here, the commuinity is very protective of the mods working 'like before' which includes all bundled .Cg shaders and various quirks. This may have to do with former devs trashing all terrains (the original .terrn format) when moving to OgreTerrain (circa 2010), even though the format could have been preserved by forcing OgreTerrain to use classic .material files (which I later added to .terrn2).

Terrain texturing: Rather tragic due to presence of OgreTerrain which doesn't respect classic OGRE .materials and has it's own Cg-based shader generator hardwired to use "diffusespecular" (RGB=color, A=specular) and "normalheight" (RGB=normal, A=heightmap). I'm open to any change here (to all modders and players: PLEASE DO NOT PANIC, backward compat is guaranteed), personally I see the future in greater use of meshed decals https://github.com/RigsOfRods/rigs-of-rods/pull/3030#issuecomment-1937363587 and we positively need to employ a tiling-reduction approach in the shaders https://docs.unrealengine.com/udk/T...Mixing: Reducing tiling through scalar mixing. Also the in-development texture blitting support https://github.com/RigsOfRods/rigs-of-rods/pull/3030#issuecomment-1941817110 could be utilized to generate complex textures from a handful of base patterns.
 
Allright thanks for info.
So @only_a_ptr will you be implementing these? I think the first needed for SR is Resource packs.

I'm okay with that set_default_scaling syntax. Would be good and shorter than having many .tobj (for each object placed). I'm also okay with the latter for now.

Well I think I'm finally getting somewhere. Or should I better say we're nearly there.
Since pics/screens are more worth, here's another batch.

Reminds me of an old version of SR now. But with cooler vehicle sounds and physics.
Fog would be great here too.

There are a few bugs still. Rotations / yaw angles aren't like they should.
I don't know why, grass stays out of road, but trees/rocks still get placed on road in some places.

BTW what does highDensity do, if trees are just white pixes on densitymap? I'm also having trouble adjusting how many trees there will be, from SR values.
 

Attachments

  • a560.jpg
    a560.jpg
    332.6 KB · Views: 84
  • g627.jpg
    g627.jpg
    355 KB · Views: 81
  • j602.jpg
    j602.jpg
    372.1 KB · Views: 79
  • jd095.jpg
    jd095.jpg
    227.7 KB · Views: 75
  • jd185.jpg
    jd185.jpg
    279.8 KB · Views: 78
  • j600.jpg
    j600.jpg
    367.4 KB · Views: 81
  • jd204.jpg
    jd204.jpg
    273.4 KB · Views: 75
  • t037.jpg
    t037.jpg
    462.6 KB · Views: 85
  • t042.jpg
    t042.jpg
    500 KB · Views: 75
  • g613.jpg
    g613.jpg
    335.7 KB · Views: 78
  • g559.jpg
    g559.jpg
    385.8 KB · Views: 77
  • c486.jpg
    c486.jpg
    340.4 KB · Views: 78
  • c512.jpg
    c512.jpg
    359 KB · Views: 77
  • cr503.jpg
    cr503.jpg
    279 KB · Views: 72
  • cr517.jpg
    cr517.jpg
    390.5 KB · Views: 71
  • dc396.jpg
    dc396.jpg
    193.9 KB · Views: 72
  • f67.jpg
    f67.jpg
    248.3 KB · Views: 72
  • f78.jpg
    f78.jpg
    219.9 KB · Views: 77
  • f139.jpg
    f139.jpg
    305.3 KB · Views: 75
Last edited:
Ah I finally found a better way for resources, while I'm using a recent dev build (not building from sources).
I'm just putting all needed SR stuff into resources/paged.zip, then it's loading on all tracks.
So if you wouldn't code Resource packs, then I think there is an alternative: I could just provide a big (about 300-500MB I guess) pack, for all future SR based tracks for RoR) and it could go into RoR resources dir and be loaded too.
BTW how and when do you release, and do you have a roadmap (I noticed many things going on branches, PRs etc), I saw one but seemed old.

I also noticed a few bugs in RoR:
- grass in layers are at same positions:
https://github.com/RigsOfRods/rigs-of-rods/issues/3128
- water is white outside terrain, I'm using: Water effects=Reflection + refraction (quality optimized)
- water is black or dark on shore borders (stuff isn't rendered), gets more visible with higher waves.
- is water level uninitialized? I am rarely having a huge value, after load, covering whole screen with garbage. And it goes to normal, if I touch water level slider. But still messed minimap stays.
- just a feature request: I really, really miss an option (key binding) to jump to tracks list and load another (map). I'm testing and dealing with a lot of them. Could you add it or should I?

As of OgreNext, well I understand. Pity because this compatibility motto is holding you back from doing rendering improvements somewhat. And making stuff better. But yeah I have a completely different situation and approach with SR. I do improve all tracks myself once a while. Last time I did replace all skies to new ones. And we're in process of adding horizons to all tracks. Since SR started, I did like 8 such total improvements. Obviously they need to have a copyleft license, and had in SR always.
Well I recommend OgreNext,, since it solved lags for me an allowed horizon terrains, etc. But still really advanced engine, and no support on forums since few months now. I'm sure I won't try moving RoR to OgreNext, I can help with it, I'm actually more tempted to try integrating RoR code (at least simulation) into SR but that's another crazy difficult task I should avoid.

I did a test (by accident having too many tress) and yeah just remembered the horrible lags from PagedGeometry, aka IMHO the worst library for modern GPUs vegetation rendering. I would just recommend adding an option in Ogre 14 for using auto instanced meshes, even no impostors, should be easiest to code and give no lags. May be bad without LODs though.
So in RoR it was 60 fps when still, but when moving dropped to like 10 with a lot of (too much) vegetation, with huge delays/lags.
 
I think I've fixed the trees/rocks on road issue, it's not perfect.
Now this is so much fun :D
Made a driving video. At end it also shows SR3 Track Editor it's export and briefly Gui settings for it.

 
As of OgreNext, well I understand. Pity because this compatibility motto is holding you back from doing rendering improvements somewhat. And making stuff better.

What you are doing will help, dont you think? Offering great new content alternatives to originals. I sure hope so, at least. There are always the old RoR versions for those who want to use old content.

Now this is so much fun :D
Made a driving video. At end it also shows SR3 Track Editor it's export and briefly Gui settings for it.

Awesome!!
 
I had some good progress again.
Fixed rotations for road, checkpoints, and objects.
Only yaw angle (up Y rotation). For buildings this is enough. I think I won't bother with pitch/roll for objects. This took me a while last time for bullet, to fix some other x,y,z, too many combinations.
And now also racing works. I'm using an invisible mesh material to skip checkpoints, still having triggers. IDK yet, I made a broad 20 m wide 14 m tall checkpoint box. Maybe it'd be good for all roads on tracks. SR had each check as sphere and each had own radius. I actually like your rotated boxes more.

We also got fog, and tested rain too.
In .terrn2, this is close fog:
CaelumConfigFile = Jng18-Tiny.os
CaelumFogStart = 0
CaelumFogEnd = 68
Setting these also fixed: water is white outside terrain
Here is another bug video for devs, I believe water waves level is uninited. It's random, and sometimes it's huge, doing whole screen garbage, then setting it with slider fixes it, before moving.

There are still things to fix. Like bridges entry level, sharp bridge turns. And setting surface properties.
And rest is just adjusting stuff with sliders for each track and testing it.

Anyways, here are new screens :D
 

Attachments

  • a0101`.jpg
    a0101`.jpg
    531.9 KB · Views: 77
  • at0167`.jpg
    at0167`.jpg
    444.1 KB · Views: 72
  • c0194`.jpg
    c0194`.jpg
    278.2 KB · Views: 71
  • c0481`.jpg
    c0481`.jpg
    329.3 KB · Views: 75
  • d0253`.jpg
    d0253`.jpg
    250.5 KB · Views: 74
  • d0266`.jpg
    d0266`.jpg
    286.2 KB · Views: 79
  • dc0496`.jpg
    dc0496`.jpg
    306.2 KB · Views: 79
  • dc0511`.jpg
    dc0511`.jpg
    230.8 KB · Views: 70
  • dc0530`.jpg
    dc0530`.jpg
    358.4 KB · Views: 67
  • fd0385`.jpg
    fd0385`.jpg
    455.5 KB · Views: 79
  • fg0013`.jpg
    fg0013`.jpg
    415.1 KB · Views: 77
  • fg0417`.jpg
    fg0417`.jpg
    268.9 KB · Views: 66
  • fh0158`.jpg
    fh0158`.jpg
    219.2 KB · Views: 64
  • fh0472`.jpg
    fh0472`.jpg
    348.5 KB · Views: 72
  • fm0043`.jpg
    fm0043`.jpg
    403.7 KB · Views: 68
  • fo0074`.jpg
    fo0074`.jpg
    422.7 KB · Views: 97
  • g0542`.jpg
    g0542`.jpg
    533.8 KB · Views: 86
  • g0547`.jpg
    g0547`.jpg
    482 KB · Views: 76
  • gc0098`.jpg
    gc0098`.jpg
    239 KB · Views: 60
  • gc0103`.jpg
    gc0103`.jpg
    211.2 KB · Views: 63
  • gh0355`.jpg
    gh0355`.jpg
    288.5 KB · Views: 63
  • gh0363`.jpg
    gh0363`.jpg
    247.8 KB · Views: 65
  • i0141`.jpg
    i0141`.jpg
    336.3 KB · Views: 69
  • i0378`.jpg
    i0378`.jpg
    252.7 KB · Views: 68
  • ju0248`.jpg
    ju0248`.jpg
    337.3 KB · Views: 68
  • m0311`.jpg
    m0311`.jpg
    367.7 KB · Views: 75
  • n0209`.jpg
    n0209`.jpg
    466.9 KB · Views: 137
  • s0314`.jpg
    s0314`.jpg
    155.5 KB · Views: 71
  • u0147``.jpg
    u0147``.jpg
    142.2 KB · Views: 68
  • u0295`.jpg
    u0295`.jpg
    348.7 KB · Views: 69
  • w0225`.jpg
    w0225`.jpg
    441.5 KB · Views: 76
  • z0180`.jpg
    z0180`.jpg
    330.7 KB · Views: 59
  • z0402`.jpg
    z0402`.jpg
    228 KB · Views: 70
Also there is another bug: being in race and loading other map, doesn't cancel race as on screenhots. Game still counts time and shows arrow, I can't fix it, need to quit RoR.
Another weird thing I had 2 times just now is that water reflection is not flipped vertically (last screen).
 

Attachments

  • 0019`.jpg
    0019`.jpg
    422.2 KB · Views: 106
  • 0067`.jpg
    0067`.jpg
    248.5 KB · Views: 81
  • 0089`.jpg
    0089`.jpg
    169.4 KB · Views: 75
Okay I added code (in SR3 editor) to check what's needed and auto set assetpacks in terrn2.
Also started writing in our docs about how to setup and use it. I guess you'll update your docs when official?

Sorry if I'm being too fast with this. Maybe we could finalize to get something ready this weekend?
There are few crucial things I'd like to discuss (and fix/code) before I upload any assets.

- I got road roll angles now working. PR is here. I'd like it merged as it change, in allmost all tracks.
I either need all zeros (without PR) or real values in SR tracks (after PR merge).

- That .tobj 'set_default_scaling'. Because it also changes all SR tracks content.

- Should I upload a terrain pack 406 MB (and other (extra) with 132 MB)
with png files? And don't care about size?
Or should we first code this jpg (terrain texture) loading of RGB only, no Alpha.
This would make it much smalller (212 MB total for both).

- Can I call all SR tracks with prefix: ^Grc2-Coast or +Grc2-Coast or so in RoR?
I mean that first ^ or + etc.
It's easier since they're on top of RoR list.
Or will there be a new group made in code for this instead? Still would be mixed in list when all visible.

- Can I upload again a same version assetpack if I want to fix something in it, and get rid of previous version?
In case I'd need to fix or update something and have all tracks still work.

- what should I put in .assetpack file, is this ok?
assetpack_name "sr-grass-v1"
assetpack_description "SR data/grass pack 1"
- I don't get that last line:
assetpack_author crazycone 351 ohlidalp

I'm the assetpack_author okay, but I didn't create its resources (none of them).
So I am putting a _*.txt file with all info (author, link and lincese) for all resources in a pack. Hope this is okay.
I'm just copying such files from SR2 data dirs _grass.txt _terrain.txt, _objects*, trees-old (has few) and so on.

- one more important thing
Vegetation density. IDK how this all will perform on laptops etc. Either way PagedGeom does lags.
IMO it's up to user to set how much vegetation should be.
I don't see as a solution in that old way of doing -FPS track variants w/o trees etc.
So I think RoR GUI should have settings for trees and grass multipliers.
(SR has it since long, and SR3 even can apply changes, no track reload needed).

Just curious: can you tell me when will you do an official next release, last one was in 12.2022? And what's needed for it to happen.
Note that assetpacks, tobj scaliing, roll angles (etc) will need users to use latest build (not last release) to use SR tracks at all.

And lastly some offtopic, does the RoR guy in that shirt have a name?
 
Last edited:
Okay I added code (in SR3 editor) to check what's needed and auto set assetpacks in terrn2.
Also started writing in our docs about how to setup and use it. I guess you'll update your docs when official?

Sorry if I'm being too fast with this. Maybe we could finalize to get something ready this weekend?
There are few crucial things I'd like to discuss (and fix/code) before I upload any assets.

- I got road roll angles now working. PR is here. I'd like it merged as it change, in allmost all tracks.
I either need all zeros (without PR) or real values in SR tracks (after PR merge).

- That .tobj 'set_default_scaling'. Because it also changes all SR tracks content.

- Should I upload a terrain pack 406 MB (and other (extra) with 132 MB)
with png files? And don't care about size?
Or should we first code this jpg (terrain texture) loading of RGB only, no Alpha.
This would make it much smalller (212 MB total for both).

- Can I call all SR tracks with prefix: ^Grc2-Coast or +Grc2-Coast or so in RoR?
I mean that first ^ or + etc.
It's easier since they're on top of RoR list.
Or will there be a new group made in code for this instead? Still would be mixed in list when all visible.

- Can I upload again a same version assetpack if I want to fix something in it, and get rid of previous version?
In case I'd need to fix or update something and have all tracks still work.

- what should I put in .assetpack file, is this ok?
assetpack_name "sr-grass-v1"
assetpack_description "SR data/grass pack 1"
- I don't get that last line:
assetpack_author crazycone 351 ohlidalp

I'm the assetpack_author okay, but I didn't create its resources (none of them).
So I am putting a _*.txt file with all info (author, link and lincese) for all resources in a pack. Hope this is okay.
I'm just copying such files from SR2 data dirs _grass.txt _terrain.txt, _objects*, trees-old (has few) and so on.

- one more important thing
Vegetation density. IDK how this all will perform on laptops etc. Either way PagedGeom does lags.
IMO it's up to user to set how much vegetation should be.
I don't see as a solution in that old way of doing -FPS track variants w/o trees etc.
So I think RoR GUI should have settings for trees and grass multipliers.
(SR has it since long, and SR3 even can apply changes, no track reload needed).

Just curious: can you tell me when will you do an official next release, last one was in 12.2022? And what's needed for it to happen.
Note that assetpacks, tobj scaliing, roll angles (etc) will need users to use latest build (not last release) to use SR tracks at all.

And lastly some offtopic, does the RoR guy in that shirt have a name?
i think he is called rorbot, at least that what is call him.
 
Well I almost finished exporter. Fixed some bugs too.
I wrote another tool in it, that converts SR surfaces.cfg to RoR groundmodel. I'm still tweaking friction and other params here.

I added our wheel/surface particles from SR. Few work now.

Rain, snow, fog from SR3 setup works.
I don't like the RoR Caelum's way for rain etc, it's buggy, when camera moves.
SR has rain etc it in real 3D, and yeah I move the emitter by prediction further from car etc.

It's a matter now of selecting tracks fit for RoR and fixing/tweaking any bad auto setup manually to drive well.

I'm waiting for you guys.
@only_a_ptr I'd need this PR merged (fixes road roll angles): https://github.com/RigsOfRods/rigs-of-rods/pull/3131
And decision for png terrains, or we need code for jpg.
Possibly also other important from my post. That scaling (instead of separate .odef)
and some vegetation amount params. I'm not sure if it's buggy too, I get less trees on smaller maps.
@AnotherFoxGuy this PR would be good (should fix grass) https://github.com/RigsOfRods/ogre-pagedgeometry/pull/15
 
I'm adjusting SR tracks for RoR. I got now 47 ready.
Went through all, and total will be 131 max (55% of all) that would be possible in RoR.
Many tracks in RoR are around 2 MB, few 5 MB, and max I saw 9 MB.
 
Back
Top