tag:blogger.com,1999:blog-80232096432889676872024-02-19T01:48:24.410-08:00Game And Software ProgrammingAnton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-8023209643288967687.post-16547109413922462182022-07-18T03:18:00.003-07:002022-07-18T03:21:58.014-07:00 How to get texture size in Unreal Material Editor?<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEi7rNBcLxuUZqSKfj8lDJAD_gUsdchY6pFzITQSoGPLwa4m0hGZ5gcTi4sdftBuHCbf9J_AqQrAZjchUkhbWFRoosuxPKcmAVG6Na7YawG8_YoxX65GpRCS9Tut22uwmB0m3HHNL_0CTyZx8p4FxAZWrBqny_bajFESCrT5XTPbpH5vY2IkzgT7L_hHaw" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="335" data-original-width="498" src="https://blogger.googleusercontent.com/img/a/AVvXsEi7rNBcLxuUZqSKfj8lDJAD_gUsdchY6pFzITQSoGPLwa4m0hGZ5gcTi4sdftBuHCbf9J_AqQrAZjchUkhbWFRoosuxPKcmAVG6Na7YawG8_YoxX65GpRCS9Tut22uwmB0m3HHNL_0CTyZx8p4FxAZWrBqny_bajFESCrT5XTPbpH5vY2IkzgT7L_hHaw=s16000" /></a></div><br />Let be a shader that wants texture dimensions, f.e to evaluate texture aspect. It's a common situation if the shader is going to render something in screenspace and you want to prevent stretching. Another common situation if it's necessary to process texture pixel by pixel. Or combine two different textures with various aspects. The texture coordinates are always in (0,1) so there no clue about texture aspect. Of course, you can pass dimensions as parametrs, but that sucks. Defenitely it should be something much simpler, but where? <span><a name='more'></a></span><div><br /><p></p><p>To get texture dimension in pixels you need to create your own custom node.</p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEiHYEfYnR0U02ZEjSfSWlruBUCE2OiOhbR5SCwb7wQXmqsULnPH2DuN4u8jclDyqkaOwamBbHe9otF0z0Yve3l6_qSXBooABv18tdoyPP02gaoNIVbhNOd86W40qhz5OAYXOezPOp7lTo04UuP83s3ddoZnTHguC0KBdbi5s2ilBFCMKSmKV4a8weJhFA" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="376" data-original-width="407" src="https://blogger.googleusercontent.com/img/a/AVvXsEiHYEfYnR0U02ZEjSfSWlruBUCE2OiOhbR5SCwb7wQXmqsULnPH2DuN4u8jclDyqkaOwamBbHe9otF0z0Yve3l6_qSXBooABv18tdoyPP02gaoNIVbhNOd86W40qhz5OAYXOezPOp7lTo04UuP83s3ddoZnTHguC0KBdbi5s2ilBFCMKSmKV4a8weJhFA=s16000" /></a></div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">Add input node so, custom node will be able to recive a texture object as parameter. Rename it to GetTextureSize or whatever you like.</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEgDbrOemIq2E3UXu1A58XeuWdwwDdjOPOuVbGRVQ7-R2rYLeE1bVMwsUyFPzDPR0LXgt82l5mKfO4n4KbT9apNR0gxxQja-Qz5VL5zyRlcc-bMTbObhtbldsxczzFmKLnwUZnIlCHFO-RBSWd9BCEBjKdahgzIMVmB4L9vM2b4z9WxW6GL1xpOdxLs4iQ" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="290" data-original-width="440" src="https://blogger.googleusercontent.com/img/a/AVvXsEgDbrOemIq2E3UXu1A58XeuWdwwDdjOPOuVbGRVQ7-R2rYLeE1bVMwsUyFPzDPR0LXgt82l5mKfO4n4KbT9apNR0gxxQja-Qz5VL5zyRlcc-bMTbObhtbldsxczzFmKLnwUZnIlCHFO-RBSWd9BCEBjKdahgzIMVmB4L9vM2b4z9WxW6GL1xpOdxLs4iQ=s16000" /></a></div><div class="separator" style="clear: both; text-align: left;"><br /></div>
<div class="separator" style="clear: both; text-align: left;">In the Code field paste following:
</div><div class="separator" style="clear: both; text-align: left;"><br /></div>
<script src="https://gist.github.com/softshaded/454ebc02b439c138758f435839fee151.js"></script>
</div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: left;">Use and do not forget to LEARN </div><div></div><div><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXpEBwhAbPWSKXjYuDubcNcQNbNySt-LQFjsFQRlut302txewVWA9-bdcX6S8gHmoofCIbulYc9W1EEF2_x9n8Xq1cpAou_FQ82hHM743Bt1ThscWKHLh_ummt2b1DrYqshwmX7dRhFwtcXKfZCaIMNeF_E9CdrsejlQ1ZBp6qC7Oear9VJGxbaotr4g/s620/HLSL_trick.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="452" data-original-width="620" height="233" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXpEBwhAbPWSKXjYuDubcNcQNbNySt-LQFjsFQRlut302txewVWA9-bdcX6S8gHmoofCIbulYc9W1EEF2_x9n8Xq1cpAou_FQ82hHM743Bt1ThscWKHLh_ummt2b1DrYqshwmX7dRhFwtcXKfZCaIMNeF_E9CdrsejlQ1ZBp6qC7Oear9VJGxbaotr4g/s320/HLSL_trick.png" width="320" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><br /></div><br /><br /><br /><p></p></div></div>Anton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.com0tag:blogger.com,1999:blog-8023209643288967687.post-5600929507254723012021-10-13T11:13:00.011-07:002022-07-18T03:20:20.884-07:00How to get widget size in Unreal EngineThe problem is absurd. You can't just get a size of widget before it will tick for a first time. I've met this problem when was writing a custom grid component. The component holds a set of widgets and should align them in a grid with cols count evaluating dynamically, depending on a size that widget takes on a parent widget at the moment of creation. And thats the problem.<span><a name='more'></a></span><p>As long as I am using dynamic ancors instead of fixed canvas slot size, the desired size of a widget can't be calculated.</p><p>If layout was calculated you can accsess to last cached geometry. This is true for widgets that was added a frame before and have ticked once:</p><p><span style="font-family: courier;"><span> </span>MyWidget->GetCachedGeometry()</span></p><p>If you set widet size explicitly by using a canvas panel slot, you can get desired size by calling </p><p><span style="font-family: courier;"><span> </span>auto Size = Cast<UCanvasSlot>(MyWidget->GetSlot())->Size;</span></p><p>or just call </p><p><span style="font-family: courier;"><span> </span>auto Size = MyWidget->GetDesiredSize();</span></p><p>if widget was designed with SizeBox or some other widget that have a explicit fixed size property, wrapped around.</p><p>In more complicated cases you need to call </p><p><span style="font-family: courier;"><span> </span>ForceLayoutPrepass();</span> </p><p>to force desired size to be calculated.</p><p><b>You can read a great article</b> that covers all that things here, if you not sure about what we are talking:</p><p><a href="https://dawnarc.com/2018/12/ue4slate-and-native-umgc-notes/">https://dawnarc.com/2018/12/ue4slate-and-native-umgc-notes/</a></p><h3 style="text-align: left;">Ok, nothing of that works for me</h3><p>If nothing of that stuff works for you and you continue to get zeroes, there is last trick that you can try to do. The LayoutUtilites module goes to help. The trick is to walk upward in widget hierarchy by iterating through parents until you won't get widget with non-zeroed CachedGeometry and then use the geometry to calculate your newly-created widget that haven't been cached yet:</p><br />
<script src="https://gist.github.com/softshaded/61c2c8e9c76ff46687eeb2f20ab1f226.js"></script><div>Be careful! This solution doesn't taking into account clipping rect, that could be used when widget is painted on a screen in a regular way.</div>Anton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.com1tag:blogger.com,1999:blog-8023209643288967687.post-18229996751979903862019-04-10T06:41:00.000-07:002019-04-11T07:58:28.275-07:00Extending Unreal Editor<div dir="ltr" style="text-align: left;" trbidi="on">
Extending Content Browser.<br />
<div>
<br /></div>
<div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnCHE_GtqvgFwXcY8FgviCpzD8Ktaq-STONIy7xCazmDdaLTNbZyn5VxUdh-L6BRdYPx7ZQB65JeKPbnSuukCTKp9aOn-b3JMOUnwaYBabzs-Lis5PXzQNzjxbqu34B8X51gWjPLQBJfCh/s1600/Screenshot_1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="520" data-original-width="503" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnCHE_GtqvgFwXcY8FgviCpzD8Ktaq-STONIy7xCazmDdaLTNbZyn5VxUdh-L6BRdYPx7ZQB65JeKPbnSuukCTKp9aOn-b3JMOUnwaYBabzs-Lis5PXzQNzjxbqu34B8X51gWjPLQBJfCh/s320/Screenshot_1.png" width="309" /></a><br />
<div style="text-align: justify;">
Let's see how to extend Content Browser's context menu. We'd like to add custom commands that can be performed over selected folders. </div>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<div style="text-align: justify;">
There is a lot of information about extending editor menu. A good point to start is to read this article:</div>
</div>
<div>
<div style="text-align: justify;">
<a href="http://www.danielmayor.com/ue4-simple-menus">http://www.danielmayor.com/ue4-simple-menus</a></div>
</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<a name='more'></a><br />
<br />
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
As it is described in the article, we have our custom game module and started to extend editor from here:</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<script src="https://gist.github.com/softshaded/cbc4181324839ab546362ae748c38731.js"></script>
You see that ContentBrowser doesn't provide methods to get MenuEsteder but has methods to get reference on array that contatin delegates that will be called when unreal builds context menu.</div>
<div style="text-align: justify;">
<br /></div>
<script src="https://gist.github.com/softshaded/7f9cad2b07026bcb66a996c36bed23a5.js"></script>
<br />
<div>
<div style="text-align: justify;">
Note that we must pass "NewFolder" as hook name to extend path menu (See MultiBoxBuilder.cpp::ApplyHook) It is important to store information about selected path that came from content browser to have a proper context for our extenstion. I've decide to keep Extension variable in FGameEditorModule instance. This solution is a little bit ugly, but works fine. </div>
</div>
<div style="text-align: justify;">
<br /></div>
<script src="https://gist.github.com/softshaded/9274d69e648b90a39c0615c4ce34b725.js"></script>
<br />
<div>
<div style="text-align: justify;">
Don't forget to add public dependencies to Slate, ContentBrowser and other modules in GameEditor.Build.cs</div>
</div>
</div>
Anton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.com0tag:blogger.com,1999:blog-8023209643288967687.post-62128257339371186472018-11-29T02:55:00.001-08:002018-12-01T15:49:11.669-08:00Atlas packer tool has been released!<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: justify;">
</h2>
<div class="separator" style="clear: both; text-align: center;">
<img border="0" data-original-height="855" data-original-width="1115" height="490" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR4DD1yz18cOskEquGhhCnH1uumfsxxkRFMymHAarHBH8Ncd6Hw-prcIdYtlEBGEGjUFt09O_XyRY1JCNMkT9Oo9IQf517LtWU0jcfl9wf3GvB7AXa-HXcpCmOUX5rF0ctFe3CvEyf6BUH/s640/screen.png" style="text-align: justify;" width="640" /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This tool serves to handle a bunch of tasks related to developing texture atlases and spritesheets for games. It helps to find optimal position for texture elements, sort sprites and even merge objects into atlas. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The key feature is ability to merge separate textures that are used by 3d-models into one atlas and at same time change UV's so that models will use merged texture. After atlas is developed in Atlas Packer it may be exported as a set of textures. When exporting, the program generates additional xml file that provides information about UV transforms for corresponding objects. This file is used by scrip that comes with the package. To apply changes to UVs for object, open 3ds Max and launch script UVToAltlas.ms and locate exported xml file by pressing "Browse" button. Import object which UVs need to be changed to be map into atlas. Select in list appropriate atlas element in which object should be mapped and press "Remap" button. </div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwpTwBW52o8aZVm5M7b476Qj3lqdGQhvFQ4BU_wZlR7Oz3ORc9cztVm4x16Cu8LMNEH_SnyZtRFRjTfhroMr69ii6NB6CmjYpHAuaOhCJLFDZmwp5kR3g0zAio3TGyVu364j0mUxMAHFqA/s1600/merging.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1030" data-original-width="1600" height="412" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwpTwBW52o8aZVm5M7b476Qj3lqdGQhvFQ4BU_wZlR7Oz3ORc9cztVm4x16Cu8LMNEH_SnyZtRFRjTfhroMr69ii6NB6CmjYpHAuaOhCJLFDZmwp5kR3g0zAio3TGyVu364j0mUxMAHFqA/s640/merging.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: justify;">
Features</h3>
<div style="text-align: justify;">
</div>
<ul>
<li>Saving. Save project to make some changes later</li>
<li>Multi-map loading. Select and load all required textures in one click</li>
<li>Multi-map processing. Import full set of textures that are used by models and process them all together</li>
<li>Merge object UVs into atlas (requires 3ds Max)</li>
<li>Non-quad atlas and textures. All aspects are supported</li>
<li>Rotation. Rotate elements to best fit</li>
<li>Auto packing. Set weights for textures and pack them in optimal way</li>
<li>Manual repacking. Lay out all textures in manual mode using snapping</li>
<li>Lock mode to prevent some items from changing their positions due to auto-repacking</li>
<li>Increase / Decrease size operation for items with specified aspect</li>
<li>Import / Export from png, tga, tiff, jpg and many other formats</li>
<li>Drag and Drop. Drag textures into app to create new atlas elements</li>
<li>Auto update. Get latest updates when they ready</li>
</ul>
<h3>
Roadmap</h3>
<div>
<ul>
<li>Support of FBX (no need to use a script for merging)</li>
<li>Interface </li>
</ul>
</div>
<div>
<br /></div>
<h3>
You can read tutorials and docs there:</h3>
<div>
<a href="https://bitbucket.org/Antondoe/atlaspacker/overview">https://bitbucket.org/Antondoe/atlaspacker/overview</a><br />
<br />
<h3 style="text-align: left;">
You can download latest version here:</h3>
</div>
<div>
<a href="https://bitbucket.org/Antondoe/atlaspacker/downloads/Release.zip" target="_blank"><img alt=" Download" border="0" data-original-height="194" data-original-width="800" height="48" src="https://openclipart.org/image/2400px/svg_to_png/112/molumen-download-button-1.png" width="200" /></a></div>
<br />
Feel free to contact me and request any feature you woul'd like to see in next release:<br />
<a href="mailto:wiresandflowers@gmail.com">wiresandflowers@gmail.com</a></div>
Anton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.com3tag:blogger.com,1999:blog-8023209643288967687.post-45505397458048668032018-07-03T06:33:00.000-07:002018-07-03T06:38:15.583-07:00Fake interior shader for cheap windows<div dir="ltr" style="text-align: left;" trbidi="on">
How to create material to simulate interior through window in Unreal engine.<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
In many outdoor environments like cityscapes there are a lot of different buildings. You’d probably want to show that buildings are not empty box-like objects. Instead, they have various rooms interiors visible through their windows. This could be expensive as long as you need to model all exteriors, texture them and set-up lights. It became even more expensive if you need use some glass shader to make windows looks more material. The glass could probably reflect some light or be dirty. And at the same time it should be transparent. Transparent objects are expensive. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
But in case when such interiors are part of background, what means that its is not mentioned that player can be near enough to explore them, there is some hacks.</div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: justify;">
Parallax Texture</h3>
<div style="text-align: justify;">
The first is to use parallax texture. </div>
<div style="text-align: justify;">
This approach was used such games as Bioshock Infinite and many other:</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/pYGhCjriCeo/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/pYGhCjriCeo?feature=player_embedded" width="320"></iframe></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: justify;">
Cubemap Texture</h3>
<div style="text-align: justify;">
The more accurate approach is to use a cubemap. This method gives you more realistic result.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhinioeqQ4QPm1uXQuZASULCPZQl4IywhMsCuuRXUYI8QWg6ocnqwzLCHiWbB-G9D-n2xFAgzHulYO892zTqrRXQecPJbK8Yg8GPznQ90KBCGGH6Ruvu0z-0U5aa79FtU4LpMjpmcybiuJl/s1600/ezgif-4-5767c4e1d2.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="292" data-original-width="536" height="347" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhinioeqQ4QPm1uXQuZASULCPZQl4IywhMsCuuRXUYI8QWg6ocnqwzLCHiWbB-G9D-n2xFAgzHulYO892zTqrRXQecPJbK8Yg8GPznQ90KBCGGH6Ruvu0z-0U5aa79FtU4LpMjpmcybiuJl/s640/ezgif-4-5767c4e1d2.gif" width="640" /></a></div>
<div style="text-align: justify;">
</div>
<a name='more'></a><br />
<br />
<h3 style="text-align: justify;">
Creating material</h3>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNMZKC05-dimHfQW2-rXuhkbIAHXZYq3fRJMet0GHK5f2fxOt8wRVlZ4Tm_02lsMliEtAY6t6tJcOdpIdOU748_4zx8IAmqPt53hFe43PC_P-qprv0-qbDbHpiQrJCLya5GUZQXcO-3gOJ/s1600/overview.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="792" data-original-width="1146" height="442" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNMZKC05-dimHfQW2-rXuhkbIAHXZYq3fRJMet0GHK5f2fxOt8wRVlZ4Tm_02lsMliEtAY6t6tJcOdpIdOU748_4zx8IAmqPt53hFe43PC_P-qprv0-qbDbHpiQrJCLya5GUZQXcO-3gOJ/s640/overview.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
You need to generate world-space coordinates for every texel of your room. Fortunately, Unreal already have a node to do this for you. The node named InteriorCubemap. It generates UVW coordinates that can be passed to cubemap.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlDAlib9jEdn8mh567C9nar4R6546OIDgJNzWORQqiu9rWpz8OJYUdyGdtLyL1BuKfZIm7p4OPxnmWydRGCDtZCkM1ZbJub_sXzU4QWjVNC5fuVin5GHbGRcy3TcnXM6guSxsZR45a9EOx/s1600/Screenshot_4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="502" data-original-width="1010" height="318" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlDAlib9jEdn8mh567C9nar4R6546OIDgJNzWORQqiu9rWpz8OJYUdyGdtLyL1BuKfZIm7p4OPxnmWydRGCDtZCkM1ZbJub_sXzU4QWjVNC5fuVin5GHbGRcy3TcnXM6guSxsZR45a9EOx/s640/Screenshot_4.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Shift parameter helps to tweak camera position inside room. This value is used with bunch Tweak Cubemap. By thweaking those siz values you able to modify output of Interior Cubemap to achive best mapping for a cubemap.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Another one tweak is related to texture coordinates itself. Those nodes allow to tile rooms and shift them along U and V axsis.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxOmUYtgMB7yOFXvCN-hnDnNI2fs_YEvzsvRHhkk35_m-EFRwKPcB5NNuyNW6o_rYMWUS45kg_U5PZ__Pw4zMzj7ynf97riOnIiIgd50UU7ESJ_7cNqt-SY5uBZ6m1GOHllVGwdqv9yh0b/s1600/Screenshot_9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="623" data-original-width="676" height="588" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxOmUYtgMB7yOFXvCN-hnDnNI2fs_YEvzsvRHhkk35_m-EFRwKPcB5NNuyNW6o_rYMWUS45kg_U5PZ__Pw4zMzj7ynf97riOnIiIgd50UU7ESJ_7cNqt-SY5uBZ6m1GOHllVGwdqv9yh0b/s640/Screenshot_9.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl_7UMTlBZaHIqu7CUPGyVmZ571D4pFtkHzhv9bCXsr2t-Uk-aXi_G7PfpD0c1RArY8MMJsu8pjRzcGDiRVtJ-xWDyU28l3hdHaFsbR-rhHkGmQ5pWYzNcbkUELPppma5Q9gX9k3pj1Yoz/s1600/Screenshot_5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="404" data-original-width="585" height="440" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl_7UMTlBZaHIqu7CUPGyVmZ571D4pFtkHzhv9bCXsr2t-Uk-aXi_G7PfpD0c1RArY8MMJsu8pjRzcGDiRVtJ-xWDyU28l3hdHaFsbR-rhHkGmQ5pWYzNcbkUELPppma5Q9gX9k3pj1Yoz/s640/Screenshot_5.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I've added options to control look for the room by changing it's tint and saturation</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_dsqNWIdX6lPkQYjldl4iCmxcObJI5pR7jUh0I4on2pwxD4u23bKjqvAqngxbsWeeZqtX7JPhcw4LPMy9u8cku6QMgiGCRjcugtlJyZNiMDB083QBDmwQwUxCFMTN8WdbgB0oOY82Io3v/s1600/Screenshot_7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="286" data-original-width="602" height="304" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_dsqNWIdX6lPkQYjldl4iCmxcObJI5pR7jUh0I4on2pwxD4u23bKjqvAqngxbsWeeZqtX7JPhcw4LPMy9u8cku6QMgiGCRjcugtlJyZNiMDB083QBDmwQwUxCFMTN8WdbgB0oOY82Io3v/s640/Screenshot_7.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
And another one good idea is to add a curtains if you are planning to make a materila for a fake window</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdZ7Auqt1Wj3_aSdgU9nhdezkPJMxGs8W0F0G7ByFrj9viI8JoA1hBUlRK8t4GWl0yuw2s8JO9R8vbLI8znlgKgtoEyIXUJFmalIFeORpLo-oFWG2dgIpOyzPME5tAukz4PRW5W-Eg7Y_q/s1600/Screenshot_8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="396" data-original-width="712" height="354" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdZ7Auqt1Wj3_aSdgU9nhdezkPJMxGs8W0F0G7ByFrj9viI8JoA1hBUlRK8t4GWl0yuw2s8JO9R8vbLI8znlgKgtoEyIXUJFmalIFeORpLo-oFWG2dgIpOyzPME5tAukz4PRW5W-Eg7Y_q/s640/Screenshot_8.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Curtains are lerped with output cubemap</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhagV9sEU5XCsz3rc_wXmQCikSYMYuX77MWIsumyrTXnWoFUnu057j1LMvVgNRSUfmIbUiWCobywuRJIHdFZgK1V3Y3D3WyKIExSO9Zuj7h0vTTVAByxsdanT5N4nNVkb7Bx_WAcOccKiqz/s1600/Screenshot_10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="340" data-original-width="652" height="332" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhagV9sEU5XCsz3rc_wXmQCikSYMYuX77MWIsumyrTXnWoFUnu057j1LMvVgNRSUfmIbUiWCobywuRJIHdFZgK1V3Y3D3WyKIExSO9Zuj7h0vTTVAByxsdanT5N4nNVkb7Bx_WAcOccKiqz/s640/Screenshot_10.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This is how it works:</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6KmlFdZOc8LcwX6N7sGvMTlEfHH_yGNB0a56qFgEC3r0UaOOsJIArh2Sx7Kq6VysYHt7C-ZmhIH4tzafxwE482rYAgRACBmgDaP1KrVGIKG7KQ3LioMOhKHahOesx9C1MogYXhEII4bUs/s1600/ezgif-4-31e6cc43fe.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="200" data-original-width="210" height="380" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6KmlFdZOc8LcwX6N7sGvMTlEfHH_yGNB0a56qFgEC3r0UaOOsJIArh2Sx7Kq6VysYHt7C-ZmhIH4tzafxwE482rYAgRACBmgDaP1KrVGIKG7KQ3LioMOhKHahOesx9C1MogYXhEII4bUs/s400/ezgif-4-31e6cc43fe.gif" width="400" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlvwCaVWcfKmfKqS4abI2DaHMRD4xyvqwJOFt1goRgozukgcxBAYF3yqqiQOzGQqb-qzWN3MMvxNOFuwEUMt48xfqEDE49yPqqlwjn-_ragMa62-wFBxDnNDXw5ZzjJ7tWdlcm1wnQfnGL/s1600/ezgif-4-34774fc838.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="236" data-original-width="276" height="340" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlvwCaVWcfKmfKqS4abI2DaHMRD4xyvqwJOFt1goRgozukgcxBAYF3yqqiQOzGQqb-qzWN3MMvxNOFuwEUMt48xfqEDE49yPqqlwjn-_ragMa62-wFBxDnNDXw5ZzjJ7tWdlcm1wnQfnGL/s400/ezgif-4-34774fc838.gif" width="400" /></a></div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: justify;">
Baking cubemap</h3>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0ZPFe2fu6YBZz4pOo0xzHJ6ygqjy-_en8M_5JmUQddA3EdOP5FPpQskBNzs38ARM_uqApTb9MCPhZMr6LvHn86np0pFcSXprAHm0BugMl0Wj0EXKThoI5MINlxE50E6x8GEIEzSeVgWnX/s1600/Screenshot_1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="542" data-original-width="999" height="345" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0ZPFe2fu6YBZz4pOo0xzHJ6ygqjy-_en8M_5JmUQddA3EdOP5FPpQskBNzs38ARM_uqApTb9MCPhZMr6LvHn86np0pFcSXprAHm0BugMl0Wj0EXKThoI5MINlxE50E6x8GEIEzSeVgWnX/s640/Screenshot_1.png" width="640" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
First, you need to bake your interiour into cubemap, or find cubemap somewhere else. Let’s assume that you have some scene with interior for your fake room. Place SceneCaptureCube Actor at the center of your scene. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Then create new CubeRenderTarget and set it as TextureTarget property of CaptureCubeActor. Now you have a cubemap of your room. The best practice is to use a room that fits into cube. You can save your cubemap as a static static texture and delete CubeRender from scene. Use captured cubemap in shader and have fun. (But remeber, that you will need to tweak some settings first)</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2oDZGG9q-HOSFPnp6i0h_qXW_rQBoDBI3A2K_MlkCfsb0B_z8W1ASSJWyGuonaL2LWvChzUSY9mKbEP-PeC-1jm8OvhMHEQy990XX1yAyyjkR11WWSHALUDjtOqUMOxuDcJK-dfTbf-Ai/s1600/Screenshot_3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="434" data-original-width="849" height="326" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2oDZGG9q-HOSFPnp6i0h_qXW_rQBoDBI3A2K_MlkCfsb0B_z8W1ASSJWyGuonaL2LWvChzUSY9mKbEP-PeC-1jm8OvhMHEQy990XX1yAyyjkR11WWSHALUDjtOqUMOxuDcJK-dfTbf-Ai/s640/Screenshot_3.png" width="640" /></a></div>
<div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
</div>
</div>
Anton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.com0tag:blogger.com,1999:blog-8023209643288967687.post-21722704479700949512017-02-04T03:56:00.003-08:002017-03-23T07:15:15.403-07:00Node-based Visual dialogue Editor for Unity<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
I'm working on visual node-based dialogue editor for Unity. Currently, I have alpha that allows not only to draw dialogue nodes, but call functions, check conditions and wait for events. I've already tested it into my small text quest and found it very usefull and handy. On a screenshot below you can see, how some dialogue may looks inside my editor:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjY-l-1i8xDmo34VDa4whXFm0mSEK_vy6bFyoNzmB30G4ZGIOsW6LhbuKQrGrR5C8vo342Eg26kpZdJztqQEmOwRZ9aXclJUR0foDCyehXIy2oV3kAp7DRlPujHaADwlnVm0OxmDpwwMww4/s1600/NodeBased.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="355" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjY-l-1i8xDmo34VDa4whXFm0mSEK_vy6bFyoNzmB30G4ZGIOsW6LhbuKQrGrR5C8vo342Eg26kpZdJztqQEmOwRZ9aXclJUR0foDCyehXIy2oV3kAp7DRlPujHaADwlnVm0OxmDpwwMww4/s640/NodeBased.PNG" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
The interface is pretty simple, almost everything is driven through context menues and hotkeys.<br />
What is so interesting you can see here?<br />
<br />
<b>Function calls</b>.<br />
You can implement any function in C# and call it in your script. (See third node) It supports various arguments. Currently, only string, float. int, bool and Unity.Object types of args are supported. On a sample you can see, that function "ShowWindow" is called with argument "NameForm". In order to be invoked, function must be exposed on C# side by calling a method. After this, function will be available from any dialog asset.<br />
<br />
<b>Event Bindings.</b><br />
As you can see, after "ShowWindow" node, there is another node. This node suspends dialog evaluation until event OnScreenClosed will be fired. This event declared on c# side as event without any parameters. When event will be triggered, dialog will continue it's flow. <br />
<br />
<b>Branching.</b><br />
It supports branching. You can see that dialog has three options to continue. Node "Switch Dialog Flow" let you to create branches of options. Selection type:"User Selected" means, that every option after Switch node will be displayed on a screen, and after player makes a choice, dialog continues.<br />
<br />
<b>Conditions.</b><br />
You can create and check conditions inside dialogues. Every dialogue node has a field where you can write some expression to check. Expression is formed from conditions. Condition has its name and state: true, false, notexisted. On example below, there is only one condition: door_closed. It is created for a first time with its state set to false. If player ask NPC to close a door, then condition will change it's state to true and dialog flow will be returned at switch where node "Close the door" won't be shown for that time.<br />
<br />
<b>RoadMap:</b><br />
I'm going to implemet some extra features, after that editor will be available at Unity Store:<br />
<ul style="text-align: left;">
<li>Exposing variables</li>
<li>Support for math and boolean expressions</li>
<li>In-script varialbes and functions definitions</li>
<li>Binary serialization of data, stored inside of nodes</li>
<li>Support for localization</li>
</ul>
<br /></div>
Anton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.com0tag:blogger.com,1999:blog-8023209643288967687.post-89451196736369506622017-02-01T07:07:00.001-08:002017-02-01T07:08:21.258-08:00Gallery<div dir="ltr" style="text-align: left;" trbidi="on">
Just added Gallery where some of my 2D and 3D artworks are exposed.<br />
You can check it here:<br />
<a href="http://antondoe.blogspot.ru/p/blog-page_31.html">http://antondoe.blogspot.ru/p/blog-page_31.html</a></div>
Anton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.com0tag:blogger.com,1999:blog-8023209643288967687.post-303746608696677122016-11-26T07:41:00.000-08:002016-11-28T08:33:33.346-08:00Finished Inventory Grid<div dir="ltr" style="text-align: left;" trbidi="on">
I'm working on GUI system for Insomnia RPG. I've done alot of work but there is still much here.<br />
Today I'm finished inventory grid widget that allows player to manage his inventory.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwZNTJZN4kIGFCGFLcSxx6ezWZq6aa-YsPNv69tg8-BaNdi3u683Tf_cZwBNBX6akfflAQr9rTiLouZOQLOqHxszZtbvgx7TlXG437ddD1LmgiKKGHyKEbtxH42l8OSh2vqqoDRJqjcAWk/s1600/Untitled1.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwZNTJZN4kIGFCGFLcSxx6ezWZq6aa-YsPNv69tg8-BaNdi3u683Tf_cZwBNBX6akfflAQr9rTiLouZOQLOqHxszZtbvgx7TlXG437ddD1LmgiKKGHyKEbtxH42l8OSh2vqqoDRJqjcAWk/s400/Untitled1.gif" width="393" /></a></div>
<br />
Players will be able to disassemble things to get resources that can be spent when crafting new stuff. We althogh have a barther system that allow to trade things with NPCs.<br />
<br />
This widget is used on loot and trading screen as well as on character inventory screen.</div>
Anton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.com0tag:blogger.com,1999:blog-8023209643288967687.post-20851386279847587272016-08-24T23:53:00.003-07:002016-09-06T10:50:32.461-07:00Lens Flares Has Been Released on Epic Marketplace<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwpUgTvRaPYLOxuzutxEpdTEij7iqhOxaFi47ERcy2g2ZJXbrF04UUb-HGEKF09IIzItea4XyuQ6A_CAUNIvhl-r8_T64_gzkLhdxq2P11p5gz7p-n7sRuHk16ygZoSNzPsaImSZllnTeo/s1600/LensFlare_Thumb-284x284-e82058fb90ade6add40677edda4b4f04.PNG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwpUgTvRaPYLOxuzutxEpdTEij7iqhOxaFi47ERcy2g2ZJXbrF04UUb-HGEKF09IIzItea4XyuQ6A_CAUNIvhl-r8_T64_gzkLhdxq2P11p5gz7p-n7sRuHk16ygZoSNzPsaImSZllnTeo/s320/LensFlare_Thumb-284x284-e82058fb90ade6add40677edda4b4f04.PNG" width="320" /></a></div>
I designed a shader to help simulate various lens flares effects like flares around light sources, glow, light spikes. This works correctly for all cases including casese with overlapping.<br />
<br />
My lens flares material pack has been released on Marketplace and available from this link: <a href="https://www.unrealengine.com/marketplace/custom-lens-flares-material">https://www.unrealengine.com/marketplace/custom-lens-flares-material</a><br />
<br />
You can read more here:<br />
<a href="http://antondoe.blogspot.ru/2016/06/creating-custom-anamorpic-lens-flare-in.html">http://antondoe.blogspot.ru/2016/06/creating-custom-anamorpic-lens-flare-in.html</a></div>
Anton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.com0tag:blogger.com,1999:blog-8023209643288967687.post-61494222920159313102016-08-17T06:50:00.001-07:002016-08-17T06:52:15.532-07:00Radial Blur Shader in Unreal Engine 4<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Today I've made this simple post process material, that applies a radial blur to screen. That was made for a sniper rifle mode in game, when player is looking through a optical sight. And we've got this raw effect:<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIq7AmVtkLa4MUBXb9tUxodjei74puMRku3_yupCH8CmKQGBpuA7o_ux26i9a1M-6eXFVW75CW9vKCQwYlRIDx1wM_zNx4Yvq3S79ctTiSnJJ5QyZDpAEszpdmzXpkryv29MvOcGMrfgDg/s1600/radialBlur.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="361" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIq7AmVtkLa4MUBXb9tUxodjei74puMRku3_yupCH8CmKQGBpuA7o_ux26i9a1M-6eXFVW75CW9vKCQwYlRIDx1wM_zNx4Yvq3S79ctTiSnJJ5QyZDpAEszpdmzXpkryv29MvOcGMrfgDg/s640/radialBlur.png" width="640" /></a> </div>
<br />
<a name='more'></a>To create this shader I use a custom node expression in material editor. You can see it's code here:<br />
<br />
<script src="https://gist.github.com/wiresandflowers/9090bccca23d3ef2326ed590e4732950.js"></script>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh347jkGwkaENtJjXzIkTa7syIKQS_ynjREe5wxf3EibicrxbxCb3o3lfj9Gl5eJpLFNkvreX-bcuz38yq-XFj3q31HfSullz92z21vOCae7FbkJOuPgjO_a7Yk02BRv6o8J_OXZBWgxwgA/s1600/RadialBlurShader.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="424" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh347jkGwkaENtJjXzIkTa7syIKQS_ynjREe5wxf3EibicrxbxCb3o3lfj9Gl5eJpLFNkvreX-bcuz38yq-XFj3q31HfSullz92z21vOCae7FbkJOuPgjO_a7Yk02BRv6o8J_OXZBWgxwgA/s640/RadialBlurShader.png" width="640" /></a></div>
Just copy the source and paste it into your custom node.<br />
Modify as you need.</div>
Anton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.com0tag:blogger.com,1999:blog-8023209643288967687.post-22723990762483365042016-08-10T03:46:00.002-07:002016-08-11T07:12:15.483-07:00Serialization with Polymorphism and Inheritance in Unity<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMYNQNXRJHP0C8NcyxTJSZGguUud51xB5kED8_rsigUxsmqyhP6BrBQi4lk9WNcMCaSQ9zhyUg1ot0HYy5ABMo0ABrX7wB6LwADfjPjFlsyxc0z3eyodSof0le_F8O_H3VHlZSp82DlIH-/s1600/logo.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="110" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMYNQNXRJHP0C8NcyxTJSZGguUud51xB5kED8_rsigUxsmqyhP6BrBQi4lk9WNcMCaSQ9zhyUg1ot0HYy5ABMo0ABrX7wB6LwADfjPjFlsyxc0z3eyodSof0le_F8O_H3VHlZSp82DlIH-/s200/logo.png" width="200" /></a>In this article, I would like to share my experience in serialization of classes with inheritance and polymorphism in Unity. If you have some troubles with serialization of ScriptableObjects or with saving your data, it’s written to help you. Here I try to explain, how to serialize your data into asset. You can download sources for this tutorial <a href="https://drive.google.com/open?id=0BwvgFuov8Sa-c29CbUFWZEt6c3c" target="_blank">here</a>.<br />
<br />
<a name='more'></a><br />
First of all, I want to say, that serialization WORKS for complex classes and SUPPORT inheritance. And I recommend to read <a href="http://forum.unity3d.com/threads/serialization-best-practices-megapost.155352/" target="_blank">this</a> post about serialization. It uncovers the process of serialization, but doesn’t explain how to serialize your data into assets. <br />
<br />
I was working on Dialog Editor for my project, and want to be able to save classes like this: <br />
<br />
<script src="https://gist.github.com/wiresandflowers/258a1204679e82d610aa121016c0d6dc.js"></script>
<br />
I faced with a lot of troubles when it come to serialization of polymorphic classes. Before Unity, I was working with Unreal Engine and never had any troubles with saving my data and didn’t expect, that it will be any problems with it in Unity. After a brief look into documentation, I tried to serialize some class, derived from base class and found, that serialization/deserialization didn't works as expected. There is a number of similar cases described on blogs and forums, and there was no clean solution. From the link given above, I've found, that for my case, I must use ScriptableObject as base class, in order to serialize polymorphic objects. ONLY objects, that derived from ScriptableObject and MonoBehaviour can be serialized/deserialized properly. Classes, that are inherited from ScriptableObject must be stored in separated files, so I've made some changes:<br />
<br />
<script src="https://gist.github.com/wiresandflowers/af3a995801ce0f5b1edc539d379f2dc8.js"></script>
<script src="https://gist.github.com/wiresandflowers/26c425a5fd7529bcc0035f21d83d8341.js"></script>
<br />
I decided to make a container for my classes:<br />
<br />
<script src="https://gist.github.com/wiresandflowers/7e1ba40856e00e5caa27f62b21d0446a.js"></script>
Like it is in Unreal Engine, all data is serialized into assets.For example, you want to serialize some object A that owns object B. You should create two assets: one for object A and one for object B. For my case, I must create asset for every object in List. Fortunately, Unity let us to store assets into assets. But in comparsion to Unreal Engine, registering and creating new assets in Unity is much easier.<br />
<br />
Here is a simple editor to create asset and edit serialized class:<br />
<script src="https://gist.github.com/wiresandflowers/759e2bb3957a594135392a0b6fd7be14.js"></script><br />
<br />
<span style="font-size: x-small;"><span style="font-family: "courier new" , "courier" , monospace;">hideFlags = HideFlags.HideInHierarchy</span></span> is used to hide assets inside DialogContainer in Hierarchy view. Without this, we get something like that:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3rn67Vbhz__i3jJqJo_Q4BBrnAtvoQ96zzV0G-DdHgyDoiVur4BmMT4Iayk4ksIgzlEycRrqQg4azXfhbLe2ycoPRJ4UaDw23Ry5I5cPLfQLpzzJVo6tKnA4Zb-4AH0Bytq_5niKNgeyp/s1600/serialization_1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3rn67Vbhz__i3jJqJo_Q4BBrnAtvoQ96zzV0G-DdHgyDoiVur4BmMT4Iayk4ksIgzlEycRrqQg4azXfhbLe2ycoPRJ4UaDw23Ry5I5cPLfQLpzzJVo6tKnA4Zb-4AH0Bytq_5niKNgeyp/s640/serialization_1.PNG" width="640" /></a></div>
<br />
DialogContainer is finished and ready to be serialized or deserialized!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjoFY7yIzktYMDDkloMywGBhOH54wKymC1CbMzbPM169bbqtEXV1RId6TWm1cWXjlLeSOI05Ww_qXeEiEWx17yXscwhd85HV52Ckj1JhOCXiTOv2M2A3CKQ1CdVUaqIeHkP5hBHWQu7YJa/s1600/serialization_3.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjoFY7yIzktYMDDkloMywGBhOH54wKymC1CbMzbPM169bbqtEXV1RId6TWm1cWXjlLeSOI05Ww_qXeEiEWx17yXscwhd85HV52Ckj1JhOCXiTOv2M2A3CKQ1CdVUaqIeHkP5hBHWQu7YJa/s640/serialization_3.PNG" width="528" /></a></div>
<br />
<br />
<h3 style="text-align: left;">
Troubleshooting</h3>
Until I have been writting this tutorial, I’ve made a number of mistakes, that make my code to works wrong. If you still have some troubles with serialization, read the text below and check your code for this errors.<br />
<br />
<ul style="text-align: left;">
<li>When reloading my project, i’ve found, that my object wasn’t loaded with error “The associated script cannot be loaded”. If you have this error, it’s most likely, that you declare a few classes, derived from ScriptableObject in one file. You must keep every object, derived from ScriptableObject or MonoBehaviour in separate files to prevent this issue.</li>
<li>If some function isn’t called on derived object, it’s most likely, that you forget to make it virtual. </li>
<li>If some filed isn’t serialized, check that it’s market as [SerializeFiled].</li>
</ul>
</div>
Anton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.com0tag:blogger.com,1999:blog-8023209643288967687.post-52122682395731511102016-08-04T05:11:00.000-07:002016-09-12T04:00:17.779-07:00Creating Fur in Unreal Engine<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
This tutorial shows how to create a fur like on screenshots below, using shells technique. This technique creates a number of shells around geometry and assigns material, that simulates fur slice for each shell. This looks pretty well from a distance.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTjkSGTrZTbYm3C_6zQCjQZwegttPEwu7J0Yv0nWCyCNBWDCYT9Xt0hadqKvg-yCvR2fUc5alSHodEGfO6pA54EPbynmwr2D1bHSUAoUcB6bdKjUF-GsFk3wprFEJ1ikeaCENe3RoCd0Bh/s1600/screen_f3.PNG"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTjkSGTrZTbYm3C_6zQCjQZwegttPEwu7J0Yv0nWCyCNBWDCYT9Xt0hadqKvg-yCvR2fUc5alSHodEGfO6pA54EPbynmwr2D1bHSUAoUcB6bdKjUF-GsFk3wprFEJ1ikeaCENe3RoCd0Bh/s640/screen_f3.PNG" /></a><br />
<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghMyYWGYk2AoBnw305lbgKh7biDj5ISjUG6hXOMPaLql_1oSGwLO-rTIxJYYGMwC1q6JTMsrEIC4XxTRWRv1JN_E9khA8TmgnUA_t35luOzb1IO0GgzmaHcgk4FZkOTpe_NOd2k8M7l9ic/s1600/Screen_F_1.png"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghMyYWGYk2AoBnw305lbgKh7biDj5ISjUG6hXOMPaLql_1oSGwLO-rTIxJYYGMwC1q6JTMsrEIC4XxTRWRv1JN_E9khA8TmgnUA_t35luOzb1IO0GgzmaHcgk4FZkOTpe_NOd2k8M7l9ic/s640/Screen_F_1.png" /></a> <br />
<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqsDXA9Ny1S-QG3LVVcxQCYnZqx_fPYijvAwqxv0R1DecuS6dg1fnBBEzz0qEeMS_7oXeNnX2cJ4aZ0Xi1grC436i6RYAAwZ_8Wn-qHemniAWSnHJ0at4yrngqhad2oOJlJPXDL9VzAm-F/s1600/Fur.png"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqsDXA9Ny1S-QG3LVVcxQCYnZqx_fPYijvAwqxv0R1DecuS6dg1fnBBEzz0qEeMS_7oXeNnX2cJ4aZ0Xi1grC436i6RYAAwZ_8Wn-qHemniAWSnHJ0at4yrngqhad2oOJlJPXDL9VzAm-F/s640/Fur.png" /></a> <br />
<br />
<br />
<a name='more'></a><br />
<br />
On images, there is a kind of vegetable or a mold that grows on a space station everywhere. Looks disgusting. This effect is widely used in game. It's applied for different props: Crates, armchairs, garbage and corpses. I’m happy with it. We want it to be hairy. <br />
<br />
The image below shows shells with applied masked material on it. <br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGcQhxEDLW05KtTIFeFKKuZcQ3AyGmSVc8AQVY4Wvfq73cQlYWebGTnO7BI_0INtWeopkf3RURV7bURe56As-DXvxp087Dl_oNat3fUPG7ija5hL8uwN7CZN2FzidKh1BnJzbQ95_wZdt4/s1600/Shells.png"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGcQhxEDLW05KtTIFeFKKuZcQ3AyGmSVc8AQVY4Wvfq73cQlYWebGTnO7BI_0INtWeopkf3RURV7bURe56As-DXvxp087Dl_oNat3fUPG7ija5hL8uwN7CZN2FzidKh1BnJzbQ95_wZdt4/s400/Shells.png" /></a> <br />
<br />
I create blueprint and material to test this technique for our purposes. The blueprint creates a number of StaticMeshComponents with fur material. Basicly, the material ables to control thickness of hairs and push a geometry at specified value. Then we added tons of other settings, which help to set hair color for roots and tips, wind and many other. This technique is expensive to use. There is two good tricks, that helps to optimize this. The first one is to reduce shells count with the distance. And the second is to bake lights for those things. To doing that, every shell must be static and root component must be static too. <br />
<br />
<h4 style="text-align: left;">
<span style="font-size: large;">The Blueprint:</span></h4>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbEtO3XpOJJI2KRhq2c832-MtW0n5_pR1-7jBbW-D9lSTfH-oQiiH0OeV7XGCgv4cmbUD5wT_RQn-IiCIwE0H5XgVhPh4cyhSDsUpxR8cDxiB94B5HfESzv-avmv7qag6Q0Dy1lDIVCAm_/s1600/blueprint_big+copy.png"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbEtO3XpOJJI2KRhq2c832-MtW0n5_pR1-7jBbW-D9lSTfH-oQiiH0OeV7XGCgv4cmbUD5wT_RQn-IiCIwE0H5XgVhPh4cyhSDsUpxR8cDxiB94B5HfESzv-avmv7qag6Q0Dy1lDIVCAm_/s640/blueprint_big+copy.png" /></a> <br />
<br />
This blueprint creates a number of shells around specified mesh and applies proper materials and parameters. Push for every shell is made on material side. This is done by moving each vertex on vertex pass toward its normal. In order to re-create this blueprint, you need to implement following variables:<br />
<ul>
<li>Mesh is StaticMeshComponent. Shells are created, based on this. </li>
<li>MeshMaterial is MaterialInterface. This material is used for mesh on which hairs are going to be placed. </li>
<li>FurMaterial is MaterialInterface. Here you can specify a hair material. </li>
<li>FurLevels it integer. It set count of shells. If this number equals to zero, only Mesh will be rendered and no fur will be generated. </li>
<li>HairLength is float. It specify how long hair will be. You can find distance between shells by divide it be FurLevels. </li>
<li>RootsColor is LinearColor. Sets color of hair roots. </li>
<li>TipsColor is LinearColor. Sets color of hair roots. Color for middle levels is interpolated. </li>
<li>RootsTickness is float. Sets size of hair roots. </li>
<li>TipsTickness is float. Sets size of hair tips. </li>
<li>FurCastingShadow is bool. Used to disable casting shadow for shells in order to improve performance. </li>
<li>InheritWind is bool. Used to override fur vertex animation from animation specified in MeshMaterial. </li>
<li>furDrawDistance is float. It’s a distance to camera on which only last shell is visible. For distance greater that that, no shells will be rendered. A number of visible shells are increased up to FurLevels, as distance becomes smaller.</li>
</ul>
In the “Set Shell properties” and “Set Material Properties for Shell” blocks parameters of every shell are setup. Max draw distance is set so that with increasing distance, shells are disappearing consecutively. You can see what is inside of this nodes on two images below. Look at “control hairs diameter” macro. It’s a function from shell index, that evaluate hair diameter for each shell. Previously, I try to use Lerp to approximate hair size, but then i changed it to what you can see on image. This function doesn’t explain the relation between hair diameter and shell push level, but approximately works as we need. You can try to build your own function. The wind block contains nodes that setup vertex animation for material. This block isn’t necessary for creating fur, so i skip its description. You can easily construct it if you need. <br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglP9IHtb1RH03Vgkv_P8mDDp-y78G5Ue4sZPBYklpusYXFoJE9L4ZW3MF3Fn0AdbxXommfbhf5V_49NCoxYdbEpOee0tub3VRPkNsor2WrU1CXHp0Jqzy-W31sQ3oHLe1Q6ZS_IB3jcEMS/s1600/control+hair+size.png"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglP9IHtb1RH03Vgkv_P8mDDp-y78G5Ue4sZPBYklpusYXFoJE9L4ZW3MF3Fn0AdbxXommfbhf5V_49NCoxYdbEpOee0tub3VRPkNsor2WrU1CXHp0Jqzy-W31sQ3oHLe1Q6ZS_IB3jcEMS/s640/control+hair+size.png" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOXRoPze-QBAW4xyEzChZ-K34H33JrpRHE7QpQ5dLBXccZ_E4DmY9JZINelDRYeCeiEGxudkLjRh_bNg0MWvpg66j4B6ZwgSoa6Cz-OAvEiO-yizbD_8_3NTeXeMjfDLPiW6a9mtWbbWGO/s1600/set+shell+properties.png"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOXRoPze-QBAW4xyEzChZ-K34H33JrpRHE7QpQ5dLBXccZ_E4DmY9JZINelDRYeCeiEGxudkLjRh_bNg0MWvpg66j4B6ZwgSoa6Cz-OAvEiO-yizbD_8_3NTeXeMjfDLPiW6a9mtWbbWGO/s640/set+shell+properties.png" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_5YwBOacLdjVPMXwMLECdT0OFW-ES0mqLoPF_3y1hpOoVPgWlVlepBlicofjFOEaZYGDI2XfjRlvKzK-UgumUCzJlfKCzmc5t4-dXsj-xDzoeB3wD6576PBzF_15Ve0KwQ9JgW2dFMUpX/s1600/smpfs+copy.png"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_5YwBOacLdjVPMXwMLECdT0OFW-ES0mqLoPF_3y1hpOoVPgWlVlepBlicofjFOEaZYGDI2XfjRlvKzK-UgumUCzJlfKCzmc5t4-dXsj-xDzoeB3wD6576PBzF_15Ve0KwQ9JgW2dFMUpX/s640/smpfs+copy.png" /></a><br />
<br />
<h4 style="text-align: left;">
<span style="font-size: large;">The Material:</span></h4>
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJBGI3kgF_IZuYUotGAsVdRyBZLW81aAThiK_PzrPh_6wI7EqMpunxEvubQw-NKZirQ869oevFtAKM9qBOPqVZDUJVRBxWFo3ZkmhvY8tV1LGTwznJNsWeFDjDw2p5Qo9qwNqSfrx0-It2/s1600/Material_Overview.PNG"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJBGI3kgF_IZuYUotGAsVdRyBZLW81aAThiK_PzrPh_6wI7EqMpunxEvubQw-NKZirQ869oevFtAKM9qBOPqVZDUJVRBxWFo3ZkmhvY8tV1LGTwznJNsWeFDjDw2p5Qo9qwNqSfrx0-It2/s640/Material_Overview.PNG" /></a><br />
<br />
<br />
<br />
<h4 style="text-align: left;">
<span style="font-size: large;">Fur_Color</span></h4>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZ3DbrhW8B4_7NnShKMy_1yn2TG4yQMniV5d1LoXnGzSaxLPnCNb_LLwcvkkucP4flxBZp6_XGe3RQhoTMJpV1Ab08fEWBZI1bF8I58rv8oslBTCN3PtUAZeKphZpE8WCA1elbEbzHeaN-/s1600/FurColor.png"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZ3DbrhW8B4_7NnShKMy_1yn2TG4yQMniV5d1LoXnGzSaxLPnCNb_LLwcvkkucP4flxBZp6_XGe3RQhoTMJpV1Ab08fEWBZI1bF8I58rv8oslBTCN3PtUAZeKphZpE8WCA1elbEbzHeaN-/s640/FurColor.png" /></a><br />
As seen from it’s name, this block is used to control fur’s color. <br />
<br />
<br />
<br />
<h4 style="text-align: left;">
<span style="font-size: large;">Size control</span></h4>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCFCWdAblVuKG1KbjkH0ZoDVSTQruEVPISQaGTRVC5s1q_VD1ApfwYQkabAVsowpa0zPUdCLjuXWjn5_859WcmH3xpU9gvixBYcdHnVIjM1hJ3dh0qylC-1yEYPKgCaiGmUXV8_oAJqTgX/s1600/SizeControl.png"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCFCWdAblVuKG1KbjkH0ZoDVSTQruEVPISQaGTRVC5s1q_VD1ApfwYQkabAVsowpa0zPUdCLjuXWjn5_859WcmH3xpU9gvixBYcdHnVIjM1hJ3dh0qylC-1yEYPKgCaiGmUXV8_oAJqTgX/s640/SizeControl.png" /></a><br />
<br />
The idea of this block is to multiply color by a diameter value and then crop the result. <br />
<br />
<h4 style="text-align: left;">
<span style="font-size: large;"> </span></h4>
<h4 style="text-align: left;">
<span style="font-size: large;">Distribution</span></h4>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtn-Iuf6K3jhI0sr3KrOkILDpaNPF0w6PuxBkFx1uCzI0ejUZeQtcJZ1GBVD6XEZATBGv4SxPGjVUaKwT3pMBeEs30884T4WTUlV8stIKEfnCaHKgqOI6tc0fTzIXyq3HzRVy7QIQggQKo/s1600/Distribution.png"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtn-Iuf6K3jhI0sr3KrOkILDpaNPF0w6PuxBkFx1uCzI0ejUZeQtcJZ1GBVD6XEZATBGv4SxPGjVUaKwT3pMBeEs30884T4WTUlV8stIKEfnCaHKgqOI6tc0fTzIXyq3HzRVy7QIQggQKo/s640/Distribution.png" /></a><br />
<br />
In this block you can specify a distribution texture. This map show areas, where fur grows. It able to grow this areas or shrink them.<br />
<br />
<h4 style="text-align: left;">
<span style="font-size: large;">Chaos</span></h4>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDmfcshiZ08NLwx_JWvE8G-bNm5uYIVaLaqnoprl4lMXGclntUSWRwvqP_gz7BQcbHBG5h2bq_PLSdOHZf2xHdkfoXr87L7sy4ykLZH_Y2U36lkA-pEMzKcLM7STvF8V5XQL3RxaxPoKVm/s1600/chaos.png"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDmfcshiZ08NLwx_JWvE8G-bNm5uYIVaLaqnoprl4lMXGclntUSWRwvqP_gz7BQcbHBG5h2bq_PLSdOHZf2xHdkfoXr87L7sy4ykLZH_Y2U36lkA-pEMzKcLM7STvF8V5XQL3RxaxPoKVm/s640/chaos.png" /></a><br />
<br />
The most important node is chaos. This node evaluate the world offset for each level. It adds displacement from a given texture to normal direction for each vertex with specified weight. With chaos fur look more natural.<br />
<h4 style="text-align: left;">
<span style="font-size: large;"> </span></h4>
<h4 style="text-align: left;">
<span style="font-size: large;">Wind</span></h4>
<div style="text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjny5czNmbJiq0I9y6E4GPpkktosgeIXyrN9eqM3W5upa6uD8Wqpy9O6WSy8tQTUg7pay6JSwnVzNZG16CunkMuMvYyVzK5oDcvaqFENIs4BJ_AUB8EgJxVSVY16glakOu9CjaCJ1ZSN-8x/s1600/wind.png"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjny5czNmbJiq0I9y6E4GPpkktosgeIXyrN9eqM3W5upa6uD8Wqpy9O6WSy8tQTUg7pay6JSwnVzNZG16CunkMuMvYyVzK5oDcvaqFENIs4BJ_AUB8EgJxVSVY16glakOu9CjaCJ1ZSN-8x/s640/wind.png" /></a><br />
<br />
This bunch of nodes simulates wind by moving vertices.</div>
<h4 style="text-align: left;">
<span style="font-size: large;"> </span></h4>
<h4 style="text-align: left;">
<span style="font-size: large;">Surface</span></h4>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZ7H2tMOxsEbSH0SI2AO2LRSoz_JDjVA4Zi0zWjkTALXAb2qH0lSACQSdiDPkYXH1jbUaBS_Y6ks-Kp7_dv2LV_Ho4VnDePVx-onDW7HQPL_4jaE6UXvu99HGhAt1eLPwMoQNtSrzzSyct/s1600/Surface.png"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZ7H2tMOxsEbSH0SI2AO2LRSoz_JDjVA4Zi0zWjkTALXAb2qH0lSACQSdiDPkYXH1jbUaBS_Y6ks-Kp7_dv2LV_Ho4VnDePVx-onDW7HQPL_4jaE6UXvu99HGhAt1eLPwMoQNtSrzzSyct/s1600/Surface.png" /></a></div>
Anton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.com1tag:blogger.com,1999:blog-8023209643288967687.post-54538671594152449962016-06-27T05:32:00.000-07:002016-08-07T03:31:51.295-07:00Unreal: Debugging materials and shaders example<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
</h2>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Here is two tips that may be usefull if you want to debug your shader.<br /><br />There is many ways to debug shaders in Unreal Engine. For example, you can translate your shader into HLSL code and use any software that you like for debug that. Or install a Renderdoc plugin to capture a whole frame in Unreal's viewport and jump to Renderdoc. You can read more about it here. <br /><br />But sometimes you don't want to dig deeper when debugging and use a third-party software, especially if you are not going to solve something complicated, but want to debug some value or see what shader does after interpretation in hlsl.</span><br />
<br />
<a name='more'></a><br />
<br />
There is a very usefull MaterialNodes for debugging values:<br />
<ul style="text-align: left;">
<li><b><span style="font-family: "arial" , "helvetica" , sans-serif;">DebugScalarValues </span></b></li>
<li><b><span style="font-family: "arial" , "helvetica" , sans-serif;">DebugFloat2Values</span></b></li>
<li><b><span style="font-family: "arial" , "helvetica" , sans-serif;">DebugFloat3Values</span></b></li>
<li><b><span style="font-family: "arial" , "helvetica" , sans-serif;">DebugFloat4Values</span></b></li>
</ul>
<span style="font-family: "arial" , "helvetica" , sans-serif;">and few very specific like</span><br />
<ul style="text-align: left;">
<li><b><span style="font-family: "arial" , "helvetica" , sans-serif;">DebugBinaryValues-Int</span></b></li>
<li><b><span style="font-family: "arial" , "helvetica" , sans-serif;">DebugBinaryValues-Float </span></b></li>
<li><b><span style="font-family: "arial" , "helvetica" , sans-serif;">DebugTimeSine</span></b></li>
</ul>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Let's see what DebugScalarValues is. This node generates a texture with image of a number value passed in. It has four input pins: (names are self-explained)</span><br />
<ul style="text-align: left;">
<li><span style="font-family: "arial" , "helvetica" , sans-serif;"><b>Number</b> is a value that we would like to debug</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;"><b>MaximumNumberOfDigits</b></span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;"><b>DebugTextlocation</b></span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;"><b>UVs</b></span></li>
</ul>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><span style="font-family: "arial" , "helvetica" , sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhziB00lm4bW7fLspoxEz48yf95W4KkzYimU3owyykSa3ZSs9dKmJWXxU1ZslphXts9cMK-ugNGimGKg8xJNLbdwhnov3cZig74fV4su6BR1Aabj7EOP4gHNqDLW1lwllmmpHynM9JAuIL3/s1600/debug-1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="278" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhziB00lm4bW7fLspoxEz48yf95W4KkzYimU3owyykSa3ZSs9dKmJWXxU1ZslphXts9cMK-ugNGimGKg8xJNLbdwhnov3cZig74fV4su6BR1Aabj7EOP4gHNqDLW1lwllmmpHynM9JAuIL3/s640/debug-1.png" width="640" /></a></span></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: "arial" , "helvetica" , sans-serif;">DebugScalarValues</span></td><td class="tr-caption" style="text-align: center;"></td></tr>
</tbody></table>
<span style="font-family: "arial" , "helvetica" , sans-serif;">On the screenshot above, you can see that texture was generated, and represents a value, that is kept in constant parameter. The other three nodes acts the same way except DebugBinaryValues-Int and DebugBinaryValues-Float. They generate a binary representation of a given value. You can control size and position of texture by using UVs input and DebugTextLocation. You use a few debug nodes with a properly set UV lerped together, in order to debug a few values.<br /><br /><br />This nodes are extremely helpfull, if you need to see what is inside of a few variables independent of pixel position. If you are looking for a way to control values for each pixel in a frame, you need more complex solution as was written above.<br /><br /><br /><br />If you need a hlsl code of your shader you can get it from a window menu:</span><br />
<div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhJuP-4_0cpE_MI6sfL3j77_lWArfP85Sw14wF6m9XwsAL76in1lYpPbTwHBjwMz_rrGSwZ5O3SqTA-4BC1V6-Rv07r9KuAX_zsky3Rbo7N6MW5nm8Sr7_-s2bgscaGiKwyzN45QU6-DTI/s1600/hlsl.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhJuP-4_0cpE_MI6sfL3j77_lWArfP85Sw14wF6m9XwsAL76in1lYpPbTwHBjwMz_rrGSwZ5O3SqTA-4BC1V6-Rv07r9KuAX_zsky3Rbo7N6MW5nm8Sr7_-s2bgscaGiKwyzN45QU6-DTI/s1600/hlsl.png" /></a></span></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">The source code of common shaders may usually be found in a folder C:\Program Files\Epic Games\4.XX\Engine\Shaders. That could be helpfull, if you are going to write your custom nodes and want to use some functions and parameter, that doesn't have any representation in the graph view. </span></div>
</div>
Anton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.com0tag:blogger.com,1999:blog-8023209643288967687.post-21509789923356802122016-06-22T06:50:00.003-07:002016-08-07T03:25:27.628-07:00How to make text facing a camera in Unreal Engine<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
</h2>
<span style="font-family: "arial" , "helvetica" , sans-serif;"></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Hi, I've found a pretty easy way to do that by writing a shader.</span><br />
<br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">If you deal with a text-in-a-wolrd in Unreal it's most likely that you use the TextRenderComponent. It uses a text material and here we begin. All we need is to change this material.</span><br />
<br />
<a name='more'></a><br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><span style="font-family: "arial" , "helvetica" , sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbhxpQNHvAoCcgx8FoiXO1a31HE78sYCC_PDEZF8goNuC5b_VtixtJn6tsovaj2wXY07h3bvqLbmZeGCMzm8rlhnpTdIdoYFDJ2VesNiAYFJqbvKyq_1kc1LA5YOoppC7F6n_HJB21BMAf/s1600/textrenderer.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbhxpQNHvAoCcgx8FoiXO1a31HE78sYCC_PDEZF8goNuC5b_VtixtJn6tsovaj2wXY07h3bvqLbmZeGCMzm8rlhnpTdIdoYFDJ2VesNiAYFJqbvKyq_1kc1LA5YOoppC7F6n_HJB21BMAf/s640/textrenderer.PNG" width="460" /></a></span></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: "arial" , "helvetica" , sans-serif;">TextRender Properties</span></td></tr>
</tbody></table>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">The idea is to use WorldPositionOffset, to set mesh vertices facing a camera in a vertex pass. And we are lucky, because this function is already exist and named "AlignMeshToTheCamera". </span><br />
<br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">Take a look at my Material:</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><span style="font-family: "arial" , "helvetica" , sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivVUkkb0IM6C5nHFUJrIKZTmegYBI3q4Y-GPm6Rvwe-b4n-Z712jdKoam7rHSr6KhLVZlCyJzz9LQHPHcWheBLwIBs67xHcH88KFfyosoHAz_8gFB50-NYslZbEW08oTQx5nyDdrhi6QhR/s1600/mat.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="390" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivVUkkb0IM6C5nHFUJrIKZTmegYBI3q4Y-GPm6Rvwe-b4n-Z712jdKoam7rHSr6KhLVZlCyJzz9LQHPHcWheBLwIBs67xHcH88KFfyosoHAz_8gFB50-NYslZbEW08oTQx5nyDdrhi6QhR/s640/mat.PNG" width="640" /></a></span></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: "arial" , "helvetica" , sans-serif;">Material</span></td></tr>
</tbody></table>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Set basis vectors as you like, and enjoy. </span></div>
Anton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.com0tag:blogger.com,1999:blog-8023209643288967687.post-89486223085007798932016-06-06T04:09:00.001-07:002016-08-25T00:15:43.901-07:00Creating Custom Anamorpic Lens Flare in Unreal Engine<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
</h2>
<h4 style="text-align: left;">
</h4>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Unreal Engine doesn't have any built-in features for create highly-customized lens flares. By default, lens flares are implemented as a image-based effect, so we deal with engine rendering system. In our game we need custom lens flares that can be blocked by other objects. For example, if we have a light source that shine in camera on a background plane and some object, that blocking this light, lens flare should be blocked. This is the main problem. </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">In this tutorial, I described a solution of this problem. Note, that the material, described below works correctly only for cameras without fixed aspect ratio (fixed aspect crops image and mask cropped areas with blackbars) and with fov equals 90. You can get the complex solution, that works correctly for all cases from unreal marketplace: </span><span style="font-family: "arial" , "helvetica" , sans-serif;"><a href="https://www.unrealengine.com/marketplace/custom-lens-flares-material">https://www.unrealengine.com/marketplace/custom-lens-flares-material</a></span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1q_IRm7nZwp_qZyvWXcY1ATWZ3Tkf-bazuWXVyEk-SWKNEd55ddaaSN4a-u3LshZS6eqWrs2zwSgWlBswvxpazLkf2GcbMfQclgsskIvPtohR6FfKtFkucB_wxJ50zcD_8tn-VCS5GRrP/s1600/lossless.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="220" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1q_IRm7nZwp_qZyvWXcY1ATWZ3Tkf-bazuWXVyEk-SWKNEd55ddaaSN4a-u3LshZS6eqWrs2zwSgWlBswvxpazLkf2GcbMfQclgsskIvPtohR6FfKtFkucB_wxJ50zcD_8tn-VCS5GRrP/s400/lossless.PNG" width="400" /></a></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"></span><br />
<a name='more'></a><span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<h3 style="text-align: left;">
<span style="font-family: "arial" , "helvetica" , sans-serif;">The solution:</span></h3>
<span style="font-family: "arial" , "helvetica" , sans-serif;">There is many solutions of this problem. The most popular is to make lens flare as a particle system and control its visibility from a component which casts a ray into camera. If ray is blocked, particle system doesn't visible and vice versa. Using particles is a good idea, but component it's not a good solution because of a many reasons: it's expensive, doesn't work in editor mode, doesn't work for split-screens, doesn't work for multiplayer. You can fix some of that problems by set-up proper replication settings for some methods of that component, but this is still not a good solution.</span><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">The other solution is to write a shader that controls the opacity of a particles. In this case, we need one particle with a special material, to simulate a flare. To check visibility of lens flare we are using information about center of a particle, that simulates a lens flare, from the DepthBuffer in a shader, and comparing it with distance between center of the particle and camera world position. If distance in the DepthBuffer is less than the distance between camera and the center of the particle than we consider, that lens flare is invisible because its was blocked by some object in front of the particle. It's pretty clear, how to get PixelDepth, CameraWordlPosition and the particle center, but doesn't obvious how to transform particle center into screen space coordinates to get a pixel depth value and this is a key.</span><br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoOum1XTfvpBY_oEsTJleWOVY_pBj03BN6h0o7LraGMOUmvaMgYBOC6Q4rFMhHcZvX8QFgZ_gx6afD7WIo-E4yvgDKnZSchTNSogz0GUkQyOyKvG9ssVryk9aTP4DQ-mMji5fLBv3iyorP/s1600/ShaderOverview.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="628" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoOum1XTfvpBY_oEsTJleWOVY_pBj03BN6h0o7LraGMOUmvaMgYBOC6Q4rFMhHcZvX8QFgZ_gx6afD7WIo-E4yvgDKnZSchTNSogz0GUkQyOyKvG9ssVryk9aTP4DQ-mMji5fLBv3iyorP/s640/ShaderOverview.PNG" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: "arial" , "helvetica" , sans-serif;">Shader Overview</span></td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUFH9e1BfiuEZGIU16kTDb7Ow530fTD0oj2HQAmZBlfJaQCTposL35Dz8e4A47BucOb3xinvqX6VUseFzi_G-k53Jj7fjIet2oHf_i6T0TFrEuaKwov-4J613l5nE3Uo6b9ZD6QFCaogfo/s1600/WorldToScreen.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="392" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUFH9e1BfiuEZGIU16kTDb7Ow530fTD0oj2HQAmZBlfJaQCTposL35Dz8e4A47BucOb3xinvqX6VUseFzi_G-k53Jj7fjIet2oHf_i6T0TFrEuaKwov-4J613l5nE3Uo6b9ZD6QFCaogfo/s640/WorldToScreen.PNG" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: "arial" , "helvetica" , sans-serif;">WorldToScreen</span></td></tr>
</tbody></table>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuf2KMHfgfgkP5VAFq2YqfTWMzgfdzRBB7weTetcBQdfa0MYbkykvTWSsjJJ5w4kdTen7MU5wG0sc8ISr2OZgjxtqPrK_zRwZ4-xBOp6OJ77UYmxGCw_CSOrqBDGsNHA77ZVZizPBXpXiR/s1600/comparing%2526scale.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="382" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuf2KMHfgfgkP5VAFq2YqfTWMzgfdzRBB7weTetcBQdfa0MYbkykvTWSsjJJ5w4kdTen7MU5wG0sc8ISr2OZgjxtqPrK_zRwZ4-xBOp6OJ77UYmxGCw_CSOrqBDGsNHA77ZVZizPBXpXiR/s640/comparing%2526scale.png" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1Mr5OBi7h11V1lKP5ykCPv6bBHKWdu8_wmZa3mwAA3kUGmZmn1o-1gtBIYtGzYx8mtwUlq1QM4OU-ZmIXuixaKyTC8GeAFs-f9ZxRHW1g7cZMlu745IVGYq7TiLCBNwlZ_8lYn44DNyVl/s1600/LensFlare.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="344" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1Mr5OBi7h11V1lKP5ykCPv6bBHKWdu8_wmZa3mwAA3kUGmZmn1o-1gtBIYtGzYx8mtwUlq1QM4OU-ZmIXuixaKyTC8GeAFs-f9ZxRHW1g7cZMlu745IVGYq7TiLCBNwlZ_8lYn44DNyVl/s640/LensFlare.PNG" width="640" /></a></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">This is the shader, that I've made. I use additive material to simulate flares. The shader have three main blocks : (from up to down) The World To Screen function at the top, the comparing block at the middle and pretty simple lens flare block at the bottom. Don't forget to Disable Depth Test in material settings.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Next, create new particle system and set-up it this way:</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCG3M8RRWn6j28JRKS_oZ1rzucS96RpATFcMpKdunDfPLHSU6toF4cq24-M0WuCscD4kdwaHO1PaNWA1Lmao7h6y3CXj1f29Ri8kvOOs7VWvf6_a3HJjJ5oXykNZI4aF8eWdlM0hRYNr2_/s1600/particleEmitter.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="380" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCG3M8RRWn6j28JRKS_oZ1rzucS96RpATFcMpKdunDfPLHSU6toF4cq24-M0WuCscD4kdwaHO1PaNWA1Lmao7h6y3CXj1f29Ri8kvOOs7VWvf6_a3HJjJ5oXykNZI4aF8eWdlM0hRYNr2_/s640/particleEmitter.png" width="640" /></a></div>
<br />
<div style="text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/EeWqQ2Pjx6w/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/EeWqQ2Pjx6w?feature=player_embedded" width="320"></iframe></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br /></div>
Anton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.com0tag:blogger.com,1999:blog-8023209643288967687.post-50719320809423948652016-04-26T05:39:00.001-07:002016-08-07T03:30:15.163-07:00Unreal Engine Blendables Blend Weigth Tutorial<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">When setting up PostProcessSettings Blend Weight doesn't affect on PostProcess material appearance by default. There is two solutions. <br /><br />The first is simply to create your own Blendable in c++ or Blueprint and implement desired functionality as its suggested by Epic (<a href="https://docs.unrealengine.com/latest/INT/Engine/Rendering/PostProcessEffects/Blendables/index.html">https://docs.unrealengine.com/latest/INT/Engine/Rendering/PostProcessEffects/Blendables/index.html</a>)<br /><br />The second is to set-up right settings in master material and material instances of PPM. I've found that Blend Weight default behaviour is performing interpolation between master and instance material parameter values. It's a key to this solution. When Developing a shader, it is necessary to pick out all parameters that changing shader appearance and set its values in master material so master material doesnt </span><br />
<a name='more'></a><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "arial" , "helvetica" , sans-serif;">affect </span>the screen. Th<span style="font-family: "arial" , "helvetica" , sans-serif;">e</span>n create a material instance and setup it as you want it looks when material is full-powered. Now its done. When setting up PostProcessSettings, use material instance and change weight value as you like.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">This is settings of Master material I<span style="font-family: "arial" , "helvetica" , sans-serif;">'<span style="font-family: "arial" , "helvetica" , sans-serif;">ve</span></span> created as example. You can see that intensity parameter is set to 0 by defaul,t so this shader doesn't affect on scene color.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitfZa0wJi392OxIhj1Q7sqdT-dZGw_ZaXI7VSOHAi9PcMbNQe8PVVuJLDxvb-7UPBvdSZU_meQQ_P7DW5Rxqdy-3ii06CGdQGCtR0IcIRQaFJ82JsgnJq8yK_cxbRrlx96xdK8TMHi5Z0G/s1600/tint+Shader.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="451" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitfZa0wJi392OxIhj1Q7sqdT-dZGw_ZaXI7VSOHAi9PcMbNQe8PVVuJLDxvb-7UPBvdSZU_meQQ_P7DW5Rxqdy-3ii06CGdQGCtR0IcIRQaFJ82JsgnJq8yK_cxbRrlx96xdK8TMHi5Z0G/s640/tint+Shader.png" width="640" />.</a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: "arial" , "helvetica" , sans-serif;">Example Tint Material</span></td><td class="tr-caption" style="text-align: center;"></td><td class="tr-caption" style="text-align: center;"></td><td class="tr-caption" style="text-align: center;"></td><td class="tr-caption" style="text-align: center;"></td></tr>
</tbody></table>
Then I created Material Instance and set intensity to 1. I set the Instance in PostProcess volume to test Blend Weight. <br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGGXRdJLzIajZrGHWUvOF_wn91ZODy7vTjqcGSO2w0-SyMIbKFTaLG4yr0fvC6qJJPAXxUB13YfACdxQwqZV0g8vPUAEyOpQIVaaMW2fnKMU7iVhLpYFyDFLMOhvQJtPg03h8bbktdYXnw/s1600/settings.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="371" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGGXRdJLzIajZrGHWUvOF_wn91ZODy7vTjqcGSO2w0-SyMIbKFTaLG4yr0fvC6qJJPAXxUB13YfACdxQwqZV0g8vPUAEyOpQIVaaMW2fnKMU7iVhLpYFyDFLMOhvQJtPg03h8bbktdYXnw/s400/settings.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: "arial" , "helvetica" , sans-serif;">Instance Settings</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglEJCKcU9Lgu3uZ4T1xBIat-7Aj-H0uZ9zPYg1fgJCfx4zo9fpdiglBme1w-nf9mVkCAk12kqatvlVlHdO5eNWewARBVNaQI674t3NQYemDQLz5nxHcCK2i9rRVVoAboDGtMD6AGniMjXS/s1600/s1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJIvIb2Kcd2ki6Ane1SSdF89La6b__dqHLnQQ8w3P95LDZN18kaoS3-m4A4vrTo3qRNjQ5CzyI19bOzhOPhUYlaTXf7chmlNENNlLkgSmEnPBiCPUUTChvC_e6nTB7uFTK89kaC2GSfIWA/s1600/s1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="174" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJIvIb2Kcd2ki6Ane1SSdF89La6b__dqHLnQQ8w3P95LDZN18kaoS3-m4A4vrTo3qRNjQ5CzyI19bOzhOPhUYlaTXf7chmlNENNlLkgSmEnPBiCPUUTChvC_e6nTB7uFTK89kaC2GSfIWA/s320/s1.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicWUNbLwSJ3KjhZ63_kbMSmNfpbLIJr5R26g6bfUfFUk7yaWJVxoJPd2WKvQv64U49DOVfi4J26yLBpQ1-PUPqewZkdiCIt4P5fu2IGWwCZeCOaHiFioJUAmnPhU3SMJcEHYVHzd-vMJ87/s1600/s2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="174" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicWUNbLwSJ3KjhZ63_kbMSmNfpbLIJr5R26g6bfUfFUk7yaWJVxoJPd2WKvQv64U49DOVfi4J26yLBpQ1-PUPqewZkdiCIt4P5fu2IGWwCZeCOaHiFioJUAmnPhU3SMJcEHYVHzd-vMJ87/s320/s2.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMxCjmu5z7PYnVlyhDynMlZaDAfqzAQIrylw2UxnRfUcDVPjfZ0M7T1VccOm2F-4ugIWzIlXwbSfFsukGoN_owwiHShZ68hjuH9itNVb4yJquEX_2RdTum0qXzsOIBu-6HZ6mC_JomuErh/s1600/s2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br /></a></div>
</td></tr>
</tbody></table>
</div>
Anton Doehttp://www.blogger.com/profile/01878514274531029039noreply@blogger.com0