JuniorDjjr / UnityProceduralStochasticTexturingNode

Procedural stochastic texturing node for Unity's Shader Graph
30 stars 1 forks source link

Stochastic Texture Doesn't Tile Across Neighbour Terrains #1

Closed MichaelEGA closed 1 year ago

MichaelEGA commented 1 year ago

Love this node but it doesn't tile across neighbour terrains, it leaves a line.

Would it be possible to make it fade back to a normal tiled terrain at the edges so that you don't get a line?

JuniorDjjr commented 1 year ago

I haven't tested this, but it doesn't seem to make much sense. Does the problem also happen in the URP terrain shader version?

MichaelEGA commented 1 year ago

Actually, sorry to reopen this, but the stochastic node is causing the line between neighbour terrains not the blending. :(

Stochastic Off Desert_StochasticOff

Stochastic On Desert_Storchastic_On

Unfortunately I can't test the URP terrain shader as it pops up pink in my current version of unity 2022.2.2f1. I did have it working previously in an older version, but I didn't focus much on the terran boundaries, so not sure if the problem was present.

JuniorDjjr commented 1 year ago

I think this is really a limitation. The UV randomization is calculated per object local UV position, not world space. I don't know if it is possible to use world space for randomization, probably someone else more experienced in shaders I can answer/fix this.

JuniorDjjr commented 1 year ago

I added a note in the readme. It's possible to avoid that using a mask (such as vertex color) to define where the stochastic effect is affected, so use vertex color painting to remove the stochastic texturing from borders of the model. I don't know if this will help you in this case.

MichaelEGA commented 1 year ago

Thanks for your quick relply.

I successfully eliminated the line by creating a subshader that faded the edges of the terrain back to the non-stochastic texture.

Here's the project I used your node in: https://github.com/michael-evan-allison/Unity-Terrain-Shadergraph

I think we can close this issue.

Thanks again for the great node!

JuniorDjjr commented 1 year ago

This looks very cool!