Search Unity

Make blender game objects work with windzones in unity?

Discussion in 'Game Design' started by Xaxper, Dec 12, 2020.

  1. Xaxper

    Xaxper

    Joined:
    Dec 10, 2020
    Posts:
    1
    Hello,

    For some time now I've been working on designing a forest in blender to implement into a game in unity. I've designed some tree, plant and grass variants that I want to start building the map with - but there is one thing drawing me back. Windzones.

    I've done research everywhere but I cannot seem to find an answer to it. I want these pants and trees to be affected by a windzone in unity but when I apply one they simply dont move. I have no experience using unity, and after finding NOTHING online I resorted to the forum.

    Is there a condition that I need to set in blender before exporting into unity, or do I have to do something to the game object in order to make it "visible" to the windzone? If so then id be glad if someone gave a brief description of what needs to be done, so i can go off and do it myself.

    I've attached a picture of the object I'm working on now. I imagine the effect can be applied differently to different types of vegetation. I'm not bothered about the material now either, I wanted to sort this issue out before I develop the plants further
     

    Attached Files:

  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    From the WindZone docs:

    And from everything I've looked for, there's no way to query a WindZone to determine the speed vector at a given position.

    So, I don't think there's a way to do what you're doing, and you might need to roll your own solution for this. (In which case, you'd likely need to rig the model, and rotate the bones dynamically based on wind speed.)
     
  3. Ukounu

    Ukounu

    Joined:
    Nov 2, 2019
    Posts:
    208
    It won't work this way. Unity windzones require very specific vertex coloring for models that should be affected by wind. Unity tree shaders then use that vertex color data to bend trees depending on wind direction/strength. Solutions:
    1) Use Unity built-in tree modeler (GameObject > 3D Object > tree). It produces tree models with all required vertex color data already baked into 3D models. This is the fastest and easiest solution.
    2) Use one of assets for designing trees/vegetation from the Asset Store. Some of them allow making trees with wind support, or adding wind vertex color data into your custom 3D models.
    3) If you want to make your own custom trees in Blender affected by wind without using Unity built-in trees or any third party assets, you'll have to manually vertex-color all your models and then write a custom wind shader bending trees according to wind direction and vertex color data. This is an extremely complex task even for experienced developers, so it's better to use solutions #1 or #2.
     
  4. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    551
    Is there any info on how Unity tree shader works? Because I cant imagine a vertex painting for such task to be too complicated. Basically, only single channel needed to control the intensity of the deformation
     
  5. Ukounu

    Ukounu

    Joined:
    Nov 2, 2019
    Posts:
    208
    DimitriX89 likes this.
  6. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    551
    Thanks, thats more complicated than I expected, but doable. Main trouble is that "bend and sway intensity" is in UV channel instead of vertex color. But nothing what manual UV unwrap couldnt solve