Difference between revisions of "Uberlod Vegetation Documentation"

From Nexus Mods Wiki
Jump to: navigation, search
Line 1: Line 1:
<div class="mw-parser-output"><div class="xcontent"><div class="row"><div class="col-xs-12" id="xwikicontent"><p>This article is about our system for distant tree lods in general and especially how to create it.&#160;
+
<div class="xcontent"><div class="row"><div class="col-xs-12" id="xwikicontent">
</p>
+
This article is about our system for distant tree lods in general and especially how to create it.&nbsp;
<h2> <span>Vegetation BB LODs</span> </h2>
+
 
<p>Uberlod node for single vegetation has to be a BB LOD.
+
== <span>Vegetation BB LODs</span> ==
</p>
+
 
<h3> <span>What does it do?</span> </h3>
+
Uberlod node for single vegetation has to be a BB LOD.
<p>This system uses Vertex deformation of shader to expand small square into sizes of big trees and makes them face the camera. The usual billboarding solution wouldn't work because we need this to work and uberlods that has multiple elements that needs to face the camera separately. To achieve this we create tiny squares of geometry with the desired vertex position data in 2nd UV channel and then expand them in realtime in the engine by shifting vertices for the amount specified by 2nd UV position times per material constant.
+
 
</p>
+
=== <span>What does it do?</span> ===
<h3> <span>Semi-automated pipeline</span> </h3>
+
 
<p>You have to do three things on:
+
This system uses Vertex deformation of shader to expand small square into sizes of big trees and makes them face the camera. The usual billboarding solution wouldn't work because we need this to work and uberlods that has multiple elements that needs to face the camera separately. To achieve this we create tiny squares of geometry with the desired vertex position data in 2nd UV channel and then expand them in realtime in the engine by shifting vertices for the amount specified by 2nd UV position times per material constant.
</p>
+
 
<ol><li>Editor side </li>
+
=== <span>Semi-automated pipeline</span> ===
<li>Photoshop side </li>
+
 
<li>Max side </li></ol>
+
You have to do three things on:
<h4> <span>Editor side</span> </h4>
+
 
<p>Open Data\Levels\_art\tree_uberlod_texture_baking\tree_uberlod_texture_baking.cry in editor. Unhide and unlock appropriate layer and you will see some trees here. These are base for the texture. You can arrange any trees or bushes here in trees layer. You should maintain square ratio of the bounding box of all the trees there as they will be baked to a square texture and we want to use the space as effectively as possible.&#160;
+
#Editor side  
</p><p><span class="wikiexternallink"></span>
+
#Photoshop side  
</p><p>Search for cvar WH_Commandexecutor_File and put there text value "render_vegetation_lod_atlas" – for more info, read bellow
+
#Max side
</p><p>Change viewport resolution to 2048x2048.
+
 
</p><p><span class="wikiexternallink"></span>
+
==== <span>Editor side</span> ====
</p>
+
 
<div class="wikimodel-emptyline">&#160;</div>  
+
Open Data\Levels\_art\tree_uberlod_texture_baking\tree_uberlod_texture_baking.cry in editor. Unhide and unlock appropriate layer and you will see some trees here. These are base for the texture. You can arrange any trees or bushes here in trees layer. You should maintain square ratio of the bounding box of all the trees there as they will be baked to a square texture and we want to use the space as effectively as possible.&nbsp;
<p>Make sure you have on your harddrive script file W:\WH\Editor\Scripts\WH\get_cgf_and_positions.py
+
 
</p><p>Start game mode (Ctrl+G) and you will see rotating trees and the process of making the screenshots. All the trees will be captured from 8 different angles covering 360° view, that makes 24 textures (8 diff, 8 normal, 8 height) . After it automatically finishes, exit game mode.
+
&nbsp;
</p><p><b>render_vegetation_lod_atlas.xml</b>
+
 
</p><p>This is the file which controls the process of making screenshots. All it does is to set some control variables, then set rotation of the trees, take screenshot, rotate tree, take screenshot etc. And at the end, it sets some cVars to default value.
+
Search for cvar WH_Commandexecutor_File and put there text value "render_vegetation_lod_atlas" – for more info, read bellow
</p><p>&#160;&#160;&#160;&lt;Console command= "e_LodMin=2"/&gt; - because the BB LOD comes after the LOD2, we should generate it based on LOD2
+
 
