kianzarrin / NodeController

10 stars 9 forks source link

Inverted Textures on assymetrical nodes and 1way segments #16

Closed Allystrya closed 2 years ago

Allystrya commented 4 years ago

I am expanding the scope of this issue to cover all nodes and segments.


When using Stretch mode the texture flips on the node only as you can see from the lines on the side of the roads. Bend and Middle modes do not do this. It won't flip even with Electrix's Road tools flipper

image

kianzarrin commented 4 years ago

the texture needs to be flipped if the road is inverted XOR the start and end nodes are the other way around.

kianzarrin commented 4 years ago
public struct RenderManager.Instance
{
    public Texture m_dataTexture0;
    public Texture m_dataTexture1;
    public Matrix4x4 m_dataMatrix0;
    public Matrix4x4 m_dataMatrix1;
    public Matrix4x4 m_dataMatrix2;
    public Vector4 m_dataVector0;
    public Vector4 m_dataVector1;
    public Vector4 m_dataVector2;
    public Vector4 m_dataVector3;
...
}

I know  this will inverse the direct connect tracks:
```csharp
m_dataVector2.x = - m_dataVector2.x;
m_dataVector2.y = - m_dataVector2.y

And the fix should be put here: https://github.com/kianzarrin/NodeController/blob/9ddd79dabc872282dbabbcb4d041667d0a888897/NodeController/Patches/RefreshJunctionData.cs#L68

kianzarrin commented 3 years ago

image if the problem can be fixed simply by inverting the segment, it should also be fixable via code easily.

image

I tried different road directions and invert flags. it seems no matter what combination I try, the node is always rendered in the same way.

bend node solves this problem by rotating the texture/mesh which is not an option at a junction.

kianzarrin commented 3 years ago

image for oneway roads, the direction is always right on exit and always wrong on entry.

kianzarrin commented 3 years ago

@Allystrya the issue of oneway segments can be resolved by the asset designer if he sets forward/backward flags correctly ... i think I also fixed it by code. not sure if that was a good idea image this is for the segments. nodes are a different story.

kianzarrin commented 2 years ago

fixed