RigsOfRods / rigs-of-rods

Main development repository for Rigs of Rods soft-body physics simulator

Home Page:https://www.rigsofrods.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

More grass layers do grass blades in same places.

cryham opened this issue · comments

Having more grass layers in .tobj creates grass blades in same places.
Looks odd and due to grass sway they switch between each other.
Very long ago we were fixing such issues in PagedGeom, maybe something useful is in our PagedGeom code in old Stunt Rally. I don't remember where, but surely randomness (also grass placing) is bad in PagedGeom, and it needs to not reset seed for each grass layer. Or set seed to random from time.

0451e](https://github.com/RigsOfRods/rigs-of-rods/assets/720641/7c404dfb-5c66-43ee-a900-e3005bef675a) ![0456e
0457e`

I found out where I fixed it in PagedGeom.
https://github.com/stuntrally/stuntrally/blob/master/source/paged-geom/GrassLoader.cpp#L130
Main part here:

	void GrassLoader::loadPage(PageInfo &page)
	{
		//Generate meshes
		bool first = true;  ///T

		std::list<GrassLayer*>::iterator it;
		for (it = layerList.begin(); it != layerList.end(); ++it)
		{	GrassLayer *layer = *it;

			if (first)  ///T once for all layers
				layer->parent->rTable->resetRandomIndex();
			first = false;

We have PagedGeom sources inside old SR, this is an older fork of it.
My changes are marked with ///T, could be useful to check them all.

Probably all those later are needed to fix this too:
commenting out: //parent->rTable->resetRandomIndex();
so:
https://github.com/stuntrally/stuntrally/blob/master/source/paged-geom/GrassLoader.cpp#L868
https://github.com/stuntrally/stuntrally/blob/master/source/paged-geom/GrassLoader.cpp#L936
https://github.com/stuntrally/stuntrally/blob/master/source/paged-geom/GrassLoader.cpp#L1009

To be honest, I think the PaGeom grass is ugly and unoptimal either way. PaGeom itself is weird:
-"trees" really means custom meshes of any kind- but it only makes sense if they use same mat which isn't really emphasized in doc.
-"grass" is this ugly hardcoded 2 polys crossed. So 90's. Today even potato chip handles more polys as long as they're one draw call.
-recently I coded a scene inspector and noticed PaGeom inserts and shuffles thousands of scene nodes. I haven't investigated further but I got the impression each grass clump is an entity which feels horrific.

Personally I'd rather dump Paged grass altogether and used the #3030 feats to generate more detailed grass in bigger batches, possibly using the shell texturing trick or combined

Sure, I agree PagedGeom is the worst now. But this is a quick fix for current issue.
Is the new system for grass something that will happen soon? If so I'll wait. If not then I'd say this is worth fixing.
I'm also confused if there is any roadmap or release timeline for all these PRs with improvements etc?

The new system for grass will come as side effect of #3030 that I keep pointing you to :) I'm intensively focusing on that and it will be done at the end of February latest, though probably earlier.

Though yes, a quick fix for the PagedGrass would be good. But we have paged sources outside of our tree: https://github.com/RigsOfRods/rigs-of-rods/blob/master/conanfile.py#L20 and IIRC the Loader system was somewhat modular, so maybe the way to go is to create custom loader with these updates.

I'm sure the community would appreciate a roadmap but I was never able to follow one, I get incredibly frustrated fixing the minor glitches that bother players and I escape to more fundamental things that the community hardly cares about. But most importantly, I'm the only dev around who's able to look at the codebase hollisitically, others just do narrow (though major in gameplay/quality-of-life gain) features.

Ah okay. Yeah there is so much stuff in #3030 that I didn't expect grass there too :)
Okay I'll wait for that, will be easier.
I'm not keen with dependencies. It seems like I'd need to submit patch for official paged-geom and then AnotherFoxGuy would need to update script etc. Not needed, if you'll just ditch paged-geom so soon.

Well thats my wishful thinking anyway. I'll create a prototype grass generator soon, but I can't predict how the community will react, the paged grass isnt ugly 100% of the time.

@AnotherFoxGuy how would you approach this? Create a patched Conan package or try to override GrassLoader in game source?

@ohlidalp Why not submit the patch upstream?
For the OGRE 1.11 version we still use our own fork of paged-geom

Ah good. Where is it?

Ah good. Where is it?

We use this repo: https://github.com/RigsOfRods/ogre-pagedgeometry

Merged in good faith - I didn't find time to build it.

Okay. @AnotherFoxGuy this probably needs updating deps right, could you do it?
I checked last dev build and it still looks the same with grass.

I will update the package soon