</p><p>Generating good-looking height map could be tricky, you can add try this cVars at the beginning of xml file:
+
Change viewport resolution to 2048x2048.
</p><p>&#160;&#160;&#160;&lt;Console command= "e_lods=0"/&gt;<br /> &#160;&#160;&#160;&lt;Console command= "e_MaxViewDistance = 210"/&gt;<br /> &#160;&#160;&#160;&lt;Console command= "cl_DefaultNearPlane = 150"/&gt;<br /> &#160;&#160;&#160;&lt;Console command= "cl_nearPlane = 150"/&gt;<br /> &#160;&#160;&#160;&lt;Console command= "r_ShowDynTexturesFilter = $ZTarget"/&gt;<br /> &#160;&#160;&#160;&lt;Console command= "r_ShowDynTexturesMaxCount = 1"/&gt;<br /> &#160;&#160;&#160;&lt;Console command= "r_ShowDynTextures = 1"/&gt;<br /> &#160;
+
 
</p><p><del>To render SSDO:</del>
+
&nbsp;
</p>
+
<div class="wikimodel-emptyline">&nbsp;</div>  
<ul><li><del>Total Ilumination must by active, set Cone max length to 2 and Difufse Amplifier to 10 and Sky color multiplier to 32</del> </li>
+
Make sure you have on your harddrive script file W:\WH\Editor\Scripts\WH\get_cgf_and_positions.py
<li><del>set up SSDO cvars</del> </li></ul>
+
 
<p>Created screenshots to be found in <i>"user_editor\screenshots\"</i>. Also needed is xml containing the positions of those trees and some other data regarding them, to be found in file <i>"Data\Objects\vegetation\trees\tree_sprite_pos.xml"</i>. Only important thing in there is the MaxHeight attribute that tells you what to set later in material in editor.
+
Start game mode (Ctrl+G) and you will see rotating trees and the process of making the screenshots. All the trees will be captured from 8 different angles covering 360° view, that makes 24 textures (8 diff, 8 normal, 8 height) . After it automatically finishes, exit game mode.
</p>
+
 
<h4> <span>Photoshop side</span> </h4>
+
'''render_vegetation_lod_atlas.xml'''
<p>Textures used for tree uberlods are located in W:\WH\Engine\EngineAssets\Textures\BillboardAtlas
+
 
</p><p><del>On normal map the green channel should be inverted so make sure the layer is under the adjustment layer called "invert green"</del>
+
This is the file which controls the process of making screenshots. All it does is to set some control variables, then set rotation of the trees, take screenshot, rotate tree, take screenshot etc. And at the end, it sets some cVars to default value.
</p><p>Just replace them with latest screenshots. You can also do some modification – for example emphatize spherical volume of the tree crown by overlaying spherical normal map over it. Add some shadow inside to tree in diffuse map (we tried to render SSDO, but the results were kind of poor).
+
 
</p>
+
&nbsp;&nbsp;&nbsp;<Console command= "e_LodMin=2"/> - because the BB LOD comes after the LOD2, we should generate it based on LOD2
<h4> <span>MAX side</span> </h4>
+
 
