Search Unity

[RELEASED] Vegetation Studio

Discussion in 'Assets and Asset Store' started by LennartJohansen, Jun 23, 2017.

Thread Status:
Not open for further replies.
  1. tcourbet

    tcourbet

    Joined:
    Oct 5, 2017
    Posts:
    46
    Sorry, for not answering earlier and thanks for the answer! That makes sense.
    At least now I know :)
     
  2. purnamasari

    purnamasari

    Joined:
    Mar 8, 2018
    Posts:
    17
    Hello, I'm using Unity 2018.1.0f2 and VS 1.5.1.0. but seems like there is huge spikes and lagging when I use multiple terrain. I put the other VS to sleep whenever the terrain is not needed. One active VegetationSystem is fine, but more than one, it's really affect the performance.

    How am I supposed to do to improve the performance? My terrain is more than thousand and load dynamically based on player ground. Approximately 3~15 terrain loaded at once. Each terrain had their own VegetationSystem that I put to sleep mode. The VS supposed to be active when it's around the player that is being followed by MainCamera.

    Thank you.
     

    Attached Files:

    dsilverthorn likes this.
  3. purnamasari

    purnamasari

    Joined:
    Mar 8, 2018
    Posts:
    17
    I managed to reduce the spike that probably caused by other coroutine, and yeah coroutine can be expensive if you don't use it right. If anyone experienced the same problem, makes sure you check your profiler. Check every line of script that is related / calling VS. Even one messed up coroutine can affect VS performance.
     
  4. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    256
    hello, for some reason when my player have a point light activated, it increase the tris count significantly because of all the largeobject and object. It look like it has to render the ENTIRE scene (according to polycount) and not just those activated. Is there a way to avoid this (right now, i'm force to remove the largeobject and object layer from the light)

    also, in terms of levelloading. I load my level with async method, but again it load everything, creating a huge freeze time during the loading. Is it possible to load all the vegetation progessivly to fasten up the loading ?
     
  5. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    507
    Hi, I found a cool shader but It doesn't work with VS when I enable instanced render mode:( Is that possible you fix this shader to work with instanced render mode? I really need to use this shader but have no idea how should I make this to work with VS instanced render mode.

    Here is the shader code.

    Code (CSharp):
    1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
    2.  
    3. // Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
    4.  
    5. // Shader created with Shader Forge v1.26
    6. // Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/
    7. // Note: Manually altering this data may prevent you from opening it in Shader Forge
    8. /*SF_DATA;ver:1.26;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,lico:1,lgpr:1,limd:1,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,hqlp:False,rprd:False,enco:False,rmgx:True,rpth:0,vtps:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:2,bsrc:3,bdst:7,dpts:2,wrdp:True,dith:0,rfrpo:False,rfrpn:Refraction,coma:15,ufog:False,aust:False,igpj:False,qofs:0,qpre:0,rntp:1,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.5,fgcg:0.5,fgcb:0.5,fgca:1,fgde:0.01,fgrn:0,fgrf:300,stcl:False,stva:128,stmr:255,stmw:255,stcp:6,stps:0,stfa:0,stfz:0,ofsf:0,ofsu:0,f2p0:False,fnsp:False,fnfb:False;n:type:ShaderForge.SFN_Final,id:4013,x:33745,y:32674,varname:node_4013,prsc:2|emission-9552-OUT,difocc-2251-R,alpha-2625-OUT,clip-7845-OUT;n:type:ShaderForge.SFN_Tex2d,id:2251,x:32294,y:32701,ptovrint:False,ptlb:Diffuse,ptin:_Diffuse,varname:node_2251,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:0,isnm:False;n:type:ShaderForge.SFN_LightAttenuation,id:5187,x:32294,y:32864,varname:node_5187,prsc:2;n:type:ShaderForge.SFN_Multiply,id:1282,x:32575,y:32706,varname:node_1282,prsc:2|A-2251-RGB,B-5187-OUT,C-3867-OUT,D-8908-OUT;n:type:ShaderForge.SFN_Slider,id:3867,x:32137,y:33017,ptovrint:False,ptlb:Diffuse Light,ptin:_DiffuseLight,varname:node_3867,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:3;n:type:ShaderForge.SFN_AmbientLight,id:2159,x:32294,y:33198,varname:node_2159,prsc:2;n:type:ShaderForge.SFN_Multiply,id:685,x:32575,y:32829,varname:node_685,prsc:2|A-2251-RGB,B-2159-RGB,C-5616-OUT,D-1549-OUT,E-3217-OUT;n:type:ShaderForge.SFN_Add,id:6622,x:32805,y:32753,varname:node_6622,prsc:2|A-1282-OUT,B-685-OUT,C-9424-OUT;n:type:ShaderForge.SFN_Vector1,id:1549,x:32575,y:32965,varname:node_1549,prsc:2,v1:3;n:type:ShaderForge.SFN_Slider,id:5616,x:32137,y:33118,ptovrint:False,ptlb:Ambient Light,ptin:_AmbientLight,varname:_DiffuseLight_copy,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:5;n:type:ShaderForge.SFN_RemapRange,id:6141,x:32575,y:33045,varname:node_6141,prsc:2,frmn:0,frmx:1,tomn:-0.5,tomx:2.5|IN-2251-A;n:type:ShaderForge.SFN_Clamp01,id:7983,x:32736,y:33045,varname:node_7983,prsc:2|IN-6141-OUT;n:type:ShaderForge.SFN_RemapRange,id:7845,x:32901,y:33045,varname:node_7845,prsc:2,frmn:0,frmx:1,tomn:0,tomx:5|IN-7983-OUT;n:type:ShaderForge.SFN_RemapRange,id:2625,x:32901,y:32890,varname:node_2625,prsc:2,frmn:0,frmx:1,tomn:0,tomx:1.5|IN-2251-A;n:type:ShaderForge.SFN_NormalVector,id:1402,x:32294,y:32531,prsc:2,pt:False;n:type:ShaderForge.SFN_LightVector,id:5076,x:32294,y:32408,varname:node_5076,prsc:2;n:type:ShaderForge.SFN_Dot,id:8774,x:32532,y:32454,varname:node_8774,prsc:2,dt:1|A-5076-OUT,B-1402-OUT;n:type:ShaderForge.SFN_RemapRange,id:2611,x:32882,y:32454,varname:node_2611,prsc:2,frmn:0,frmx:1,tomn:0,tomx:0.65|IN-9118-OUT;n:type:ShaderForge.SFN_Clamp01,id:9118,x:32706,y:32454,varname:node_9118,prsc:2|IN-8774-OUT;n:type:ShaderForge.SFN_Multiply,id:9424,x:33067,y:32454,varname:node_9424,prsc:2|A-2611-OUT,B-7551-OUT,C-2251-RGB;n:type:ShaderForge.SFN_Vector3,id:7551,x:33067,y:32361,varname:node_7551,prsc:2,v1:0.4587727,v2:0.8014706,v3:0;n:type:ShaderForge.SFN_ObjectPosition,id:3820,x:32294,y:32234,varname:node_3820,prsc:2;n:type:ShaderForge.SFN_Frac,id:2272,x:32470,y:32234,varname:node_2272,prsc:2|IN-3820-XYZ;n:type:ShaderForge.SFN_Multiply,id:9790,x:32993,y:32753,varname:node_9790,prsc:2|A-6622-OUT,B-5425-OUT,C-4135-RGB;n:type:ShaderForge.SFN_RemapRange,id:3642,x:32647,y:32234,varname:node_3642,prsc:2,frmn:0,frmx:1,tomn:0.3,tomx:1.2|IN-2272-OUT;n:type:ShaderForge.SFN_Desaturate,id:2026,x:32838,y:32234,varname:node_2026,prsc:2|COL-3642-OUT,DES-6471-OUT;n:type:ShaderForge.SFN_Vector1,id:6471,x:32838,y:32163,varname:node_6471,prsc:2,v1:0.8;n:type:ShaderForge.SFN_FragmentPosition,id:1307,x:32294,y:32092,varname:node_1307,prsc:2;n:type:ShaderForge.SFN_LightColor,id:4135,x:32993,y:32623,varname:node_4135,prsc:2;n:type:ShaderForge.SFN_FragmentPosition,id:9250,x:31703,y:32645,varname:node_9250,prsc:2;n:type:ShaderForge.SFN_Clamp01,id:3217,x:31933,y:32645,varname:node_3217,prsc:2|IN-6931-OUT;n:type:ShaderForge.SFN_RemapRange,id:6931,x:31703,y:32820,varname:node_6931,prsc:2,frmn:0,frmx:1,tomn:0,tomx:0.1|IN-9250-Y;n:type:ShaderForge.SFN_Blend,id:7043,x:33232,y:32684,varname:node_7043,prsc:2,blmd:10,clmp:True|SRC-9790-OUT,DST-9790-OUT;n:type:ShaderForge.SFN_Blend,id:1845,x:33403,y:32684,varname:node_1845,prsc:2,blmd:10,clmp:True|SRC-7043-OUT,DST-7043-OUT;n:type:ShaderForge.SFN_Lerp,id:9552,x:33403,y:32872,varname:node_9552,prsc:2|A-1845-OUT,B-9790-OUT,T-937-OUT;n:type:ShaderForge.SFN_Vector1,id:937,x:33403,y:32999,varname:node_937,prsc:2,v1:0.8;n:type:ShaderForge.SFN_RemapRange,id:8908,x:31933,y:32820,varname:node_8908,prsc:2,frmn:0,frmx:1,tomn:0.5,tomx:1|IN-3217-OUT;n:type:ShaderForge.SFN_Vector1,id:5425,x:33121,y:32909,varname:node_5425,prsc:2,v1:1;proporder:2251-3867-5616;pass:END;sub:END;*/
    9.  
    10. Shader "Shader Forge/Foliage Flat" {
    11.     Properties {
    12.         _Diffuse ("Diffuse", 2D) = "white" {}
    13.         _DiffuseLight ("Diffuse Light", Range(0, 3)) = 0
    14.         _AmbientLight ("Ambient Light", Range(0, 5)) = 0
    15.         [HideInInspector]_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
    16.     }
    17.     SubShader {
    18.         Tags {
    19.             "Queue"="Background"
    20.             "RenderType"="Opaque"
    21.         }
    22.         Pass {
    23.             Name "FORWARD"
    24.             Tags {
    25.                 "LightMode"="ForwardBase"
    26.             }
    27.             Blend SrcAlpha OneMinusSrcAlpha
    28.             Cull Off
    29.            
    30.            
    31.             CGPROGRAM
    32.             #pragma vertex vert
    33.             #pragma fragment frag
    34.             #define UNITY_PASS_FORWARDBASE
    35.             #include "UnityCG.cginc"
    36.             #include "AutoLight.cginc"
    37.             #include "Lighting.cginc"
    38.             #pragma multi_compile_fwdbase_fullshadows
    39.             #pragma exclude_renderers gles3 metal d3d11_9x xbox360 xboxone ps3 ps4 psp2
    40.             #pragma target 3.0
    41.             uniform sampler2D _Diffuse; uniform float4 _Diffuse_ST;
    42.             uniform float _DiffuseLight;
    43.             uniform float _AmbientLight;
    44.             struct VertexInput {
    45.                 float4 vertex : POSITION;
    46.                 float3 normal : NORMAL;
    47.                 float2 texcoord0 : TEXCOORD0;
    48.             };
    49.             struct VertexOutput {
    50.                 float4 pos : SV_POSITION;
    51.                 float2 uv0 : TEXCOORD0;
    52.                 float4 posWorld : TEXCOORD1;
    53.                 float3 normalDir : TEXCOORD2;
    54.                 LIGHTING_COORDS(3,4)
    55.             };
    56.             VertexOutput vert (VertexInput v) {
    57.                 VertexOutput o = (VertexOutput)0;
    58.                 o.uv0 = v.texcoord0;
    59.                 o.normalDir = UnityObjectToWorldNormal(v.normal);
    60.                 o.posWorld = mul(unity_ObjectToWorld, v.vertex);
    61.                 float3 lightColor = _LightColor0.rgb;
    62.                 o.pos = UnityObjectToClipPos(v.vertex );
    63.                 TRANSFER_VERTEX_TO_FRAGMENT(o)
    64.                 return o;
    65.             }
    66.             float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
    67.                 float isFrontFace = ( facing >= 0 ? 1 : 0 );
    68.                 float faceSign = ( facing >= 0 ? 1 : -1 );
    69.                 i.normalDir = normalize(i.normalDir);
    70.                 i.normalDir *= faceSign;
    71.                 float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
    72.                 float3 normalDirection = i.normalDir;
    73.                 float4 _Diffuse_var = tex2D(_Diffuse,TRANSFORM_TEX(i.uv0, _Diffuse));
    74.                 clip((saturate((_Diffuse_var.a*3.0+-0.5))*5.0+0.0) - 0.5);
    75.                 float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
    76.                 float3 lightColor = _LightColor0.rgb;
    77. ////// Lighting:
    78.                 float attenuation = LIGHT_ATTENUATION(i);
    79.                 float3 attenColor = attenuation * _LightColor0.xyz;
    80. ////// Emissive:
    81.                 float node_3217 = saturate((i.posWorld.g*0.1+0.0));
    82.                 float3 node_9790 = (((_Diffuse_var.rgb*attenuation*_DiffuseLight*(node_3217*0.5+0.5))+(_Diffuse_var.rgb*UNITY_LIGHTMODEL_AMBIENT.rgb*_AmbientLight*3.0*node_3217)+((saturate(max(0,dot(lightDirection,i.normalDir)))*0.65+0.0)*float3(0.4587727,0.8014706,0)*_Diffuse_var.rgb))*1.0*_LightColor0.rgb);
    83.                 float3 node_7043 = saturate(( node_9790 > 0.5 ? (1.0-(1.0-2.0*(node_9790-0.5))*(1.0-node_9790)) : (2.0*node_9790*node_9790) ));
    84.                 float3 emissive = lerp(saturate(( node_7043 > 0.5 ? (1.0-(1.0-2.0*(node_7043-0.5))*(1.0-node_7043)) : (2.0*node_7043*node_7043) )),node_9790,0.8);
    85.                 float3 finalColor = emissive;
    86.                 return fixed4(finalColor,(_Diffuse_var.a*1.5+0.0));
    87.             }
    88.             ENDCG
    89.         }
    90.         Pass {
    91.             Name "FORWARD_DELTA"
    92.             Tags {
    93.                 "LightMode"="ForwardAdd"
    94.             }
    95.             Blend One One
    96.             Cull Off
    97.            
    98.            
    99.             CGPROGRAM
    100.             #pragma vertex vert
    101.             #pragma fragment frag
    102.             #define UNITY_PASS_FORWARDADD
    103.             #include "UnityCG.cginc"
    104.             #include "AutoLight.cginc"
    105.             #include "Lighting.cginc"
    106.             #pragma multi_compile_fwdadd_fullshadows
    107.             #pragma exclude_renderers gles3 metal d3d11_9x xbox360 xboxone ps3 ps4 psp2
    108.             #pragma target 3.0
    109.             uniform sampler2D _Diffuse; uniform float4 _Diffuse_ST;
    110.             uniform float _DiffuseLight;
    111.             uniform float _AmbientLight;
    112.             struct VertexInput {
    113.                 float4 vertex : POSITION;
    114.                 float3 normal : NORMAL;
    115.                 float2 texcoord0 : TEXCOORD0;
    116.             };
    117.             struct VertexOutput {
    118.                 float4 pos : SV_POSITION;
    119.                 float2 uv0 : TEXCOORD0;
    120.                 float4 posWorld : TEXCOORD1;
    121.                 float3 normalDir : TEXCOORD2;
    122.                 LIGHTING_COORDS(3,4)
    123.             };
    124.             VertexOutput vert (VertexInput v) {
    125.                 VertexOutput o = (VertexOutput)0;
    126.                 o.uv0 = v.texcoord0;
    127.                 o.normalDir = UnityObjectToWorldNormal(v.normal);
    128.                 o.posWorld = mul(unity_ObjectToWorld, v.vertex);
    129.                 float3 lightColor = _LightColor0.rgb;
    130.                 o.pos = UnityObjectToClipPos(v.vertex );
    131.                 TRANSFER_VERTEX_TO_FRAGMENT(o)
    132.                 return o;
    133.             }
    134.             float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
    135.                 float isFrontFace = ( facing >= 0 ? 1 : 0 );
    136.                 float faceSign = ( facing >= 0 ? 1 : -1 );
    137.                 i.normalDir = normalize(i.normalDir);
    138.                 i.normalDir *= faceSign;
    139.                 float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
    140.                 float3 normalDirection = i.normalDir;
    141.                 float4 _Diffuse_var = tex2D(_Diffuse,TRANSFORM_TEX(i.uv0, _Diffuse));
    142.                 clip((saturate((_Diffuse_var.a*3.0+-0.5))*5.0+0.0) - 0.5);
    143.                 float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz,_WorldSpaceLightPos0.w));
    144.                 float3 lightColor = _LightColor0.rgb;
    145. ////// Lighting:
    146.                 float attenuation = LIGHT_ATTENUATION(i);
    147.                 float3 attenColor = attenuation * _LightColor0.xyz;
    148.                 float3 finalColor = 0;
    149.                 return fixed4(finalColor * (_Diffuse_var.a*1.5+0.0),0);
    150.             }
    151.             ENDCG
    152.         }
    153.         Pass {
    154.             Name "ShadowCaster"
    155.             Tags {
    156.                 "LightMode"="ShadowCaster"
    157.             }
    158.             Offset 1, 1
    159.            
    160.             CGPROGRAM
    161.             #pragma vertex vert
    162.             #pragma fragment frag
    163.             #define UNITY_PASS_SHADOWCASTER
    164.             #include "UnityCG.cginc"
    165.             #include "Lighting.cginc"
    166.             #pragma fragmentoption ARB_precision_hint_fastest
    167.             #pragma multi_compile_shadowcaster
    168.             #pragma exclude_renderers gles3 metal d3d11_9x xbox360 xboxone ps3 ps4 psp2
    169.             #pragma target 3.0
    170.             uniform sampler2D _Diffuse; uniform float4 _Diffuse_ST;
    171.             struct VertexInput {
    172.                 float4 vertex : POSITION;
    173.                 float2 texcoord0 : TEXCOORD0;
    174.             };
    175.             struct VertexOutput {
    176.                 V2F_SHADOW_CASTER;
    177.                 float2 uv0 : TEXCOORD1;
    178.             };
    179.             VertexOutput vert (VertexInput v) {
    180.                 VertexOutput o = (VertexOutput)0;
    181.                 o.uv0 = v.texcoord0;
    182.                 o.pos = UnityObjectToClipPos(v.vertex );
    183.                 TRANSFER_SHADOW_CASTER(o)
    184.                 return o;
    185.             }
    186.             float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
    187.                 float isFrontFace = ( facing >= 0 ? 1 : 0 );
    188.                 float faceSign = ( facing >= 0 ? 1 : -1 );
    189.                 float4 _Diffuse_var = tex2D(_Diffuse,TRANSFORM_TEX(i.uv0, _Diffuse));
    190.                 clip((saturate((_Diffuse_var.a*3.0+-0.5))*5.0+0.0) - 0.5);
    191.                 SHADOW_CASTER_FRAGMENT(i)
    192.             }
    193.             ENDCG
    194.         }
    195.     }
    196.     FallBack "Diffuse"
    197.     CustomEditor "ShaderForgeMaterialInspector"
    198. }
    199.  
     
  6. Keaneo

    Keaneo

    Joined:
    Mar 7, 2015
    Posts:
    99
    Is it possible to get LOD working with Rocks? How would I test if it's working? I don't see any difference in editor/gameplay when moving the camera.

    Thanks!
     
  7. TauntGames

    TauntGames

    Joined:
    Jan 31, 2016
    Posts:
    14
    Hi there, I am currently using vegetation studio with unity 2018.2.20f1, I have the advanced foliage pack with forest pack loaded and the CTS profile that came with advanced foliage. I have tried various settings with area mask but the vegetation does not remove inside the area. If I use include vegetation it removes from the whole scene using vegetation types. Is there something I am doing wrong perhaps? Any help would be appreciated.

    best regards,

    Steven
     
  8. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    839
    I’m not sure what’s happening there. Just wanted to let you know that when I use the mask function it does as it’s supposed to and remove the items from inside the mask area.
    Hope someone figures this out. You might need to reinstall VS.
     
  9. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. Are you using forward mode or deferred rendering? Multiple lights was not supported when using instancing in forward mode before Unity 2018.2. Even then you need to add an additional #pragma to the shader and the vertexes is processed one time for each light. With deferred mode this is fast as the light is just added to the gbuffer

    When loading a scene with vegetation studio it has to do some init, but if you load terrains outside of the visible distance vegetation will not be loaded before it becomes visible.

    Lennart
     
  10. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. Most surface shaders will upgrade to support instancing automatic.
    For fragment shaders you need to add some additional setup for instancing manually.

    You can see here what Unity requires.

    When the shader supports instancing there is an additional change you can do to support Vegetation Studios Instanced Indirect mode. You can find the needed info here on github.

    Lennart
     
  11. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. You can use rocks with LODs. You need to set up a normal LODGroup on the prefab. Make sure the meshes have the standard naming ending with LOD0,LOD1 etc.

    Then on the render tab enable the settig for CPU culling for objects/large objects to get per instance LOD selection. This is not needed if the shader renders instanced indirect.

    Lennart
     
  12. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. Using CTS or any other terrain shader should not affect this.

    Do you have vegetation baked to the persistent stoage? If you do you need to enable each item (on the storage) to be affected by vegetation masks.

    Lennart
     
  13. TauntGames

    TauntGames

    Joined:
    Jan 31, 2016
    Posts:
    14
    no I tried with and without storage. I add the area mask and nothing happens.

    if I click use with vegetation mask all the grass selected disappears.


    maybe I am overlooking something, sorry.

    Steven
     

    Attached Files:

  14. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. The localized vegetation on the masks is only used if you want some vegetation to be included in the mask area. The Vegetation Item has to be set up with the same ID.

    If you could join the discord server and message me I can help you configues. Easer with a text chat.
    Link in my signature.

    Lennart
     
  15. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    256
    Thanks for your answer
    i'm using unity 2017.3.1f1 in defered mode. Each point light render the whole vegetation of the entire terrain even with culling and independant of distance. I had to remove the layer of the grass and plant to save 12 millions batches out of 2 light that is following the character. They only have a lenght of 9 meter, the draw distance is short, but still. 12 millions batchs. it's annoying subtle light on plan and grass was cool.

    I also saw that the shadowmap take a lot of CPU time (i have long shadow on a low sun). didn't find a way to reduce resolution of the map maybe. The shadow calculation fastest setting is "normal" maybe you can use a "short" setting or let us decide the distance instand of using generic "normal/long" parameter ?

    and for terrain loading, you mean like having the vegetation "off" and then set it on on a coroutine maybe so that the level load. The init is very cpu intensive and very long and it feel like it's loading the entire amount of tree and grass instead of only loading the visible one and those nearb/around the camera. Is there a way to progressively load stuff after level is loaded so that the loading doesn't freeze ?

    Thanks
     
  16. Keaneo

    Keaneo

    Joined:
    Mar 7, 2015
    Posts:
    99
    Hi - thanks for the info I tried and it seems to work well. One problem is that some of the rocks are large and the player can stand on them. If I then rotate the view I can see the LOD change under my feet - it must cull based on the centre of the object? Any way to specify a distance under which no culling occurs? Just wishing really :)
     
    dsilverthorn and Mark_01 like this.
  17. TommiH

    TommiH

    Joined:
    Jan 14, 2008
    Posts:
    253
    Hello Lennart,

    I've run into an issue with initializing Vegetation Studio when I load my scene. It seems Vegetation Studio does some work on OnEnable every time I open the scene, but something must have become corrupted, because every time I get this error:

    Code (csharp):
    1.  
    2. [Exception] ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
    3. Assembly.GetTypes()    <ac823e2bb42b41bda67924a45a0173c3>:0
    4.  
    5. ShaderSelector+<>c.<GetShaderControler>b__0_0()    Assets/AwesomeTechnologies/VegetationStudioPro/Runtime/ShaderSystem/ShaderSelector.cs:18
    6.  
    7. System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext()    <1b13ba6391c74847bbc3eddc86df7eee>:0
    8.  
    9. System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext()    <1b13ba6391c74847bbc3eddc86df7eee>:0
    10.  
    11. ShaderSelector.GetShaderControler()    Assets/AwesomeTechnologies/VegetationStudioPro/Runtime/ShaderSystem/ShaderSelector.cs:22
    12.  
    13. AwesomeTechnologies.VegetationSystem.VegetationItemModelInfo..ctor()    Assets/AwesomeTechnologies/VegetationStudioPro/Runtime/VegetationSystemPro/VegetationItemModelInfo.cs:366
    14.  
    15. AwesomeTechnologies.VegetationSystem.VegetationPackageProModelInfo..ctor()    Assets/AwesomeTechnologies/VegetationStudioPro/Runtime/VegetationSystemPro/VegetationPackageProModelInfo.cs:17
    16.  
    17. VegetationSystemPro.SetupVegetationItemModels()    Assets/AwesomeTechnologies/VegetationStudioPro/Runtime/VegetationSystemPro/VegetationSystemPro_Models.cs:20
    18.  
    19. VegetationSystemPro.SetupVegetationSystem()    Assets/AwesomeTechnologies/VegetationStudioPro/Runtime/VegetationSystemPro/VegetationSystemPro.cs:333
    20.  
    21. VegetationSystemPro_OnEnable()    Assets/AwesomeTechnologies/VegetationStudioPro/Runtime/VegetationSystemPro/VegetationSystemPro.cs:364
    22.  
    23. GUIUtility.ProcessEvent()
    Digging deeper, I discovered that the ReflectionTypeLoadException contained this error:

    Code (csharp):
    1. Could not resolve type with token 01000174 (from typeref, class/assembly System.Collections.Specialized.INotifyCollectionChanged, WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) assembly:WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 type:System.Collections.Specialized.INotifyCollectionChanged member:(null) signature:<none>
    I can't figure out, though, what could be wrong with what looks like a perfectly normal system class...

    Any help will be greatly appreciated.
     
  18. Darrkbeast

    Darrkbeast

    Joined:
    Mar 26, 2013
    Posts:
    125
    Hi I'm using Unity version 2018.3.0f2 and the Show Heatmap doesn't work. When I enable it the terrain goes invisible and random sharp colored shapes flicker. Everything else seems to work fine, its just hard to set up my textures with out a way to visualize them..
     
  19. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. There is a LOD factor on each vegetation item. Adjust that or adjust the LODGroup to have a longer distance from the camera before changing LOD.

    Lennart
     
  20. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I see you are running VS Pro. My guess is that you have a dll. in the project that does not support .Net 4.x properly. Could that be it?

    Lennart
     
  21. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. If you disable instancing on the terrain settings it should work. I will add a fix that does this temporary when the heatmap is active.

    Lennart
     
    Mark_01 likes this.
  22. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi.

    Deferred rendering should not do this, but shadows willl. When rendering instanced you have bigger batches of meshes and all these are redrawn if the light overlap the bounds of the batch.

    Without shadows on the point light it should not redraw, just add the light to the g-buffer.

    There is no way to do the init in a coroutine. How many terrains do you have? what is your setup?

    If you join the discord server and message me there I can try to help. easier with a text chat.
    Link in my signature.

    Lennart
     
  23. gozdagb

    gozdagb

    Joined:
    Feb 23, 2014
    Posts:
    71
    Hi,

    i am not sure if ask here or on naturemanufacture forum, but i have problem with some vegetation. Some trees, I think that those that are excluded in a certain area are transparent but still visible. Does it result from a plugin or shader? how to solve it?

    also from some angles the trees disappear, it's probably LOD's fault, how to solve it?

    Thanks
     

    Attached Files:

    Last edited: Jan 22, 2019
  24. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Excluded vegetation should not render at all. Does it make a difference if you render the trees instanced or instanced indirect? It could look like the shadow pass of a shader does not support instanced indirect and is stuck on the camera...

    Lennart
     
  25. TommiH

    TommiH

    Joined:
    Jan 14, 2008
    Posts:
    253
    Thanks for your response, Lennart!

    This seems unlikely, though, since nobody but me in this project has this issue.

    Edit: Also, my team mate tells me we already cleared up all such dlls in the project.
     
    Last edited: Jan 22, 2019
  26. Darrkbeast

    Darrkbeast

    Joined:
    Mar 26, 2013
    Posts:
    125
    Thanks, that fixed it.
     
  27. tcourbet

    tcourbet

    Joined:
    Oct 5, 2017
    Posts:
    46
    I'm not sure if it's a known issue (or if I'm doing something wrong) but I thought I would report it anyway.
    When copying an object (in order to paste its properties to another terrain for example), not all the properties are copied properly.
    For example if you've modified the Scale Type to "Advanced" and changed the values, when pasting, it will have reverted to "Simple". Pretty much all the other settings are kept though.

    It's not a huge thing but just something to keep in mind!
     
  28. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Thanks. It is probably a missing setting in the copy function.

    Lennart
     
  29. Hexalted

    Hexalted

    Joined:
    Nov 16, 2017
    Posts:
    23
    Hi, I cannot make billboard shadows work.
    Using Unity 2018.3.
    Shadows work for non-billboard trees. Trees used are the free SpeedTree examples.
    I've tried with the VS Demo scene, with with a new scene, and with my current project.
    I've tried Forward and Deffered.
    I've tried DX11, DX12, OpenGL.
    I've tried different billboards generators.
    Shadow range is very far (10000+). Directional light is added to VS settings. GPU is Shader Model 5.1 compatible.
     
  30. Nosfera

    Nosfera

    Joined:
    Sep 26, 2014
    Posts:
    12
    Hello, I'm getting this error and I have no idea what that could be, as I did no changes in the project. Yesterday it was working, today it isn't.


    ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
    System.Reflection.Assembly.GetTypes () (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    AwesomeTechnologies.Vegetation.PersistentStorage.PersistentVegetationStorageEditor+<>c.<LoadImporters>b__12_0 (System.Reflection.Assembly x) (at Assets/AwesomeTechnologies/VegetationStudio/VegetationSystem/PersistentVegetationStorage/Editor/PersistentVegetationStorageEditor.cs:162)
    System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () (at <1b13ba6391c74847bbc3eddc86df7eee>:0)
    System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () (at <1b13ba6391c74847bbc3eddc86df7eee>:0)
    AwesomeTechnologies.Vegetation.PersistentStorage.PersistentVegetationStorageEditor.LoadImporters () (at Assets/AwesomeTechnologies/VegetationStudio/VegetationSystem/PersistentVegetationStorage/Editor/PersistentVegetationStorageEditor.cs:166)
    AwesomeTechnologies.Vegetation.PersistentStorage.PersistentVegetationStorageEditor.OnEnable () (at Assets/AwesomeTechnologies/VegetationStudio/VegetationSystem/PersistentVegetationStorage/Editor/PersistentVegetationStorageEditor.cs:35)
     
  31. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. Unity changed something for 2018.3. I will post a fix tomorrow when back in the office.

    Lennart
     
    Hexalted likes this.
  32. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. Error is a reflection error. Did you change to .net 4.x ? Maybe there is a dll in the project that does not support it?
    Using Rider as an editor? Old version maybe?

    Lennart
     
  33. tcourbet

    tcourbet

    Joined:
    Oct 5, 2017
    Posts:
    46
    Hi,
    Is there any disadvantage in using multiple vegetation systems per terrain?
    For ease of use, I was thinking of splitting one of my vegetation system by area.
    For example, there are some plants/rocks/trees that I only use around water areas, so I was thinking of having a veg system just for that. Does that make sense performance-wise?
     
  34. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    You can do this but there is some overhead. It will set up the internal cell structure for each vegetation system and cull this.

    In Vegetation Studio Pro there is support for this with the biome system. You can here define multiple Vegetation packages and polygon mask areas for where you want them applied.

    Lennart
     
    tcourbet likes this.
  35. Nosfera

    Nosfera

    Joined:
    Sep 26, 2014
    Posts:
    12
    I did no changes in the project :(, not running River and the project is setup for .net 4x or equivalent. Here's a screenshot:

    What would you suggest to check for an incompatible .dll?

    Thank you!
     

    Attached Files:

    • 1.PNG
      1.PNG
      File size:
      34.8 KB
      Views:
      655
  36. namdo

    namdo

    Joined:
    Feb 23, 2015
    Posts:
    200
    Im having some issues. The vegetation doesn't appear until runtime and I disable and enable the biome.
     
  37. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. I need a bit more info to be able to help. If you can join the discord server and message me I can help you debug.
    Easier with a text chat.

    Link in my signature.

    Lennart
     
  38. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Not easy to test for that. I would set up an empry project. install VS and then import one asset after the next while testing.

    Lennart
     
  39. LoekvanKooten

    LoekvanKooten

    Joined:
    Apr 3, 2017
    Posts:
    120
    I'm not sure what you did with the new version for 2018.3, but it got me like +30 FPS!
     
  40. zeux-n00b

    zeux-n00b

    Joined:
    Nov 4, 2017
    Posts:
    73
    Hello!
    I have 3d models with grass material. What would I need to do to get vegetation on it ? thx
     
  41. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Can you explain a bit more? Is this a mesh terrain you have?
     
  42. zeux-n00b

    zeux-n00b

    Joined:
    Nov 4, 2017
    Posts:
    73
    Its not terrain in any way but 3d mesh (and a very complex one too, but very optimized) with no shader yet. I dont own Vegetation Studio btw so Im just asking around
     
  43. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Vegetation Studio need Unity Terrain to work but Vegetation Studio Pro also has mesh terrain support and can spawn/render vegetation on mesh terrains.

    Have a look here.

    Lennart
     
    FargleBargle likes this.
  44. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    80
    Hey! I have a question regarding VSPro and MicroSplat… In the Microsplat documentation there's a section on using VS with Microsplat that says "Microsplat can render out a tint map, which allows the bottom of the grass to be tinted towards the terrain texture using an appropriate shader on your vegetation. Please consult the Vegetation Studio Documentation for more information..."...

    But I can't find anything that seems to correspond in the VSPro documentation. Is it maybe VS functionality that didn't make it into VSPro, or I'm just a little blind and it's there somewhere...?

    Thx :)
     
  45. VictorKs

    VictorKs

    Joined:
    Jun 2, 2013
    Posts:
    242
    Hi I use 1 grass textures and 2 flower textures and I get 100 setpass calls why does this happen? 100setpass calls is too much for 3 2D textures.

    EDIT: Ok I fixed it I enabled compute shaders from the render settings.
     
    Last edited: Feb 9, 2019
  46. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    256
    only 1 terrain with baked vegetation. How to add light to the g-buffer ? What i did was to cull the grass plant tree layer from the light but it's annoying to loose the light on those and get a nice touch of light to vegetation. Cant understand why such a short light turn out that bad on the draw count. like if it was rendering the whole scene for that light. Happy with result but it could be better.

    still havent figure out how to avoid the freeze when loading the scene with async. My preloader jump from 10% hang untill the level is loaded and then goes to 100%. The vegetation studio init freeze everything. Too much stuff happening at the same time. If i use vegetation mask that I turn off gradually in a coroutine will change anything or all the vegetation get loaded anyway no matther if its off or not by a mask ? i want to decrease load time and freeze time to a minimum.
     
  47. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. That functionality was never made in VS or Pro. I will ask Jason to update the doc. We discussed it but it has to be implemented all all grass shaders. What we did was create the VegetationColorMask that with Microsplat can tint the terrain in the distance where grass should have been.

    Lennart
     
  48. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi.

    Forward and Deferred uses a different approach. Forward rendering has to process all vertices one time for each light while deferred uses the gBuffer and applies light on the rendered pixel.

    Does your additional lights have shadows? Are you rendering deferred?

    When rendering instanced it is batching together all vegetion with the same mesh/material. If you use forward rendering or shadows for point lights etc. it will process all these instances again since they are a common batch. Even if the light just overlaps a small area.

    When you load a new terrain it has to get data from the terrain itself, heightmap, splatmap for terrain texture rules etc. And set up an internal cell structure. This in additon to all the terrain does itself. This takes time.
    I know some developers have created a pool of the vegetation system objects and re-used them using the HotSwapTerrain function in the API that allows you to re-use the internal structure with a new terrain of a similar size.

    In Vegetation Studio Pro I redesigned the terrain loading to make it a bit easier. A single vegetation system can have multiple terrains. You can define a larger world area and load/unload terrains from a pre initialized cell structure.
    The job system also allows for direct access to the splatmap. no need to copy the data from the terrain data. This also saves some time.

    Lennart
     
  49. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    647
    Hello
    I ha ve a question to people that use vegetation studio.

    Maybe anyone already implemented Bilboard smooth fade in like dither for vegetation Studio, and could share it with other users ? :) It would be great. As I know Lennart (dev of VS) is quite busy right now so if anybody already implemeted that and would share it would be probably big thing for many users :) Best Regards
     
  50. desertGhost_

    desertGhost_

    Joined:
    Apr 12, 2018
    Posts:
    260
    Hi,

    Is there any way to limit Vegetation Studio to only include part of a given terrain in its calculations? Specifically this would act like a global vegetation include mask.

    Thanks.
     
Thread Status:
Not open for further replies.