Jump to content

How to use flora on urp12


yangjianing
 Share

Recommended Posts

I created my grass spawner, and spawned many grass on terrain. I enabled the flora system in the spawner, and I used flora manager to create a flora terrain tile.

But all the grass was gone when I played the game. And I don't know what source data is. There is no material box to be filled, and I can't add mesh of grass to the source data(UnassignedReferenceException: The variable m_mesh of DetailScriptableObject has not been assigned.
You probably need to assign the m_mesh variable of the DetailScriptableObject script in the inspector.)

Link to comment
Share on other sites

Did you spawn the grass again after enabling Flora in the spawner? Normally when you first activate flora in the resource settings of the spawner, it should create a working flora configuration for this spawn rule. When you spawn the spawner, Gaia should set up the flora terrain tile component automatically and also copy all the flora settings into the flora component. Here is an example with a single grass / terrain detail:

When activating Flora in the resource settings, Gaia should set up those Flora settings for you (which you then can change of course e.g. to set up a different grass model etc. instead):

image.png

When you unfold those entries you can see a lot of additional settings. Initially it creates two different LODs (level of details):

image.png

When you run this spawner, the Flora Terrain Tile Component should be added to the terrain, and the configuration from the spawn rule should be copied in there:

image.png

During runtime, the original terrain detail should be hidden now, and the flora items should be displayed instead. To double check whether this is working correctly, you can check under the terrain in the hierarchy, if there is one prototype object per flora scriptable object, then it should be working correctly:

image.png

Link to comment
Share on other sites

I think what's happening, as it's happened to me over and over now, is that the Flora is losing it's materials for whatever reason after entering and exiting runtime. Only way I've been able to resolve is to remove the flora data from the flora folder, re-import the grass spawner and re-spawn the grass to re-establish initial spawn and flora data, lods,etc...

FYI: Seems to happen mostly after executing a save of the spawner or biome controller (another major issue I've come across).

Link to comment
Share on other sites

22 hours ago, Mike P said:

I think what's happening, as it's happened to me over and over now, is that the Flora is losing it's materials for whatever reason after entering and exiting runtime.

Thanks for bringing that to our attention, we were not aware of this being an issue yet, we will do some testing on saving and loading to see if we can reproduce the issue.

Link to comment
Share on other sites

Perhaps related, I have seen a bunch of issues in the release notes for Unity 2021.2 about serialisation problems. If Peter can not replicate, then this data loss this may very well be related to Unity.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

I tried it on 2020LTS urp, but I still can't use that. It's easy to replicate, because I had never succeeded with my own spawner. 

Create a new spawner from manager, and enable flora, apply the grass texture or mesh, then spawn and play. Nothing will appear. 

And there would be no Source data in flora, no PW DetailQuad Low, no material, no grass on runtime. And I can't apply them my self.

 

So I decided to do more test, and I disabled my renderer pipeline, swiched it to built-in. Then everything was fine, flora worked.

After that, I switched to urp, spawned again, and it still worked.

As a result, I think there is some problem with urp when creating new a spawner, and maybe only the spawner created in built-in rp can be used.

 

 

By the way, does flora use GPU instancing? Can I use gpu instancer with flora? I don't feel too much about optimization when there are still so many Tris and Verts

Link to comment
Share on other sites

@yangjianing From the description it sounds like you would create a new spawner, activate flora, then apply the grass texture. The potential problem with that is that at the moment when you activate flora, it tries to create the flora configuration out of what has been set up for the unity terrain detail, resulting in those empty source data objects for flora that you were describing.

Could you please try the following to see if it works?

1. Create a new spawner
2. Create a new spawn rule
3. In the resource settings of the spawn rule, switch to terrain detail and assign any texture to it (for the purpose of the experiment any texture should do)

image.png

4. Enable Flora - You should now get 2 Flora LODs that were automatically created based off that texture

image.png

5. Run the spawner -
You should see the flat texture being spawned during design time, when you run the scene, Flora should kick in and render this texture on the quad meshes instead. You could then proceed to switch out those quad meshes and materials of flora with more elaborate configurations.

Link to comment
Share on other sites

So would it be suggested not to mess with Flora on URP at the moment ?

 

Does flora have any documentation ?

What is a Flora ?

Link to comment
Share on other sites

I found I can use texture grass with flora now if I follow the right workflow(create a spawner and apply texture then enble flora), but it still not supports for prefab grass. Flora won't create mesh or material for prefab grass automatically and prefab grass won't appear on runtime

Link to comment
Share on other sites

2 hours ago, yangjianing said:

I found I can use texture grass with flora now if I follow the right workflow(create a spawner and apply texture then enble flora), but it still not supports for prefab grass. Flora won't create mesh or material for prefab grass automatically and prefab grass won't appear on runtime

Yeah I was trying to do... pretty much anything with it today.... 2021.2.7f w/urp 12.2.something w/Gaia DLd from yesterday (so the jan 7? Build)

i tried adding grass to the terrain then adding flora and it added the grass to flora but I couldn't paint it into the terrain. Then I tried manually adding a detail mesh prefab and not only did it not work, flora also lost the link to the grass.

and the drag and drop add to flora didn't work at all.

I also didn't get any flag in gena to use flora (using the beta gena from around dec15)

 

'in the end I dropped nature renderer into the project to make sure my terrain wasn't borked and instant grass

Edited by BunnyViking
Link to comment
Share on other sites

@yangjianing Sorry about the delayed response - I found that there is a bug with the Gaia integration when trying to create a Flora config from an unity terrain detail that uses a mesh. Could you please try to assign the terrain detail a texture in the Gaia spawner, then autocreate the flora config from that? Then you should be able to assign your own mesh in the Flora configuration this way.
Here is an example, let's assume you have this cube prefab set up as a detail object:


image.png

To render that cube in Flora instead, you would need to assign a texture in the detail object (this will temporarily remove the cube, and put a texture in the terrain detail instead), and enable Flora:

image.png

Now you can switch back to the cube, and also assign the cube model / prefab in the Flora configuration:

image.png

The cube model should then be rendered by Flora during runtime, and you can adjust the Flora settings / Flora material to your liking. 
image.png

Please note that this is meant as a workaround to get you going, we need to fix this so this configuration would be correctly created from the prefab in the resource settings to begin with. We will have this fixed in the next Gaia update.


 

Link to comment
Share on other sites

On 1/15/2022 at 11:32 AM, BunnyViking said:

Does flora have any documentation ?

The flora documentation was outdated and was still displaying information from a previous iteration, I just gave it an overhaul. You can find it here:
 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Interesting Articles

    1. 0

      Game Ready Level - Fantasy Kingdom 02

    2. 6

      Can't get tessellation to work properly

    3. 0

      Gaia and VR

    4. 1

      Can scene optimizer be used for object spawn in run-time?

    5. 1

      Spawning with certain rotation

×
×
  • Create New...