<p>Open one of the max files with trees (you'll have to go through all of those that changed position inn the texture).
+
Generating good-looking height map could be tricky, you can add try this cVars at the beginning of xml file:
</p><p>Open WH Tools/Model/Trees/ZSpriteCreator
+
 
</p><p><img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/Screenshot_5.png" alt="Screenshot_5.png"/>
+
&nbsp;&nbsp;&nbsp;<Console command= "e_lods=0"/><br/> &nbsp;&nbsp;&nbsp;<Console command= "e_MaxViewDistance = 210"/><br/> &nbsp;&nbsp;&nbsp;<Console command= "cl_DefaultNearPlane = 150"/><br/> &nbsp;&nbsp;&nbsp;<Console command= "cl_nearPlane = 150"/><br/> &nbsp;&nbsp;&nbsp;<Console command= "r_ShowDynTexturesFilter = $ZTarget"/><br/> &nbsp;&nbsp;&nbsp;<Console command= "r_ShowDynTexturesMaxCount = 1"/><br/> &nbsp;&nbsp;&nbsp;<Console command= "r_ShowDynTextures = 1"/><br/> &nbsp;
</p>
+
 
<div class="wikimodel-emptyline">&#160;</div>  
+
<del>To render SSDO:</del>
<p>You should see a rollout with list of all trees that were placed in editor when you executed the <i>get_cgf_and_positions</i>.
+
 
</p><p><img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/Screenshot_6.png" alt="Screenshot_6.png"/>
+
*<del>Total Ilumination must by active, set Cone max length to 2 and Difufse Amplifier to 10 and Sky color multiplier to 32</del>  
</p>
+
*<del>set up SSDO cvars</del>  
<div class="wikimodel-emptyline">&#160;</div>  
+
 
<p>Now select the LOD object you want to remap in viewport (usually lod3 or uberlod) and the tree type in the list that corresponds to it and hit Process button.
+
Created screenshots to be found in ''"user_editor\screenshots\"''. Also needed is xml containing the positions of those trees and some other data regarding them, to be found in file ''"Data\Objects\vegetation\trees\tree_sprite_pos.xml"''. Only important thing in there is the MaxHeight attribute that tells you what to set later in material in editor.
</p><p>The object should now be remapped to the new texture. Second UVs are remapped as well so the object will be rescaled properly in respect to all the other it was captured together with.&#160;&#160;
+
 
</p><p>That's all.
+
==== <span>Photoshop side</span> ====
</p>
+
 
<h3> <span>Manual approach (worse)</span> </h3>
+
Textures used for tree uberlods are located in W:\WH\Engine\EngineAssets\Textures\BillboardAtlas
<h4> <span>3DS MAX side</span> </h4>
+
 
<p>This is what you need to do in 3ds Max so this system works for you. Bake lod0 into plane using CryENGINE's LOD Generator:
+
<del>On normal map the green channel should be inverted so make sure the layer is under the adjustment layer called "invert green"</del>
</p><p><a href="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/1.jpg?width=577&amp;height=483" alt="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/1.jpg?width=577&amp;height=483" title="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/1.jpg?width=577&amp;height=483">http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/1.jpg?width=577&amp;height=483</a>
+
 
</p><p>Do that for all the trees that shares the same lod material:
+
Just replace them with latest screenshots. You can also do some modification – for example emphatize spherical volume of the tree crown by overlaying spherical normal map over it. Add some shadow inside to tree in diffuse map (we tried to render SSDO, but the results were kind of poor).
</p><p><a href="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/2.jpg?width=651&amp;height=309" alt="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/2.jpg?width=651&amp;height=309" title="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/2.jpg?width=651&amp;height=309">http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/2.jpg?width=651&amp;height=309</a>
+
 
</p><p>Once you have it, create second UVs for all of them together:
+
==== <span>MAX side</span> ====
</p><p><a href="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/3.jpg?width=740&amp;height=582" alt="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/3.jpg?width=740&amp;height=582" title="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/3.jpg?width=740&amp;height=582">http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/3.jpg?width=740&amp;height=582</a>
+
 
</p><p>The vertex shader will expand the vertices by the value measured from the center of the uv space with y axis flipped. So first of all mirror everything horizontaly and place it so it is centered on the drawn X axis with bottoms aligned on the Y axis. The uvs for the largest tree of those should touch the bottom of the uv space. Just like on the picture.
+
Open one of the max files with trees (you'll have to go through all of those that changed position inn the texture).
</p><p><a href="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/4.jpg?width=658&amp;height=645" alt="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/4.jpg?width=658&amp;height=645" title="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/4.jpg?width=658&amp;height=645">http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/4.jpg?width=658&amp;height=645</a>
+
 
</p><p>Now that we have the position and size data safely stored in second UV channel, we can discard it from the geometry. Just shrink the geometry to the tiny rectangle:
+
Open WH Tools/Model/Trees/ZSpriteCreator
</p><p><a href="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/5.jpg?width=547&amp;height=569" alt="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/5.jpg?width=547&amp;height=569" title="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/5.jpg?width=547&amp;height=569">http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/5.jpg?width=547&amp;height=569</a>
+
 
</p><p>Make sure that it sits in correct relation to the pivot:
+
<img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/Screenshot_5.png" alt="Screenshot_5.png"/>
</p><p><a href="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/6.jpg?width=705&amp;height=469" alt="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/6.jpg?width=705&amp;height=469" title="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/6.jpg?width=705&amp;height=469">http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/6.jpg?width=705&amp;height=469</a>
+
<div class="wikimodel-emptyline">&nbsp;</div>  
</p><p>And you should end up with something like that:
+
You should see a rollout with list of all trees that were placed in editor when you executed the ''get_cgf_and_positions''.
</p><p><a href="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/7.jpg?width=765&amp;height=525" alt="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/7.jpg?width=765&amp;height=525" title="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/7.jpg?width=765&amp;height=525">http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/7.jpg?width=765&amp;height=525</a>
+
 
</p><p>Just export it and remember to check Additional UVs channel 2 in exporter.
+
<img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/Screenshot_6.png" alt="Screenshot_6.png"/>
</p>
+
<div class="wikimodel-emptyline">&nbsp;</div>  
<div class="wikimodel-emptyline">&#160;</div>
+
Now select the LOD object you want to remap in viewport (usually lod3 or uberlod) and the tree type in the list that corresponds to it and hit Process button.
<h4> <span>Engine side</span> </h4>
+
 
<p>Now in the engine it's pretty simple. Just set the material vertex deform correctly and you're good to go.
+
The object should now be remapped to the new texture. Second UVs are remapped as well so the object will be rescaled properly in respect to all the other it was captured together with.&nbsp;&nbsp;
</p><p><img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/8.jpg" alt="8.jpg"/>
+
 
</p>
+
That's all.
<h2> &#160; </h2>
+
 
<h2> <span>Creating uberlods from BB LODs</span> </h2>
+
=== <span>Manual approach (worse)</span> ===
<p>Run script <i>WH Tools -&gt; Misc -&gt; UberlodImport</i>
+
 
</p><p><i><img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/panel01.jpg" alt="panel01.jpg"/></i>
+
==== <span>3DS MAX side</span> ====
</p>
+
 
<h3> <span><b>Export uberlods from folder and sub</b></span> </h3>
+
This is what you need to do in 3ds Max so this system works for you. Bake lod0 into plane using CryENGINE's LOD Generator:
<p>Path From – path including subfolders where to search for max files in order to export them into FBX
+
 
</p><p>Path To – Where to put exported FBX files
+
<a href="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/1.jpg?width=577&height=483 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/1.jpg?width=577&height=483]" alt="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/1.jpg?width=577&height=483 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/1.jpg?width=577&height=483]" title="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/1.jpg?width=577&height=483 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/1.jpg?width=577&height=483]">[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/1.jpg?width=577&height=483 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/1.jpg?width=577&height=483]</a>
</p>
+
 
<h3> <span><b>Import uberlods FBX</b></span> </h3>
+
Do that for all the trees that shares the same lod material:
<p>Directory from which to import FBX uberlods (same as "Path To"?)
+
 
</p>
+
<a href="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/2.jpg?width=651&height=309 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/2.jpg?width=651&height=309]" alt="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/2.jpg?width=651&height=309 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/2.jpg?width=651&height=309]" title="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/2.jpg?width=651&height=309 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/2.jpg?width=651&height=309]">[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/2.jpg?width=651&height=309 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/2.jpg?width=651&height=309]</a>
<h3> <span><b>XML direction</b></span> </h3>
+
 
<p>Path to the exported vegetation data XML.&#160;
+
Once you have it, create second UVs for all of them together:
</p>
+
 
<h4> <span>How to export vegetation data XML:</span> </h4>
+
<a href="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/3.jpg?width=740&height=582 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/3.jpg?width=740&height=582]" alt="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/3.jpg?width=740&height=582 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/3.jpg?width=740&height=582]" title="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/3.jpg?width=740&height=582 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/3.jpg?width=740&height=582]">[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/3.jpg?width=740&height=582 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/3.jpg?width=740&height=582]</a>
<p>In Editor, run console command <i>wh_veg_ExportUberlods Foldername</i>, where Foldername is path relative to WH ("testfolder" represents path "WH/testfolder")
+
 
</p><p><img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/03.jpg" alt="03.jpg"/>
+
The vertex shader will expand the vertices by the value measured from the center of the uv space with y axis flipped. So first of all mirror everything horizontaly and place it so it is centered on the drawn X axis with bottoms aligned on the Y axis. The uvs for the largest tree of those should touch the bottom of the uv space. Just like on the picture.
</p><p>Generated XML files have name in the format:
+
 
</p><p><i>uberlod_node_&lt;CELL_Y&gt;_&lt;CELL_X&gt;_&lt;BOUNDS_MIN_X&gt;_&lt;BOUNDS_MIN_Y&gt;_&lt;BOUNDS_MAX_X&gt;_&lt;BOUNDS_MAX_Y&gt;.xml</i>, where:
+
<a href="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/4.jpg?width=658&height=645 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/4.jpg?width=658&height=645]" alt="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/4.jpg?width=658&height=645 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/4.jpg?width=658&height=645]" title="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/4.jpg?width=658&height=645 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/4.jpg?width=658&height=645]">[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/4.jpg?width=658&height=645 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/4.jpg?width=658&height=645]</a>
</p>
+
 
<ul><li>CELL_Y, CELL_X - coordinates of vegetation cell </li>
+
Now that we have the position and size data safely stored in second UV channel, we can discard it from the geometry. Just shrink the geometry to the tiny rectangle:
<li>BOUNDS_MIN_X, BOUNDS_MIN_Y, BOUNDS_MAX_X, BOUNDS_MAX_Y - axis-aligned bounding box of vegetation cell </li></ul>
+
 
<p>Vegetation cell index could be calculated: <i>VegetationCell = (CELL_Y * (TerrainSize / wh_e_vegetationCellSize)) + CELL_X</i>, where
+
<a href="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/5.jpg?width=547&height=569 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/5.jpg?width=547&height=569]" alt="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/5.jpg?width=547&height=569 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/5.jpg?width=547&height=569]" title="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/5.jpg?width=547&height=569 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/5.jpg?width=547&height=569]">[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/5.jpg?width=547&height=569 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/5.jpg?width=547&height=569]</a>
</p>
+
 
<ul><li>TerrainSize is 4096 for Rataje </li>
+
Make sure that it sits in correct relation to the pivot:
<li>wh_e_vegetationCellSize is cvar with defaul value of 64 (i.e. TerrainSize / wh_e_vegetationCellSize = 64) </li></ul>
+
 
<h3> <span>Process</span> </h3>
+
<a href="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/6.jpg?width=705&height=469 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/6.jpg?width=705&height=469]" alt="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/6.jpg?width=705&height=469 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/6.jpg?width=705&height=469]" title="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/6.jpg?width=705&height=469 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/6.jpg?width=705&height=469]">[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/6.jpg?width=705&height=469 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/6.jpg?width=705&height=469]</a>
<p>From, To - pick square between coordinates
+
 
</p><p>Save Frequency - how often to autosave (every nth square)
+
And you should end up with something like that:
</p>
+
 
<h3> <span>Troubleshooting</span> </h3>
+
<a href="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/7.jpg?width=765&height=525 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/7.jpg?width=765&height=525]" alt="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/7.jpg?width=765&height=525 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/7.jpg?width=765&height=525]" title="[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/7.jpg?width=765&height=525 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/7.jpg?width=765&height=525]">[http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/7.jpg?width=765&height=525 http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/7.jpg?width=765&height=525]</a>
<p>If generation process gets frozen, there is probably problem with vegetation max files – there is missing GrowFX plugin. How to fix it: open "broken" max file and run script <span class="wikicreatelink"><a href="http://xwiki.warhorse.local:8080/xwiki/bin/create/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/RemoveMissingPlugin/WebHome?parent=Teams.EnviroArt.Documentation.Assets.Uberlods.Vegetation+uberlods.WebHome" alt="http://xwiki.warhorse.local:8080/xwiki/bin/create/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/RemoveMissingPlugin/WebHome?parent=Teams.EnviroArt.Documentation.Assets.Uberlods.Vegetation+uberlods.WebHome" title="http://xwiki.warhorse.local:8080/xwiki/bin/create/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/RemoveMissingPlugin/WebHome?parent=Teams.EnviroArt.Documentation.Assets.Uberlods.Vegetation+uberlods.WebHome">http://www.scriptspot.com/3ds-max/scripts/removemissingplugins</a></span> and then save max file.
+
 
</p><p><img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/04.jpg" alt="04.jpg"/>
+
Just export it and remember to check Additional UVs channel 2 in exporter.
</p>
+
<div class="wikimodel-emptyline">&nbsp;</div>
<div class="wikimodel-emptyline">&#160;</div>
+
==== <span>Engine side</span> ====
<h2> <span>Exporting uberlods into engine</span> </h2>
+
 
<p>Sync and assign material \Objects\vegetation\trees\uberlod_veg.mtl
+
Now in the engine it's pretty simple. Just set the material vertex deform correctly and you're good to go.
</p><p>Export cgf files, make sure you check on Additional UVs: Channel 2:
+
 
</p><p><img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/05.jpg" alt="05.jpg"/>
+
<img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/8.jpg" alt="8.jpg"/>
</p>
+
 
<div class="wikimodel-emptyline">&#160;</div>  
+
== &nbsp; ==
<p>Select Scene node in 3ds Max:
+
 
</p><p><img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/06.jpg" alt="06.jpg"/>
+
== <span>Creating uberlods from BB LODs</span> ==
</p><p>In property click to Export Scene:
+
 
</p><p><img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/07.jpg" alt="07.jpg"/>
+
Run script ''WH Tools -> Misc -> UberlodImport''
</p>
+
 
</div> </div> </div> <div class="clearfloats">&#160;</div>
+
''<img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/panel01.jpg" alt="panel01.jpg"/>''
</div><span class="fck_mw_category" contenteditable="false" _fcknotitle="true">Documentation</span> <span class="fck_mw_category" contenteditable="false" _fcknotitle="true">Kingdom Come Deliverance</span>
+
 
 +
=== <span>'''Export uberlods from folder and sub'''</span> ===
 +
 
 +
Path From – path including subfolders where to search for max files in order to export them into FBX
 +
 
 +
Path To – Where to put exported FBX files
 +
 
 +
=== <span>'''Import uberlods FBX'''</span> ===
 +
 
 +
Directory from which to import FBX uberlods (same as "Path To"?)
 +
 
 +
=== <span>'''XML direction'''</span> ===
 +
 
 +
Path to the exported vegetation data XML.&nbsp;
 +
 
 +
==== <span>How to export vegetation data XML:</span> ====
 +
 
 +
In Editor, run console command ''wh_veg_ExportUberlods Foldername'', where Foldername is path relative to WH ("testfolder" represents path "WH/testfolder")
 +
 
 +
<img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/03.jpg" alt="03.jpg"/>
 +
 
 +
Generated XML files have name in the format:
 +
 
 +
''uberlod_node_<CELL_Y>_<CELL_X>_<BOUNDS_MIN_X>_<BOUNDS_MIN_Y>_<BOUNDS_MAX_X>_<BOUNDS_MAX_Y>.xml'', where:
 +
 
 +
*CELL_Y, CELL_X - coordinates of vegetation cell
 +
*BOUNDS_MIN_X, BOUNDS_MIN_Y, BOUNDS_MAX_X, BOUNDS_MAX_Y - axis-aligned bounding box of vegetation cell
 +
 
 +
Vegetation cell index could be calculated: ''VegetationCell = (CELL_Y * (TerrainSize / wh_e_vegetationCellSize)) + CELL_X'', where
 +
 
 +
*TerrainSize is 4096 for Rataje
 +
*wh_e_vegetationCellSize is cvar with defaul value of 64 (i.e. TerrainSize / wh_e_vegetationCellSize = 64)
 +
 
 +
=== <span>Process</span> ===
 +
 
 +
From, To - pick square between coordinates
 +
 
 +
Save Frequency - how often to autosave (every nth square)
 +
 
 +
=== <span>Troubleshooting</span> ===
 +
 
 +
If generation process gets frozen, there is probably problem with vegetation max files – there is missing GrowFX plugin. How to fix it: open "broken" max file and run script <span class="wikicreatelink"><a href="[http://xwiki.warhorse.local:8080/xwiki/bin/create/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/RemoveMissingPlugin/WebHome?parent=Teams.EnviroArt.Documentation.Assets.Uberlods.Vegetation+uberlods.WebHome http://xwiki.warhorse.local:8080/xwiki/bin/create/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/RemoveMissingPlugin/WebHome?parent=Teams.EnviroArt.Documentation.Assets.Uberlods.Vegetation+uberlods.WebHome]" alt="[http://xwiki.warhorse.local:8080/xwiki/bin/create/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/RemoveMissingPlugin/WebHome?parent=Teams.EnviroArt.Documentation.Assets.Uberlods.Vegetation+uberlods.WebHome http://xwiki.warhorse.local:8080/xwiki/bin/create/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/RemoveMissingPlugin/WebHome?parent=Teams.EnviroArt.Documentation.Assets.Uberlods.Vegetation+uberlods.WebHome]" title="[http://xwiki.warhorse.local:8080/xwiki/bin/create/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/RemoveMissingPlugin/WebHome?parent=Teams.EnviroArt.Documentation.Assets.Uberlods.Vegetation+uberlods.WebHome http://xwiki.warhorse.local:8080/xwiki/bin/create/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/RemoveMissingPlugin/WebHome?parent=Teams.EnviroArt.Documentation.Assets.Uberlods.Vegetation+uberlods.WebHome]">[http://www.scriptspot.com/3ds-max/scripts/removemissingplugins http://www.scriptspot.com/3ds-max/scripts/removemissingplugins]</a></span> and then save max file.
 +
 
 +
<img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/04.jpg" alt="04.jpg"/>
 +
<div class="wikimodel-emptyline">&nbsp;</div>
 +
== <span>Exporting uberlods into engine</span> ==
 +
 
 +
Sync and assign material \Objects\vegetation\trees\uberlod_veg.mtl
 +
 
 +
Export cgf files, make sure you check on Additional UVs: Channel 2:
 +
 
 +
<img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/05.jpg" alt="05.jpg"/>
 +
<div class="wikimodel-emptyline">&nbsp;</div>  
 +
Select Scene node in 3ds Max:
 +
 
 +
<img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/06.jpg" alt="06.jpg"/>
 +
 
 +
In property click to Export Scene:
 +
 
 +
<img src="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/07.jpg" alt="07.jpg"/>
 +
</div> </div> </div> <div class="clearfloats">&nbsp;</div>  [[Category:Documentation]] [[Category:Kingdom Come Deliverance]]

Revision as of 13:51, 24 October 2019

This article is about our system for distant tree lods in general and especially how to create it. 

Vegetation BB LODs

Uberlod node for single vegetation has to be a BB LOD.

What does it do?

This system uses Vertex deformation of shader to expand small square into sizes of big trees and makes them face the camera. The usual billboarding solution wouldn't work because we need this to work and uberlods that has multiple elements that needs to face the camera separately. To achieve this we create tiny squares of geometry with the desired vertex position data in 2nd UV channel and then expand them in realtime in the engine by shifting vertices for the amount specified by 2nd UV position times per material constant.

Semi-automated pipeline

You have to do three things on:

  1. Editor side
  2. Photoshop side
  3. Max side

Editor side

Open Data\Levels\_art\tree_uberlod_texture_baking\tree_uberlod_texture_baking.cry in editor. Unhide and unlock appropriate layer and you will see some trees here. These are base for the texture. You can arrange any trees or bushes here in trees layer. You should maintain square ratio of the bounding box of all the trees there as they will be baked to a square texture and we want to use the space as effectively as possible. 

 

Search for cvar WH_Commandexecutor_File and put there text value "render_vegetation_lod_atlas" – for more info, read bellow

Change viewport resolution to 2048x2048.

 

 

Make sure you have on your harddrive script file W:\WH\Editor\Scripts\WH\get_cgf_and_positions.py

Start game mode (Ctrl+G) and you will see rotating trees and the process of making the screenshots. All the trees will be captured from 8 different angles covering 360° view, that makes 24 textures (8 diff, 8 normal, 8 height) . After it automatically finishes, exit game mode.

render_vegetation_lod_atlas.xml

This is the file which controls the process of making screenshots. All it does is to set some control variables, then set rotation of the trees, take screenshot, rotate tree, take screenshot etc. And at the end, it sets some cVars to default value.

   <Console command= "e_LodMin=2"/> - because the BB LOD comes after the LOD2, we should generate it based on LOD2

Generating good-looking height map could be tricky, you can add try this cVars at the beginning of xml file:

   <Console command= "e_lods=0"/>
   <Console command= "e_MaxViewDistance = 210"/>
   <Console command= "cl_DefaultNearPlane = 150"/>
   <Console command= "cl_nearPlane = 150"/>
   <Console command= "r_ShowDynTexturesFilter = $ZTarget"/>
   <Console command= "r_ShowDynTexturesMaxCount = 1"/>
   <Console command= "r_ShowDynTextures = 1"/>
 

To render SSDO:

  • Total Ilumination must by active, set Cone max length to 2 and Difufse Amplifier to 10 and Sky color multiplier to 32
  • set up SSDO cvars

Created screenshots to be found in "user_editor\screenshots\". Also needed is xml containing the positions of those trees and some other data regarding them, to be found in file "Data\Objects\vegetation\trees\tree_sprite_pos.xml". Only important thing in there is the MaxHeight attribute that tells you what to set later in material in editor.

Photoshop side

Textures used for tree uberlods are located in W:\WH\Engine\EngineAssets\Textures\BillboardAtlas

On normal map the green channel should be inverted so make sure the layer is under the adjustment layer called "invert green"

Just replace them with latest screenshots. You can also do some modification – for example emphatize spherical volume of the tree crown by overlaying spherical normal map over it. Add some shadow inside to tree in diffuse map (we tried to render SSDO, but the results were kind of poor).

MAX side

Open one of the max files with trees (you'll have to go through all of those that changed position inn the texture).

Open WH Tools/Model/Trees/ZSpriteCreator

<img src="Screenshot_5.png" alt="Screenshot_5.png"/>

 

You should see a rollout with list of all trees that were placed in editor when you executed the get_cgf_and_positions.

<img src="Screenshot_6.png" alt="Screenshot_6.png"/>

 

Now select the LOD object you want to remap in viewport (usually lod3 or uberlod) and the tree type in the list that corresponds to it and hit Process button.

The object should now be remapped to the new texture. Second UVs are remapped as well so the object will be rescaled properly in respect to all the other it was captured together with.  

That's all.

Manual approach (worse)

3DS MAX side

This is what you need to do in 3ds Max so this system works for you. Bake lod0 into plane using CryENGINE's LOD Generator:

<a href="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/1.jpg?width=577&height=483" alt="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/1.jpg?width=577&height=483" title="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/1.jpg?width=577&height=483">http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/1.jpg?width=577&height=483</a>

Do that for all the trees that shares the same lod material:

<a href="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/2.jpg?width=651&height=309" alt="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/2.jpg?width=651&height=309" title="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/2.jpg?width=651&height=309">http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/2.jpg?width=651&height=309</a>

Once you have it, create second UVs for all of them together:

<a href="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/3.jpg?width=740&height=582" alt="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/3.jpg?width=740&height=582" title="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/3.jpg?width=740&height=582">http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/3.jpg?width=740&height=582</a>

The vertex shader will expand the vertices by the value measured from the center of the uv space with y axis flipped. So first of all mirror everything horizontaly and place it so it is centered on the drawn X axis with bottoms aligned on the Y axis. The uvs for the largest tree of those should touch the bottom of the uv space. Just like on the picture.

<a href="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/4.jpg?width=658&height=645" alt="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/4.jpg?width=658&height=645" title="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/4.jpg?width=658&height=645">http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/4.jpg?width=658&height=645</a>

Now that we have the position and size data safely stored in second UV channel, we can discard it from the geometry. Just shrink the geometry to the tiny rectangle:

<a href="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/5.jpg?width=547&height=569" alt="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/5.jpg?width=547&height=569" title="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/5.jpg?width=547&height=569">http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/5.jpg?width=547&height=569</a>

Make sure that it sits in correct relation to the pivot:

<a href="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/6.jpg?width=705&height=469" alt="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/6.jpg?width=705&height=469" title="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/6.jpg?width=705&height=469">http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/6.jpg?width=705&height=469</a>

And you should end up with something like that:

<a href="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/7.jpg?width=765&height=525" alt="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/7.jpg?width=765&height=525" title="http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/7.jpg?width=765&height=525">http://xwiki.warhorse.local:8080/xwiki/bin/download/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/WebHome/7.jpg?width=765&height=525</a>

Just export it and remember to check Additional UVs channel 2 in exporter.

 

Engine side

Now in the engine it's pretty simple. Just set the material vertex deform correctly and you're good to go.

<img src="8.jpg" alt="8.jpg"/>

 

Creating uberlods from BB LODs

Run script WH Tools -> Misc -> UberlodImport

<img src="panel01.jpg" alt="panel01.jpg"/>

Export uberlods from folder and sub

Path From – path including subfolders where to search for max files in order to export them into FBX

Path To – Where to put exported FBX files

Import uberlods FBX

Directory from which to import FBX uberlods (same as "Path To"?)

XML direction

Path to the exported vegetation data XML. 

How to export vegetation data XML:

In Editor, run console command wh_veg_ExportUberlods Foldername, where Foldername is path relative to WH ("testfolder" represents path "WH/testfolder")

<img src="03.jpg" alt="03.jpg"/>

Generated XML files have name in the format:

uberlod_node_<CELL_Y>_<CELL_X>_<BOUNDS_MIN_X>_<BOUNDS_MIN_Y>_<BOUNDS_MAX_X>_<BOUNDS_MAX_Y>.xml, where:

  • CELL_Y, CELL_X - coordinates of vegetation cell
  • BOUNDS_MIN_X, BOUNDS_MIN_Y, BOUNDS_MAX_X, BOUNDS_MAX_Y - axis-aligned bounding box of vegetation cell

Vegetation cell index could be calculated: VegetationCell = (CELL_Y * (TerrainSize / wh_e_vegetationCellSize)) + CELL_X, where

  • TerrainSize is 4096 for Rataje
  • wh_e_vegetationCellSize is cvar with defaul value of 64 (i.e. TerrainSize / wh_e_vegetationCellSize = 64)

Process

From, To - pick square between coordinates

Save Frequency - how often to autosave (every nth square)

Troubleshooting

If generation process gets frozen, there is probably problem with vegetation max files – there is missing GrowFX plugin. How to fix it: open "broken" max file and run script <a href="http://xwiki.warhorse.local:8080/xwiki/bin/create/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/RemoveMissingPlugin/WebHome?parent=Teams.EnviroArt.Documentation.Assets.Uberlods.Vegetation+uberlods.WebHome" alt="http://xwiki.warhorse.local:8080/xwiki/bin/create/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/RemoveMissingPlugin/WebHome?parent=Teams.EnviroArt.Documentation.Assets.Uberlods.Vegetation+uberlods.WebHome" title="http://xwiki.warhorse.local:8080/xwiki/bin/create/Teams/EnviroArt/Documentation/Assets/Uberlods/Vegetation%20uberlods/RemoveMissingPlugin/WebHome?parent=Teams.EnviroArt.Documentation.Assets.Uberlods.Vegetation+uberlods.WebHome">http://www.scriptspot.com/3ds-max/scripts/removemissingplugins</a> and then save max file.

<img src="04.jpg" alt="04.jpg"/>

 

Exporting uberlods into engine

Sync and assign material \Objects\vegetation\trees\uberlod_veg.mtl

Export cgf files, make sure you check on Additional UVs: Channel 2:

<img src="05.jpg" alt="05.jpg"/>

 

Select Scene node in 3ds Max:

<img src="06.jpg" alt="06.jpg"/>

In property click to Export Scene:

<img src="07.jpg" alt="07.jpg"/>