Comments (24)
Currently the node textures with cross walks removed have sharp transitions:
I am trying to SMOOTH out the node textures. I do not want to create PNG files manually because that approach is not practical for custom roads. This also reduces precious production time.
-
One way is to use the ARPMap of the segment textures and make it gradually fade out.
-
I am also thinking I don't need to crop out the node textures I can simply use a 1x1 texture with the median color of the Main texture. ( 1x1 textures are rendered properly :) )
Future idea:
-
additionally I am thinking of replacing the crosswalks with a stop line. This is going to further distract the user from sharp node textures. But I think I should only do so when there is a yield or stop sign. Another exciting improvement of TMPE :) though I think this should probably should be a prop not texture.
-
some node textures have built in stop line and crosswalks. In the image bellow the stop line for parking is part of the node texture but the stop line for cars is part of the road texture.
What to do ... what to do? adding a stop line prop here could be bad! maybe we can Ask people to be NS2 friendly and create extra node textures if they really want their junctions to be pretty. We can have options weather or not to add stop line when there is a Yeild/stop sign (only when stop line texture is not found).
from hidecrosswalks.
The picture above shows NEXT2 asym-6L ARPMap with road texture under the node texture. According to this picture I don't see how melding road ARP into node ARP is possible.
EDIT: Perhaps I can check for values that are too high and replace them with low values. I need to check a bunch of other ARP maps to be sure.
from hidecrosswalks.
I can't use mod tools to take a full dump
I have to DIY
from hidecrosswalks.
when caching textures its important that my OnLevelLoaded is called after TMPE.
In order to determine mod orders I traced the code to LoadAssembliesRO
string[] files = Directory.GetFiles(modPath, "*.dll", SearchOption.AllDirectories);```
So it is kind of random. `m_LevelLoaded` event is called before `OnLevelLoaded()`.
It seems I have no choice but to Patch the loading functionality.
from hidecrosswalks.
Hi @kianzarrin - As you asked me on Steam for some information what are E/B Model of roads.... (E)levated/(B)ridge ;) I think that makes it clear
So if you have a road transition ground to elevated, ground to bridge, bridge to bridge or elevated to bridge the crossings are not removed at all on all the roads i mentioned in my comment on Steam.
the bugfix aka Chamëleon
from hidecrosswalks.
@thebugfixnet thanks . I haven't got around supporting bridge and tunnel transactions yet. I'll update the mod info.
from hidecrosswalks.
@thebugfixnet Fixed the E/B/T problem It was a one word fix!
I kind of wished I had done this sooner and have saved you the effort of reporting all this.
from hidecrosswalks.
No problem - it is fixed that's all that is important 🥇 I'll test again :)
from hidecrosswalks.
Could this be cause by your update? I have nothing new -only your mod is updated...
Seems to collide with Garbage Bin Controller https://steamcommunity.com/sharedfiles/filedetails/?id=1386697922 ???
A Mod caused an error [System.Exception] Details: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: No target method specified for class VanillaGarbageBinBlocker.PropManagerDataPatch (declaringType=, methodName =AfterDeserialize, methodType=, argumentTypes=NULL) at Harmony.PatchProcessor.PrepareType () [0x00000] in :0 at Harmony.PatchProcessor..ctor (Harmony.HarmonyInstance instance, System.Type type, Harmony.HarmonyMethod attributes) [0x00000] in :0 at Harmony.HarmonyInstance.b__6_0 (System.Type type) [0x00000] in :0 at Harmony.CollectionExtensions.Do[Type] (IEnumerable1 sequence, System.Action
1 action) [0x00000] in :0 at Harmony.HarmonyInstance.PatchAll (System.Reflection.Assembly assembly) [0x00000] in :0 at VanillaGarbageBinBlocker.UserMod.OnEnabled () [0x00000] in :0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception
from hidecrosswalks.
@thebugfixnet I disabled Harmony self patching as NS2 does to make it compatible with Real time mod. I will have a look into this.
from hidecrosswalks.
@thebugfixnet I cannot reproduce the problem. Can you please tell me the minimum number of mods to reproduce the problem and does removing my mod solves it?
My mods were:
Garbabe bin controler
Hide TMPE crosswalks V2.2 ALPHA
TMPE labs
NS2
Unlock all roads.
I will try to get to the bottom of it.
from hidecrosswalks.
I closed the game and opened it again. I can't reproduce this any more.
@thebugfixnet enabling and disabling mods does not always work due to an internal bug in the game resulting in "zombie" mods. You need to restart CS particularly if you migrate between different mod versions.
from hidecrosswalks.
@kianzarrin - the pipette Tool of NS2 still not work for me. If i click
just nothing happens.
from hidecrosswalks.
I failed to provide always/never options. The speed is just not fast enough. It requires optimization. I will postponed this feature.
from hidecrosswalks.
This is my current progress on smoothing node textures. I am blending in the segment textures into node textures after cropping out the crosswalks.
The 4L road has problem with median. Clamping the APR values should solve this problem.
The 6L road has a another problem. Mismatch between node texture and segment texture. so the blending has created a sharp edge. I don't know why 4L road does not have this problem.
I am of-course stretching the textures before blending them.
from hidecrosswalks.
I managed to smoothen out the barrier APR of the 4L road.:
The 6L road is still creating a sharp junction texture. the APR maps of the node and segments are the same size. here I have put segment texture under the node texture:
Edit: same image with increased contrast:
EDIT:
- Roads affected by this (APR mismatch): all Meduim/Large Vanilla/NExt2 roads which do not have decoration or central barriers. ( haven't tested it on small roads due to complications)
- Roads not effected by this: all roads that have decorations (Grass/trees) or central barriers.
- conclusion: So it seems that roads without decorations/barriers, scale the node texture differently.
- problem: I do not know what exactly to look for (is there a field or a flag I need to check) to distinguish such roads from others and I do not know how much is the scaling factor. I have some ways of dealing with this problem in mind (check for a central lane without cars, check if road has decorations) but I am worried they may be hackish and complex and not future proof. I need to know what is the best solution to this problem rather than shooting in the dark.
It is not very obvious why It creates a sharp transition like shown in the first screenshot
EDIT: in the first screenshot for the 6L road, the segment to junction transition looks good in the middle of the texture. But it is being displaced outward as we go further away from the center. To understand why this happens for the 6L road and not the 4L road I am including the 4L APR too:
All these textures are 1024x1024
I Do not understand why there is no texture displacement for the 4L but there is for 6L road. They both use the same piece of code.
//simplified code: all textures are 1024x1024
Color[] colors2 = tex2.GetPixels(0, yM2, tex2.width, 1);
for (int j = 0; j < yM; j++) {
Color []colors = tex .GetPixels(0, j, tex.width, 1);
float w= (float)j / (float)yM; //weight
for (int i = 0; i < colors.Length; ++i) {
Color c = colors[i];
Color c2 = colors2[i];
colors[i] = c * w+ c2 * (1 - w);
}
ret.SetPixels(0, j, tex.width, 1, colors);
}
ret.SetPixels(0, yM, tex.width, tex.height - yM, tex.GetPixels(0, yM, tex.width, tex.height - yM));
EDIT: bellow is the segment APRMap under the result of the code above:
from hidecrosswalks.
Roads affected by this (APR mismatch): all Meduim/Large Vanilla/NExt2 roads which do not have decoration or central barriers. ( haven't tested it on small roads due to complications)
- Roads not effected by this: all roads that have decorations (Grass/trees) or central barriers.
- conclusion: So it seems that roads without decorations/barriers, scale the node texture differently.
- problem: I do not know what exactly to look for (is there a field or a flag I need to check) to distinguish such roads from others and I do not know how much is the scaling factor. I have some ways of dealing with this problem in mind (check for a central lane without cars, check if road has decorations) but I am worried they may be hackish and complex and not future proof. I need to know what is the best solution to this problem rather than shooting in the dark.
Awesome to see the progress of this project
The scaling mismatch of the node textures could be due to the uv map on the node meshes being different, depending on the road. Try copying the uv map from another road’s node
You can also try grabbing the uv coordinates of the mesh with this
PrefabCollection<NetInfo>.FindLoaded(road).m_nodes[0].m_mesh.uv
The mesh uv coordinates could be grabbed from each side of the road at the curb and a scale factor calculated based on that?
from hidecrosswalks.
I fixed #2 using hackish code. I also mostly solved the asym roads. But the 2+3 NExt2 road has some problems.
from hidecrosswalks.
Comparing the two images bellow (this is the vanilla 4 lane avenue), the zebra crossings of the lod texture starts after and offset:
I had to hard code 16 pixels offset into my code.
This is the preview of the mesh and the UV in blender:
Why is there an offset for the lod textures. is it the same for all the [custom] roads?
from hidecrosswalks.
I made some progress with the lods. I replaced the original lod textures with new ones for testing just to prove my lods are good.
I am having trouble to switch between normal textures and lod textures when TMPE activates and deactivates crosswalks. I think the problem is that segment textures are not updated when TMPE pans crossing.
I probably will end up patching TMPE using harmony.
from hidecrosswalks.
I patched TMPE to updatesegment() Everything works :)
from hidecrosswalks.
Did it have any performance impact?
IMO, assuming we will be deprecating the old v10.20 STABLE branch it might be worth updating TMPE if there's no performance hit. We could test it on v11 ALPHA (which will become v11 LABS soon) once v11 STABLE is live.
from hidecrosswalks.
@aubergine10 Did it have any performance impact?
IMO, assuming we will be deprecating the old v10.20 STABLE branch it might be worth updating TMPE if there's no performance hit. We could test it on v11 ALPHA (which will become v11 LABS soon) once v11 STABLE is live.
It takes a few seconds to patch so that adds to startup time. No big deal for now but I work arounds tend to pile up if not dealt with.
I am not planning to support depricated TMPE.
It works with all TMPE versions.
from hidecrosswalks.
Benchmarking:
Info 417.5347036: BENCHMARK> totalCollisions=0 averageCollisions=0
Info 417.5356472: BENCHMARK> peforming cache speed benchmark:
Info 417.6368915: BENCHMARK> Done peforming cache speed benchmark 469*1000 times
Info 417.6382061: Benchmarking Done!
so 469 materials cause no cache collision and take 0.1 sec load from material cache.
from hidecrosswalks.
Related Issues (16)
- Benchmarking/performance thread HOT 3
- why some nodes have same textures as segment? HOT 6
- moving to harmony 2. HOT 1
- Check node is not null
- Bug report HOT 8
- No scrolling in exceptions list HOT 5
- Crosswalks do not hide on Industrial Highway
- Fix road/node texture mismatch on "plain" roads HOT 3
- Possible Compatibly issue with "Garbage bin collector" mod HOT 4
- Detect inverted Asym. Rd. textures
- System.TypeLoadException: Could not load type 'NetworkSkins.Skins.NetworkSkin' HOT 1
- some roads have bad textures HOT 22
- Error in output log HOT 7
- Texture replacement bug HOT 6
- crashes because incompatible mod patches NetNode.RenderInstance HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hidecrosswalks.