Git Product home page Git Product logo

Comments (6)

kianzarrin avatar kianzarrin commented on August 20, 2024
public static bool HasSameNodeAndSegmentTextures(NetInfo info, Material nodeMaterial, int texID) {
    foreach (var seg in info.m_segments) {
        Texture t1 = nodeMaterial.GetTexture(texID);
        Texture t2 = seg.m_segmentMaterial.GetTexture(texID);
        if (t1 == t2)
            return true;
    }
    return false;
}

FUN FACT: Loading screen mod changes how t1==t2 works in the code above. (I understand loading screen mod tries to minimize memory usage by removing duplicate textures from memory)

  • Loading Screen mod is off:
    • NExt2 2 lane road with painted median: t1==t2 is true
    • 3 lane road with bike lane: t1==t2 is false
  • Loading Screen mod is on:
    • NExt2 2 lane road with painted median: t1==t2 is true
    • 3 lane road with bike lane: t1==t2 is true

from hidecrosswalks.

kianzarrin avatar kianzarrin commented on August 20, 2024

I just uploaded a hack applying HasSameNodeAndSegmentTextures code only to NExt2 assets. But I like to find a proper solution.

from hidecrosswalks.

kianzarrin avatar kianzarrin commented on August 20, 2024

Another difference I found is that:

  • NExt2 ELEVATED 2 lane road with painted median texture is 2048 x 1024 (main texture | node and segment texture are identical)
  • other roads have 1024 x 1024 texture (both m_nodeMaterial and m_segmentMaterial)

Is that the condition I should be looking for to exempt from hide crossings?

Still don't understand why the segment texture is rendered but node texture is not.

from hidecrosswalks.

kianzarrin avatar kianzarrin commented on August 20, 2024

Just to be safe side I tested the following on the NExt2 elevated 2 lane road with painted median:
1- if I clone the material but do not do any texture processing, nothing changes.
2- the output of my texture processing has same size as input : 1024 x 2048?

so if texture.width != texture.height and m_nodeMaterial.MainTexture == m_segmentMaterial.MainTexture then do not hide crossings. is this the condition I should be looking for?!

from hidecrosswalks.

andreharv avatar andreharv commented on August 20, 2024

Ok so roads are a bit weird. There is the diffuse map, the APR map and the XYS map. The APR map is a mask blends asphalt or pavement textures into the diffuse map. In this case, I set the APR map to replace the whole roadway with straight up asphalt. Thus the node and segment diffuse maps are the same but their APR maps are different. The processing you are doing is it different per road or is this a one size fits all programatic change? You can either skip it as it does not have zebra crossings or you could simply change the diffuse texture in the roadway to just black if you are doing manual alterations for each road. I don't remember my rationale for making this intersection without crosswalks. I don't remember if elevated vanilla roads have crosswalks either.

from hidecrosswalks.

kianzarrin avatar kianzarrin commented on August 20, 2024

@andreharv Sorry for the late response. Thank you so much for the info. This helps me make my code much more reliable.

The processing you are doing is it different per road or is this a one size fits all programatic change?

I blend Alpha map from segment into node. And its all automatic. I'll just make hard coded exceptions for NExt2 roads.

I don't remember my rationale for making this intersection without crosswalks

All NExt2 small/small_heavy ground roads use the same node texture from vanilla small road. You cannot do that for elevated roads because of the size difference between vanilla elevated roads and NExt2 elevated roads. I guess you did not have time to draw crosswalks yourself. or maybe you forgot. bigger elevated roads do not have this size mismatch problem so for bigger roads you can use vanilla crosswalks.
Screenshot (929)

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.