Giter Site home page Giter Site logo

tasks about hidecrosswalks HOT 24 OPEN

citiesskylinesmods avatar citiesskylinesmods commented on August 23, 2024
tasks

from hidecrosswalks.

Comments (24)

kianzarrin avatar kianzarrin commented on August 23, 2024

Currently the node textures with cross walks removed have sharp transitions:
Screenshot (223)

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.
    download
    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.

kianzarrin avatar kianzarrin commented on August 23, 2024

Ground_Node__AlphaMap
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.

kianzarrin avatar kianzarrin commented on August 23, 2024

I can't use mod tools to take a full dump
Screenshot (225)
I have to DIY

from hidecrosswalks.

kianzarrin avatar kianzarrin commented on August 23, 2024

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.

chameleon-tbn avatar chameleon-tbn commented on August 23, 2024

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

image

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.

image

the bugfix aka Chamëleon

from hidecrosswalks.

kianzarrin avatar kianzarrin commented on August 23, 2024

@thebugfixnet thanks . I haven't got around supporting bridge and tunnel transactions yet. I'll update the mod info.

from hidecrosswalks.

kianzarrin avatar kianzarrin commented on August 23, 2024

@thebugfixnet Fixed the E/B/T problem It was a one word fix!
Screenshot (231)

I kind of wished I had done this sooner and have saved you the effort of reporting all this.

from hidecrosswalks.

chameleon-tbn avatar chameleon-tbn commented on August 23, 2024

No problem - it is fixed that's all that is important 🥇 I'll test again :)

from hidecrosswalks.

chameleon-tbn avatar chameleon-tbn commented on August 23, 2024

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.Action1 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.

kianzarrin avatar kianzarrin commented on August 23, 2024

@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.

kianzarrin avatar kianzarrin commented on August 23, 2024

@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?

I did got this though:
Screenshot (232)

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.

kianzarrin avatar kianzarrin commented on August 23, 2024

I closed the game and opened it again. I can't reproduce this any more.
Screenshot (234)

@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.

chameleon-tbn avatar chameleon-tbn commented on August 23, 2024

@kianzarrin - the pipette Tool of NS2 still not work for me. If i click
image
just nothing happens.

from hidecrosswalks.

kianzarrin avatar kianzarrin commented on August 23, 2024

I failed to provide always/never options. The speed is just not fast enough. It requires optimization. I will postponed this feature.

from hidecrosswalks.

kianzarrin avatar kianzarrin commented on August 23, 2024

This is my current progress on smoothing node textures. I am blending in the segment textures into node textures after cropping out the crosswalks.
Screenshot (241)
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.

kianzarrin avatar kianzarrin commented on August 23, 2024

I managed to smoothen out the barrier APR of the 4L road.:
Screenshot (1)

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:
Screenshot (243) - Copy
Edit: same image with increased contrast:
piant edited

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:
Screenshot (246) - Copy

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:
node melt_APRMap

from hidecrosswalks.

Cgameworld avatar Cgameworld commented on August 23, 2024

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.

kianzarrin avatar kianzarrin commented on August 23, 2024

I fixed #2 using hackish code. I also mostly solved the asym roads. But the 2+3 NExt2 road has some problems.

from hidecrosswalks.

kianzarrin avatar kianzarrin commented on August 23, 2024

Comparing the two images bellow (this is the vanilla 4 lane avenue), the zebra crossings of the lod texture starts after and offset:
RoadMediumnode_d
RoadMediumNode_LOD-No Name-rgb

I had to hard code 16 pixels offset into my code.

This is the preview of the mesh and the UV in blender:
Screenshot (292)

Why is there an offset for the lod textures. is it the same for all the [custom] roads?

from hidecrosswalks.

kianzarrin avatar kianzarrin commented on August 23, 2024

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.
Screenshot (294)

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.

kianzarrin avatar kianzarrin commented on August 23, 2024

I patched TMPE to updatesegment() Everything works :)
Screenshot (296)

from hidecrosswalks.

originalfoo avatar originalfoo commented on August 23, 2024

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.

kianzarrin avatar kianzarrin commented on August 23, 2024

@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.

kianzarrin avatar kianzarrin commented on August 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.