Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

unity3d - Queriable, Dynamic Textures in Unity

I'm building a farming sim, and am trying to simulate soil quality as a part of the simulation. If soil quality is a scalar over the 2d surface of the terrain, it seems to me that I should be able to represent it just as an invisible B/W texture, with each pixel representing the soil quality at a given location. The soil quality should effect how well plants grow, and should change as a function of time and user input, so I also need to be able to query and change the values of this texture every frame. Is this something I can do in Unity? Where should I start trying to implement this?

question from:https://stackoverflow.com/questions/65856955/queriable-dynamic-textures-in-unity

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

As for detecting soil quality. If the soil will be part of a terrain object. You should be able to get a working solution if you detect the texture type used at a given position as per the guide in this link: https://gamedevbeginner.com/terrain-footsteps-in-unity-how-to-detect-different-textures/

You can then try "paint" the terrain texture values as per the guide in this link, to reflect updating soil quality: https://answers.unity.com/questions/1743422/paint-terrain-texture-on-runtime.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...