<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Esenthel Forum - Graphics]]></title>
		<link>https://esenthel.com/forum/</link>
		<description><![CDATA[Esenthel Forum - https://esenthel.com/forum]]></description>
		<pubDate>Mon, 20 Apr 2026 12:25:00 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[outlines does not work with D.samples()]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=11768</link>
			<pubDate>Wed, 12 Mar 2025 04:04:52 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=11768</guid>
			<description><![CDATA[The following outlines<br />
struct Mesh : MeshLod // Mesh (array of Mesh LODs)<br />
void drawOutline         (C Color &amp;color, C MatrixM          &amp;matrix   )C;<br />
<br />
does not work with sampling<br />
<br />
struct DisplayClass : DisplayState, DisplayDraw // Display Control<br />
DisplayClass&amp; samples          (Byte             samples     );<br />
<br />
<br />
i had to keep our highest AA to SMAA]]></description>
			<content:encoded><![CDATA[The following outlines<br />
struct Mesh : MeshLod // Mesh (array of Mesh LODs)<br />
void drawOutline         (C Color &amp;color, C MatrixM          &amp;matrix   )C;<br />
<br />
does not work with sampling<br />
<br />
struct DisplayClass : DisplayState, DisplayDraw // Display Control<br />
DisplayClass&amp; samples          (Byte             samples     );<br />
<br />
<br />
i had to keep our highest AA to SMAA]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[The engine does not support FBX 2024.]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=11737</link>
			<pubDate>Thu, 24 Oct 2024 17:43:54 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=11737</guid>
			<description><![CDATA[I use 3Ds Max 2024 to model objects for my game with multiple materials, but when importing into the engine, the mesh parts are not displaying.The same thing happened when I used 3Ds Max 2021.The engine does not support the fbx 2021+ format. Please help me resolve this issue.<br /><!-- start: postbit_attachments_attachment -->
<br /><img src="images/attachtypes/image.gif" border="0" alt=".png" />&nbsp;&nbsp;<a href="attachment.php?aid=3315" target="_blank">image_2024-10-25_004537847.png</a> (Size: 220.21 KB / Downloads: 40)
<!-- end: postbit_attachments_attachment --><br /><!-- start: postbit_attachments_attachment -->
<br /><img src="images/attachtypes/image.gif" border="0" alt=".png" />&nbsp;&nbsp;<a href="attachment.php?aid=3313" target="_blank">image_2024-10-25_004254542.png</a> (Size: 132.5 KB / Downloads: 42)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[I use 3Ds Max 2024 to model objects for my game with multiple materials, but when importing into the engine, the mesh parts are not displaying.The same thing happened when I used 3Ds Max 2021.The engine does not support the fbx 2021+ format. Please help me resolve this issue.<br /><!-- start: postbit_attachments_attachment -->
<br /><img src="images/attachtypes/image.gif" border="0" alt=".png" />&nbsp;&nbsp;<a href="attachment.php?aid=3315" target="_blank">image_2024-10-25_004537847.png</a> (Size: 220.21 KB / Downloads: 40)
<!-- end: postbit_attachments_attachment --><br /><!-- start: postbit_attachments_attachment -->
<br /><img src="images/attachtypes/image.gif" border="0" alt=".png" />&nbsp;&nbsp;<a href="attachment.php?aid=3313" target="_blank">image_2024-10-25_004254542.png</a> (Size: 132.5 KB / Downloads: 42)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Issue with water material]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=11420</link>
			<pubDate>Tue, 30 May 2023 09:36:06 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=11420</guid>
			<description><![CDATA[For some reason, when I inrease reflectivity of a water material, lakes look more reflective as expected, but rivers become faded and almost change color to white. Both lakes and rivers use the same material.<br />
<br />
Here's how the material looks on a river and a lake at 0 reflectivity:<br />
<img src="https://i.imgur.com/kI7mIPq.jpg" border="0" alt="[Image: kI7mIPq.jpg]" /><br />
<br />
And here's the same river and lake at reflectivity 1<br />
<img src="https://i.imgur.com/usv7eml.jpg" border="0" alt="[Image: usv7eml.jpg]" /><br />
<br />
Does anyone know what might be the issue here?]]></description>
			<content:encoded><![CDATA[For some reason, when I inrease reflectivity of a water material, lakes look more reflective as expected, but rivers become faded and almost change color to white. Both lakes and rivers use the same material.<br />
<br />
Here's how the material looks on a river and a lake at 0 reflectivity:<br />
<img src="https://i.imgur.com/kI7mIPq.jpg" border="0" alt="[Image: kI7mIPq.jpg]" /><br />
<br />
And here's the same river and lake at reflectivity 1<br />
<img src="https://i.imgur.com/usv7eml.jpg" border="0" alt="[Image: usv7eml.jpg]" /><br />
<br />
Does anyone know what might be the issue here?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Recompiling shaders]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=11406</link>
			<pubDate>Wed, 05 Apr 2023 04:58:41 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=11406</guid>
			<description><![CDATA[Hi,<br />
<br />
i am following the instruction at <br />
<a href="https://github.com/Esenthel/EsenthelEngine/blob/main/Extra/Recompiling%20Shaders.md" target="_blank">https://github.com/Esenthel/EsenthelEngi...Shaders.md</a><br />
<br />
This is understood and done<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>open Titan Solution file Titan.sln<br />
modify the Engine/Source/Graphics/Shader Compilers.cpp file<br />
enable the "#define COMPILE_DX 1" (to compile for DirectX)<br />
and uncomment which shader files should be recompiled (such as MAIN, DEFERRED, etc.)<br />
"MAIN" includes all the basic shaders for drawing on the screen (lines, rectangles, text, ..) and other similar which are always used</code></div></div>
<br />
Here is what i do :<br />
-building the "engine" <br />
- change //DataPath(EngineDataPath); to  DataPath("../Data"); in initpre of the "Project" in the Titan solution as noted below.<br />
<br />
project then will build, but not run, and it is complaining about dxcompiler.dll<br />
can you let me know what am i doing wrong please ?<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>after making that change, running any project will compile selected shaders after 'InitPre' and before 'Init' stage<br />
shaders will be stored in the 'DataPath' folder<br />
so if using the "Project" project from Titan Solution file, 'DataPath' should be set inside 'InitPre' as: DataPath("../Data"); which will store shaders inside Data/Shader<br />
once the shaders are recompiled, don't forget to use "Engine Builder" and create the new "Engine.pak" so it can be used by the Editor</code></div></div>
]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
i am following the instruction at <br />
<a href="https://github.com/Esenthel/EsenthelEngine/blob/main/Extra/Recompiling%20Shaders.md" target="_blank">https://github.com/Esenthel/EsenthelEngi...Shaders.md</a><br />
<br />
This is understood and done<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>open Titan Solution file Titan.sln<br />
modify the Engine/Source/Graphics/Shader Compilers.cpp file<br />
enable the "#define COMPILE_DX 1" (to compile for DirectX)<br />
and uncomment which shader files should be recompiled (such as MAIN, DEFERRED, etc.)<br />
"MAIN" includes all the basic shaders for drawing on the screen (lines, rectangles, text, ..) and other similar which are always used</code></div></div>
<br />
Here is what i do :<br />
-building the "engine" <br />
- change //DataPath(EngineDataPath); to  DataPath("../Data"); in initpre of the "Project" in the Titan solution as noted below.<br />
<br />
project then will build, but not run, and it is complaining about dxcompiler.dll<br />
can you let me know what am i doing wrong please ?<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>after making that change, running any project will compile selected shaders after 'InitPre' and before 'Init' stage<br />
shaders will be stored in the 'DataPath' folder<br />
so if using the "Project" project from Titan Solution file, 'DataPath' should be set inside 'InitPre' as: DataPath("../Data"); which will store shaders inside Data/Shader<br />
once the shaders are recompiled, don't forget to use "Engine Builder" and create the new "Engine.pak" so it can be used by the Editor</code></div></div>
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[TemporalAA goes wrong when using with Render to Texture]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=11381</link>
			<pubDate>Wed, 21 Dec 2022 04:08:20 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=11381</guid>
			<description><![CDATA[When I use Render To Texture combine with D.temporalAntiAlias(true);<br />
Main render image result becomes very blurry and flickering, please see image and video below<br />
<br />
---<br />
In "15 - Render To Texture" tutorial, I added D.temporalAntiAlias(true); to Init() function  for ease of reproduce problem. This is what I got: <a href="https://i.gyazo.com/e9a84d1f2c605f6e6630ef97069d63e9.png" target="_blank">https://i.gyazo.com/e9a84d1f2c605f6e6630...9d63e9.png</a><br />
<br />
The same problem I have in my game: <a href="https://streamable.com/47lt5d" target="_blank">https://streamable.com/47lt5d</a><br />
<br />
According to the video, using TTA without Render to Texture make reflection of the lake flickering but overall image quality is fine<br />
<br />
when combine with Render to Texture (picture in picture scope), thing goes crazy.<br />
<br />
I couldn't find any way to fix this. I found D.temporalReset() and Rendere.temporal_id in manual, hope they fix problem but I have no clue on how to use these<br />
<br />
TAA is powerful but somehow glitchy, or I am missing something?]]></description>
			<content:encoded><![CDATA[When I use Render To Texture combine with D.temporalAntiAlias(true);<br />
Main render image result becomes very blurry and flickering, please see image and video below<br />
<br />
---<br />
In "15 - Render To Texture" tutorial, I added D.temporalAntiAlias(true); to Init() function  for ease of reproduce problem. This is what I got: <a href="https://i.gyazo.com/e9a84d1f2c605f6e6630ef97069d63e9.png" target="_blank">https://i.gyazo.com/e9a84d1f2c605f6e6630...9d63e9.png</a><br />
<br />
The same problem I have in my game: <a href="https://streamable.com/47lt5d" target="_blank">https://streamable.com/47lt5d</a><br />
<br />
According to the video, using TTA without Render to Texture make reflection of the lake flickering but overall image quality is fine<br />
<br />
when combine with Render to Texture (picture in picture scope), thing goes crazy.<br />
<br />
I couldn't find any way to fix this. I found D.temporalReset() and Rendere.temporal_id in manual, hope they fix problem but I have no clue on how to use these<br />
<br />
TAA is powerful but somehow glitchy, or I am missing something?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Material display error in engine [SOLVED]]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=11378</link>
			<pubDate>Fri, 16 Dec 2022 17:02:27 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=11378</guid>
			<description><![CDATA[Hi everyone ! Recently i got a material rendering error, all materials turn black when i import new mesh or create a simple material in engine but it displays normally in world environment , please tell me how to fix this ? Thank! <br />
Here is a picture of the description :<br />
Object tab: <a href="https://i.gyazo.com/76af77a081cb20c7dffec4fc0d8cb763.jpg" target="_blank">https://i.gyazo.com/76af77a081cb20c7dffe...8cb763.jpg</a><br />
World tab : <a href="https://i.gyazo.com/ab3a3a68aa17c13a31eff9238245e0a8.jpg" target="_blank">https://i.gyazo.com/ab3a3a68aa17c13a31ef...45e0a8.jpg</a><br />
Computer system and driver version :<br />
I7-6700K<br />
GTX 1060-6G<br />
32GB RAM<br />
Nvidia Driver Version: 527.56]]></description>
			<content:encoded><![CDATA[Hi everyone ! Recently i got a material rendering error, all materials turn black when i import new mesh or create a simple material in engine but it displays normally in world environment , please tell me how to fix this ? Thank! <br />
Here is a picture of the description :<br />
Object tab: <a href="https://i.gyazo.com/76af77a081cb20c7dffec4fc0d8cb763.jpg" target="_blank">https://i.gyazo.com/76af77a081cb20c7dffe...8cb763.jpg</a><br />
World tab : <a href="https://i.gyazo.com/ab3a3a68aa17c13a31eff9238245e0a8.jpg" target="_blank">https://i.gyazo.com/ab3a3a68aa17c13a31ef...45e0a8.jpg</a><br />
Computer system and driver version :<br />
I7-6700K<br />
GTX 1060-6G<br />
32GB RAM<br />
Nvidia Driver Version: 527.56]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[How set Material smoothness in code?]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=11345</link>
			<pubDate>Fri, 21 Oct 2022 18:07:16 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=11345</guid>
			<description><![CDATA[Title says it all, I think. I am using the smoothness parameter to give my players a plastic look, when combined with Reflectivity. This works in the editor.<br />
<br />
But how do I do that in code? I can use Material.reflect() to set the reflectivity, but Smoothness or something alike is not available.]]></description>
			<content:encoded><![CDATA[Title says it all, I think. I am using the smoothness parameter to give my players a plastic look, when combined with Reflectivity. This works in the editor.<br />
<br />
But how do I do that in code? I can use Material.reflect() to set the reflectivity, but Smoothness or something alike is not available.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Need help with mesh variations]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=11072</link>
			<pubDate>Wed, 19 Oct 2022 15:53:56 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=11072</guid>
			<description><![CDATA[Hey Greg, it's been a while <img src="images/smilies/grin.gif" style="vertical-align: middle;" border="0" alt="grin" title="grin" /><br />
<br />
I am trying to revive my old project now that I finally have more time. Hasn't been easy with six years of engine changes to go through. But I'm getting there.<br />
<br />
What I am stuck with is mesh variations. The idea is that every player can pick his/her own color which will be applied to the player mesh. So making the materials in advance is not an option, and the old MaterialLock does not work anymore.<br />
<br />
I understand that mesh variations are the way to go, but I cannot figure them out. I made an object to add variations to the mesh like this:<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>class charMaterials<br />
{<br />
private:<br />
&nbsp;&nbsp; Memx&lt;Material&gt; list;<br />
&nbsp;&nbsp; MeshPtr mesh;<br />
&nbsp;&nbsp; <br />
public:<br />
&nbsp;&nbsp; <br />
&nbsp;&nbsp; <br />
&nbsp;&nbsp; int addVariation(C Color &amp; color)<br />
&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(mesh == null) mesh = ObjectPtr(UID(3325270568, 1322544433, 1615607710, 3014310042))-&gt;mesh();&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Material &amp; last = list.New();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;last.reset();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;last.reflect(0.05);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;last.colorS(color);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;last.technique = MTECH_OPAQUE;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;last.validate();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mesh-&gt;variations(list.elms()+1);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;REPA(mesh-&gt;parts)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mesh-&gt;parts[i].variations(list.elms()+1);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mesh-&gt;parts[i].variation(list.elms(), &amp;last);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// this is the index for this variation<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return list.elms();<br />
&nbsp;&nbsp; }<br />
&nbsp;&nbsp; <br />
}<br />
<br />
charMaterials CharMaterials;</code></div></div>
<br />
And this will be called when the player or peer is created:<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>void setColor(Vec4 &amp;color)<br />
{<br />
&nbsp;&nbsp; color.w = 1.0;<br />
&nbsp;&nbsp; T.color = color;<br />
&nbsp;&nbsp; materialVariation = CharMaterials.addVariation(color);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
}</code></div></div>
<br />
Then, during drawprepare I set my variation and draw the mesh:<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>Virtual UInt drawPrepare()<br />
{<br />
&nbsp;&nbsp; UInt modes = super::drawPrepare();<br />
&nbsp;&nbsp; SetVariation(materialVariation); <br />
&nbsp;&nbsp; mesh-&gt;draw(); <br />
&nbsp;&nbsp; SetVariation();<br />
&nbsp;&nbsp; return modes;<br />
}</code></div></div>
<br />
... but nothing happens. The player is drawn, but always with the original material. I did quit a bit of debugging. My addVariation code is executed, the index is returned and stored in materialVariation. But no avail. Am I doing this wrong?<br />
<br />
Regards,<br />
yvan]]></description>
			<content:encoded><![CDATA[Hey Greg, it's been a while <img src="images/smilies/grin.gif" style="vertical-align: middle;" border="0" alt="grin" title="grin" /><br />
<br />
I am trying to revive my old project now that I finally have more time. Hasn't been easy with six years of engine changes to go through. But I'm getting there.<br />
<br />
What I am stuck with is mesh variations. The idea is that every player can pick his/her own color which will be applied to the player mesh. So making the materials in advance is not an option, and the old MaterialLock does not work anymore.<br />
<br />
I understand that mesh variations are the way to go, but I cannot figure them out. I made an object to add variations to the mesh like this:<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>class charMaterials<br />
{<br />
private:<br />
&nbsp;&nbsp; Memx&lt;Material&gt; list;<br />
&nbsp;&nbsp; MeshPtr mesh;<br />
&nbsp;&nbsp; <br />
public:<br />
&nbsp;&nbsp; <br />
&nbsp;&nbsp; <br />
&nbsp;&nbsp; int addVariation(C Color &amp; color)<br />
&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(mesh == null) mesh = ObjectPtr(UID(3325270568, 1322544433, 1615607710, 3014310042))-&gt;mesh();&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Material &amp; last = list.New();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;last.reset();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;last.reflect(0.05);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;last.colorS(color);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;last.technique = MTECH_OPAQUE;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;last.validate();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mesh-&gt;variations(list.elms()+1);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;REPA(mesh-&gt;parts)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mesh-&gt;parts[i].variations(list.elms()+1);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mesh-&gt;parts[i].variation(list.elms(), &amp;last);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// this is the index for this variation<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return list.elms();<br />
&nbsp;&nbsp; }<br />
&nbsp;&nbsp; <br />
}<br />
<br />
charMaterials CharMaterials;</code></div></div>
<br />
And this will be called when the player or peer is created:<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>void setColor(Vec4 &amp;color)<br />
{<br />
&nbsp;&nbsp; color.w = 1.0;<br />
&nbsp;&nbsp; T.color = color;<br />
&nbsp;&nbsp; materialVariation = CharMaterials.addVariation(color);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
}</code></div></div>
<br />
Then, during drawprepare I set my variation and draw the mesh:<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>Virtual UInt drawPrepare()<br />
{<br />
&nbsp;&nbsp; UInt modes = super::drawPrepare();<br />
&nbsp;&nbsp; SetVariation(materialVariation); <br />
&nbsp;&nbsp; mesh-&gt;draw(); <br />
&nbsp;&nbsp; SetVariation();<br />
&nbsp;&nbsp; return modes;<br />
}</code></div></div>
<br />
... but nothing happens. The player is drawn, but always with the original material. I did quit a bit of debugging. My addVariation code is executed, the index is returned and stored in materialVariation. But no avail. Am I doing this wrong?<br />
<br />
Regards,<br />
yvan]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[blending out tex of meshbase ?]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=10608</link>
			<pubDate>Wed, 20 Apr 2022 18:58:54 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=10608</guid>
			<description><![CDATA[Hi,<br />
<br />
this is close to what i am trying to achieve <a href="https://www.youtube.com/watch?v=oenJdLI2ol0" target="_blank">https://www.youtube.com/watch?v=oenJdLI2ol0</a><br />
i am far from it atm, but i am messing around with the meshbase and working on putting something together<br />
<br />
i have a weapon trail made of mesh (meshbase of vtxs and quads) using the tutorial "swing trail effect"<br />
<br />
at some point i want to fade out the trail, meaning the quads needs to blend out.<br />
<br />
i tried a few things but i couldnt figured out how to make the vtx.color working<br />
which should let me fade out the vtxs ?<br />
<br />
else is there a way without touching the material to blend it out correctly ?<br />
<br />
here is the very rough work in progress that i have been using<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>/******************************************************************************/<br />
#include "stdafx.h"<br />
/******************************************************************************/<br />
Mesh mesh;<br />
const int C_EdgesNumber = 80;<br />
Memc&lt;flt&gt; texturecoordinate;<br />
int Edge_Lastindex=0;<br />
<br />
class TrailEdge<br />
{<br />
&nbsp;&nbsp; Vtx3DSimple vtx[2];<br />
}<br />
<br />
class Trail // Swing Trail Effect<br />
{<br />
&nbsp;&nbsp; Memc&lt;TrailEdge&gt; edges&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; // container of edges<br />
&nbsp;&nbsp; int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edge_offset=0&nbsp;&nbsp; ; // index of the most recently updated edge<br />
&nbsp;&nbsp; flt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edge_time&nbsp;&nbsp;=0&nbsp;&nbsp; , // how long current edge is being updated<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; interval&nbsp;&nbsp; =0.08; // time duration for updating one edge<br />
&nbsp;&nbsp; ImagePtr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;image;<br />
<br />
&nbsp;&nbsp; void create(int edges)<br />
&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T.edges.setNumZero(edges);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;image=UID(2657528853, 1232062558, 109060020, 3126898957); // setup texture<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Edge_Lastindex=0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// prepare vertex Y texture coordinates (they will always remain the same)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;REPA(T.edges)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; T.edges[i].vtx[0].tex.y=0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; T.edges[i].vtx[1].tex.y=1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp; }<br />
<br />
&nbsp;&nbsp; void update(C Vec &amp;new_pos_start, C Vec &amp;new_pos_end)<br />
&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MaterialPtr ptr_mat = UID(2119596147, 1089744579, 936902274, 2062842600)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MaterialPtr ptr_mat2 = UID(2490987775, 1326908686, 341860011, 1625056079)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(edges.elms())<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int old_edge=edge_offset;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // remember old edge index<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edge_offset=(edge_offset+1)%edges.elms(); // increase current edge index<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge_time+=Time.d(); // increase edge time counter<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(edge_time&gt;=interval) // if&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edge has been updated for too long, then leave this edge, and start updating next edge<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge_time=0; // reset counter<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// copy texture coordinates from last edge<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edges[edge_offset].vtx[0].tex.x=edges[old_edge].vtx[0].tex.x;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edges[edge_offset].vtx[1].tex.x=edges[old_edge].vtx[1].tex.x;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // always update latest edge position and tex coords<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// position<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edges[edge_offset].vtx[0].pos=new_pos_start;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edges[edge_offset].vtx[1].pos=new_pos_end&nbsp;&nbsp;;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// tex coords<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flt tex_progress=Time.d()*0.5;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edges[edge_offset].vtx[0].tex.x+=tex_progress;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edges[edge_offset].vtx[1].tex.x+=tex_progress;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(mesh.parts.elms()&lt;C_EdgesNumber)// create a new part<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mesh.parts.New();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Edge_Lastindex = mesh.parts.elms()-1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mesh.parts.last().base.create(4, 0, 0, 1, VTX_TEX0); // create part with 4 vertexes, 1 quad, and texture coordinates (vertex positions and face vertex indexes are always created, and don't need to be specified manually) <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; texturecoordinate.New()=0.1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mesh.parts.last().material(ptr_mat);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(Random(0, 1))mesh.parts.last().material(ptr_mat);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else mesh.parts.last().material(ptr_mat2);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if(Edge_Lastindex&gt;=(C_EdgesNumber-1))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Edge_Lastindex = 0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; texturecoordinate[Edge_Lastindex]=0.1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Edge_Lastindex++; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; texturecoordinate[Edge_Lastindex]=0.1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MeshPart &amp;part=mesh.parts[Edge_Lastindex];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MeshBase &amp;base=part.base; // access software version<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.vtx.pos (0).set(edges[old_edge].vtx[1].pos.xy, edges[old_edge].vtx[1].pos.z); // set #0 vertex position<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.vtx.pos (1).set(new_pos_end.xy, new_pos_end.z); // set #1 vertex position<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.vtx.pos (2).set(new_pos_start.xy, new_pos_start.z); // set #2 vertex position<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.vtx.pos (3).set(edges[old_edge].vtx[0].pos.xy, edges[old_edge].vtx[0].pos.z); // set #3 vertex position<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.vtx.tex0(0).set(-texturecoordinate[Edge_Lastindex], texturecoordinate[Edge_Lastindex]&nbsp;&nbsp; ); // set #0 vertex texture coordinates<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.vtx.tex0(1).set( texturecoordinate[Edge_Lastindex], texturecoordinate[Edge_Lastindex]&nbsp;&nbsp; ); // set #1 vertex texture coordinates<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.vtx.tex0(2).set( texturecoordinate[Edge_Lastindex],-texturecoordinate[Edge_Lastindex]&nbsp;&nbsp; ); // set #2 vertex texture coordinates<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.vtx.tex0(3).set(-texturecoordinate[Edge_Lastindex],-texturecoordinate[Edge_Lastindex]&nbsp;&nbsp; ); // set #3 vertex texture coordinates<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.quad.ind(0).set( 0, 1, 2, 3); // set quad vertex indexes (#0 #1 #2 #3 vertexes)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;REPA(mesh.parts)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; texturecoordinate[i]+=Time.rd()/4;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MeshPart &amp;part=mesh.parts[i];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MeshBase &amp;base2=part.base; // access software version<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; base2.vtx.tex0(0).set(-texturecoordinate[i], texturecoordinate[i]&nbsp;&nbsp; ); // set #0 vertex texture coordinates<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; base2.vtx.tex0(1).set( texturecoordinate[i], texturecoordinate[i]&nbsp;&nbsp; ); // set #1 vertex texture coordinates<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; base2.vtx.tex0(2).set( texturecoordinate[i],-texturecoordinate[i]&nbsp;&nbsp; ); // set #2 vertex texture coordinates<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; base2.vtx.tex0(3).set(-texturecoordinate[i],-texturecoordinate[i]&nbsp;&nbsp; ); // set #3 vertex texture coordinates<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mesh.setNormals(); // set automatic vertex normals<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mesh.setAutoTanBin(); // calculate tangents and binormals if needed<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mesh.setRender&nbsp;&nbsp;&nbsp;&nbsp;(); // set rendering versions from software versions<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mesh.setBox&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (); // recalculate bounding box from vertexes<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // always update all edge colors<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; flt alpha=1, alpha_step=1.0/flt(edges.elms()-2); // start from most recent edge, and set its alpha to full<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FREPA(edges)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp; index=Mod(edge_offset-i, edges.elms());<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Color color=ColorAlpha(Color(255, 120, 0, 128), alpha);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edges[index].vtx[0].color=color;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edges[index].vtx[1].color=color;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(i==0)alpha-=alpha_step*(edge_time/interval); // first step is not full, because the edge is only partially long<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;&nbsp;&nbsp;&nbsp;alpha-=alpha_step;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp; }<br />
<br />
&nbsp;&nbsp; void draw() // this will be called only in RM_BLEND mode<br />
&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SetMatrix(); // set identity matrix<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// before drawing custom graphics in RM_BLEND using 'VI' we need to set alpha blending mode in order to avoid accidental glow effect<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;D.alpha(ALPHA_RENDER_BLEND);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// use Vertex Index Buffer for custom drawing<br />
&nbsp;&nbsp;&nbsp;&nbsp;//VI.shader(..); setup custom shader if needed<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;image().noise(Random(0, 255), Random(0, 255), Random(0, 255), 250);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VI.image(image()); // set image<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VI.wrap (); // set wrap texture addressing mode<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;REP(edges.elms()-1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // get indexes of neighbour edges<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int next=Mod(edge_offset-i&nbsp;&nbsp;, edges.elms()),<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prev=Mod(edge_offset-i-1, edges.elms());<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // draw quad face from 4 points<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VI.face(edges[prev].vtx[1],<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edges[prev].vtx[0],<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edges[next].vtx[0],<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edges[next].vtx[1]);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VI.end();<br />
&nbsp;&nbsp; }<br />
}<br />
/******************************************************************************/<br />
MeshPtr weapon;<br />
Matrix&nbsp;&nbsp;weapon_matrix;<br />
Trail&nbsp;&nbsp; trail;<br />
/******************************************************************************/<br />
void InitPre()<br />
{<br />
&nbsp;&nbsp; INIT();<br />
&nbsp;&nbsp; D.viewRange(15);<br />
}<br />
/******************************************************************************/<br />
Bool Init()<br />
{<br />
&nbsp;&nbsp; // camera<br />
&nbsp;&nbsp; Cam.dist=3;<br />
&nbsp;&nbsp; Cam.yaw=PI;<br />
&nbsp;&nbsp; Cam.pitch=-0.4;<br />
&nbsp;&nbsp; Cam.setSpherical().set();<br />
<br />
&nbsp;&nbsp; // sun<br />
&nbsp;&nbsp; Sun.image=UID(1275694243, 1199742097, 1108828586, 1055787228);<br />
&nbsp;&nbsp; Sun.pos&nbsp;&nbsp;=!Vec(1, 1, 3);<br />
&nbsp;&nbsp; Sun.light_color_l=1-D.ambientColorL();<br />
<br />
&nbsp;&nbsp; // sky<br />
&nbsp;&nbsp; Sky.atmospheric();<br />
<br />
&nbsp;&nbsp; // weapon<br />
&nbsp;&nbsp; weapon=ObjectPtr(UID(3865949516, 1110691029, 816879537, 746462228))-&gt;mesh();<br />
<br />
&nbsp;&nbsp; // trail effect<br />
&nbsp;&nbsp; trail.create(C_EdgesNumber);<br />
<br />
&nbsp;&nbsp; return true;<br />
}<br />
/******************************************************************************/<br />
void Shut()<br />
{<br />
}<br />
/******************************************************************************/<br />
Bool Update()<br />
{<br />
&nbsp;&nbsp; if(Kb.bp(KB_ESC))return false;<br />
&nbsp;&nbsp; Gui.update();<br />
<br />
&nbsp;&nbsp; // update weapon motion<br />
&nbsp;&nbsp; weapon_matrix.setPosUp(Vec(0, 0, 0.5), Vec(0, 0, 1))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.rotateY (Time.time()*4)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.move&nbsp;&nbsp;&nbsp;&nbsp;(Vec(0, 0.3, 1.2));<br />
<br />
&nbsp;&nbsp; // update trail effect<br />
&nbsp;&nbsp; trail.update(weapon-&gt;ext.down()*weapon_matrix,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;weapon-&gt;ext.up&nbsp;&nbsp;()*weapon_matrix);<br />
<br />
&nbsp;&nbsp; // camera<br />
&nbsp;&nbsp; Cam.transformByMouse(0.01, 10, CAMH_ZOOM|CAMH_ROT);<br />
<br />
&nbsp;&nbsp; return true;<br />
}<br />
/******************************************************************************/<br />
void Render()<br />
{<br />
&nbsp;&nbsp; switch(Renderer())<br />
&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case RM_PREPARE:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; weapon-&gt;draw(weapon_matrix);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*LinkShaderParamChanges(changes); mesh.draw(..);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UnlinkShaderParamChanges(changes); */<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mesh.draw(MatrixIdentity);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}break;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case RM_OUTLINE:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mesh.drawOutline(BLACK, MatrixIdentity);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case RM_BLEND:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //trail.draw();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}break;<br />
&nbsp;&nbsp; }<br />
}<br />
void Draw()<br />
{<br />
&nbsp;&nbsp; <br />
&nbsp;&nbsp; Renderer(Render);<br />
&nbsp;&nbsp; D.text(0, D.h()-0.1, S+Time.fps()+"//mesh elms: "+mesh.parts.elms());<br />
}<br />
/******************************************************************************/</code></div></div>
<br />
thanks ! <img src="images/smilies/smile.gif" style="vertical-align: middle;" border="0" alt="smile" title="smile" />]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
this is close to what i am trying to achieve <a href="https://www.youtube.com/watch?v=oenJdLI2ol0" target="_blank">https://www.youtube.com/watch?v=oenJdLI2ol0</a><br />
i am far from it atm, but i am messing around with the meshbase and working on putting something together<br />
<br />
i have a weapon trail made of mesh (meshbase of vtxs and quads) using the tutorial "swing trail effect"<br />
<br />
at some point i want to fade out the trail, meaning the quads needs to blend out.<br />
<br />
i tried a few things but i couldnt figured out how to make the vtx.color working<br />
which should let me fade out the vtxs ?<br />
<br />
else is there a way without touching the material to blend it out correctly ?<br />
<br />
here is the very rough work in progress that i have been using<br />
<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>/******************************************************************************/<br />
#include "stdafx.h"<br />
/******************************************************************************/<br />
Mesh mesh;<br />
const int C_EdgesNumber = 80;<br />
Memc&lt;flt&gt; texturecoordinate;<br />
int Edge_Lastindex=0;<br />
<br />
class TrailEdge<br />
{<br />
&nbsp;&nbsp; Vtx3DSimple vtx[2];<br />
}<br />
<br />
class Trail // Swing Trail Effect<br />
{<br />
&nbsp;&nbsp; Memc&lt;TrailEdge&gt; edges&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; // container of edges<br />
&nbsp;&nbsp; int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edge_offset=0&nbsp;&nbsp; ; // index of the most recently updated edge<br />
&nbsp;&nbsp; flt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edge_time&nbsp;&nbsp;=0&nbsp;&nbsp; , // how long current edge is being updated<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; interval&nbsp;&nbsp; =0.08; // time duration for updating one edge<br />
&nbsp;&nbsp; ImagePtr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;image;<br />
<br />
&nbsp;&nbsp; void create(int edges)<br />
&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T.edges.setNumZero(edges);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;image=UID(2657528853, 1232062558, 109060020, 3126898957); // setup texture<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Edge_Lastindex=0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// prepare vertex Y texture coordinates (they will always remain the same)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;REPA(T.edges)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; T.edges[i].vtx[0].tex.y=0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; T.edges[i].vtx[1].tex.y=1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp; }<br />
<br />
&nbsp;&nbsp; void update(C Vec &amp;new_pos_start, C Vec &amp;new_pos_end)<br />
&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MaterialPtr ptr_mat = UID(2119596147, 1089744579, 936902274, 2062842600)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MaterialPtr ptr_mat2 = UID(2490987775, 1326908686, 341860011, 1625056079)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(edges.elms())<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int old_edge=edge_offset;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // remember old edge index<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edge_offset=(edge_offset+1)%edges.elms(); // increase current edge index<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge_time+=Time.d(); // increase edge time counter<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(edge_time&gt;=interval) // if&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edge has been updated for too long, then leave this edge, and start updating next edge<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge_time=0; // reset counter<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// copy texture coordinates from last edge<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edges[edge_offset].vtx[0].tex.x=edges[old_edge].vtx[0].tex.x;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edges[edge_offset].vtx[1].tex.x=edges[old_edge].vtx[1].tex.x;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // always update latest edge position and tex coords<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// position<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edges[edge_offset].vtx[0].pos=new_pos_start;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edges[edge_offset].vtx[1].pos=new_pos_end&nbsp;&nbsp;;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// tex coords<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flt tex_progress=Time.d()*0.5;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edges[edge_offset].vtx[0].tex.x+=tex_progress;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edges[edge_offset].vtx[1].tex.x+=tex_progress;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(mesh.parts.elms()&lt;C_EdgesNumber)// create a new part<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mesh.parts.New();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Edge_Lastindex = mesh.parts.elms()-1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mesh.parts.last().base.create(4, 0, 0, 1, VTX_TEX0); // create part with 4 vertexes, 1 quad, and texture coordinates (vertex positions and face vertex indexes are always created, and don't need to be specified manually) <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; texturecoordinate.New()=0.1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mesh.parts.last().material(ptr_mat);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(Random(0, 1))mesh.parts.last().material(ptr_mat);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else mesh.parts.last().material(ptr_mat2);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if(Edge_Lastindex&gt;=(C_EdgesNumber-1))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Edge_Lastindex = 0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; texturecoordinate[Edge_Lastindex]=0.1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Edge_Lastindex++; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; texturecoordinate[Edge_Lastindex]=0.1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MeshPart &amp;part=mesh.parts[Edge_Lastindex];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MeshBase &amp;base=part.base; // access software version<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.vtx.pos (0).set(edges[old_edge].vtx[1].pos.xy, edges[old_edge].vtx[1].pos.z); // set #0 vertex position<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.vtx.pos (1).set(new_pos_end.xy, new_pos_end.z); // set #1 vertex position<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.vtx.pos (2).set(new_pos_start.xy, new_pos_start.z); // set #2 vertex position<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.vtx.pos (3).set(edges[old_edge].vtx[0].pos.xy, edges[old_edge].vtx[0].pos.z); // set #3 vertex position<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.vtx.tex0(0).set(-texturecoordinate[Edge_Lastindex], texturecoordinate[Edge_Lastindex]&nbsp;&nbsp; ); // set #0 vertex texture coordinates<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.vtx.tex0(1).set( texturecoordinate[Edge_Lastindex], texturecoordinate[Edge_Lastindex]&nbsp;&nbsp; ); // set #1 vertex texture coordinates<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.vtx.tex0(2).set( texturecoordinate[Edge_Lastindex],-texturecoordinate[Edge_Lastindex]&nbsp;&nbsp; ); // set #2 vertex texture coordinates<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.vtx.tex0(3).set(-texturecoordinate[Edge_Lastindex],-texturecoordinate[Edge_Lastindex]&nbsp;&nbsp; ); // set #3 vertex texture coordinates<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.quad.ind(0).set( 0, 1, 2, 3); // set quad vertex indexes (#0 #1 #2 #3 vertexes)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;REPA(mesh.parts)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; texturecoordinate[i]+=Time.rd()/4;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MeshPart &amp;part=mesh.parts[i];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MeshBase &amp;base2=part.base; // access software version<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; base2.vtx.tex0(0).set(-texturecoordinate[i], texturecoordinate[i]&nbsp;&nbsp; ); // set #0 vertex texture coordinates<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; base2.vtx.tex0(1).set( texturecoordinate[i], texturecoordinate[i]&nbsp;&nbsp; ); // set #1 vertex texture coordinates<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; base2.vtx.tex0(2).set( texturecoordinate[i],-texturecoordinate[i]&nbsp;&nbsp; ); // set #2 vertex texture coordinates<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; base2.vtx.tex0(3).set(-texturecoordinate[i],-texturecoordinate[i]&nbsp;&nbsp; ); // set #3 vertex texture coordinates<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mesh.setNormals(); // set automatic vertex normals<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mesh.setAutoTanBin(); // calculate tangents and binormals if needed<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mesh.setRender&nbsp;&nbsp;&nbsp;&nbsp;(); // set rendering versions from software versions<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mesh.setBox&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (); // recalculate bounding box from vertexes<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // always update all edge colors<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; flt alpha=1, alpha_step=1.0/flt(edges.elms()-2); // start from most recent edge, and set its alpha to full<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FREPA(edges)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp; index=Mod(edge_offset-i, edges.elms());<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Color color=ColorAlpha(Color(255, 120, 0, 128), alpha);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edges[index].vtx[0].color=color;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edges[index].vtx[1].color=color;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(i==0)alpha-=alpha_step*(edge_time/interval); // first step is not full, because the edge is only partially long<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;&nbsp;&nbsp;&nbsp;alpha-=alpha_step;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp; }<br />
<br />
&nbsp;&nbsp; void draw() // this will be called only in RM_BLEND mode<br />
&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SetMatrix(); // set identity matrix<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// before drawing custom graphics in RM_BLEND using 'VI' we need to set alpha blending mode in order to avoid accidental glow effect<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;D.alpha(ALPHA_RENDER_BLEND);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// use Vertex Index Buffer for custom drawing<br />
&nbsp;&nbsp;&nbsp;&nbsp;//VI.shader(..); setup custom shader if needed<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;image().noise(Random(0, 255), Random(0, 255), Random(0, 255), 250);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VI.image(image()); // set image<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VI.wrap (); // set wrap texture addressing mode<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;REP(edges.elms()-1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // get indexes of neighbour edges<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int next=Mod(edge_offset-i&nbsp;&nbsp;, edges.elms()),<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prev=Mod(edge_offset-i-1, edges.elms());<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // draw quad face from 4 points<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VI.face(edges[prev].vtx[1],<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edges[prev].vtx[0],<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edges[next].vtx[0],<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edges[next].vtx[1]);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VI.end();<br />
&nbsp;&nbsp; }<br />
}<br />
/******************************************************************************/<br />
MeshPtr weapon;<br />
Matrix&nbsp;&nbsp;weapon_matrix;<br />
Trail&nbsp;&nbsp; trail;<br />
/******************************************************************************/<br />
void InitPre()<br />
{<br />
&nbsp;&nbsp; INIT();<br />
&nbsp;&nbsp; D.viewRange(15);<br />
}<br />
/******************************************************************************/<br />
Bool Init()<br />
{<br />
&nbsp;&nbsp; // camera<br />
&nbsp;&nbsp; Cam.dist=3;<br />
&nbsp;&nbsp; Cam.yaw=PI;<br />
&nbsp;&nbsp; Cam.pitch=-0.4;<br />
&nbsp;&nbsp; Cam.setSpherical().set();<br />
<br />
&nbsp;&nbsp; // sun<br />
&nbsp;&nbsp; Sun.image=UID(1275694243, 1199742097, 1108828586, 1055787228);<br />
&nbsp;&nbsp; Sun.pos&nbsp;&nbsp;=!Vec(1, 1, 3);<br />
&nbsp;&nbsp; Sun.light_color_l=1-D.ambientColorL();<br />
<br />
&nbsp;&nbsp; // sky<br />
&nbsp;&nbsp; Sky.atmospheric();<br />
<br />
&nbsp;&nbsp; // weapon<br />
&nbsp;&nbsp; weapon=ObjectPtr(UID(3865949516, 1110691029, 816879537, 746462228))-&gt;mesh();<br />
<br />
&nbsp;&nbsp; // trail effect<br />
&nbsp;&nbsp; trail.create(C_EdgesNumber);<br />
<br />
&nbsp;&nbsp; return true;<br />
}<br />
/******************************************************************************/<br />
void Shut()<br />
{<br />
}<br />
/******************************************************************************/<br />
Bool Update()<br />
{<br />
&nbsp;&nbsp; if(Kb.bp(KB_ESC))return false;<br />
&nbsp;&nbsp; Gui.update();<br />
<br />
&nbsp;&nbsp; // update weapon motion<br />
&nbsp;&nbsp; weapon_matrix.setPosUp(Vec(0, 0, 0.5), Vec(0, 0, 1))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.rotateY (Time.time()*4)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.move&nbsp;&nbsp;&nbsp;&nbsp;(Vec(0, 0.3, 1.2));<br />
<br />
&nbsp;&nbsp; // update trail effect<br />
&nbsp;&nbsp; trail.update(weapon-&gt;ext.down()*weapon_matrix,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;weapon-&gt;ext.up&nbsp;&nbsp;()*weapon_matrix);<br />
<br />
&nbsp;&nbsp; // camera<br />
&nbsp;&nbsp; Cam.transformByMouse(0.01, 10, CAMH_ZOOM|CAMH_ROT);<br />
<br />
&nbsp;&nbsp; return true;<br />
}<br />
/******************************************************************************/<br />
void Render()<br />
{<br />
&nbsp;&nbsp; switch(Renderer())<br />
&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case RM_PREPARE:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; weapon-&gt;draw(weapon_matrix);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*LinkShaderParamChanges(changes); mesh.draw(..);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UnlinkShaderParamChanges(changes); */<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mesh.draw(MatrixIdentity);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}break;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case RM_OUTLINE:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mesh.drawOutline(BLACK, MatrixIdentity);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case RM_BLEND:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //trail.draw();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}break;<br />
&nbsp;&nbsp; }<br />
}<br />
void Draw()<br />
{<br />
&nbsp;&nbsp; <br />
&nbsp;&nbsp; Renderer(Render);<br />
&nbsp;&nbsp; D.text(0, D.h()-0.1, S+Time.fps()+"//mesh elms: "+mesh.parts.elms());<br />
}<br />
/******************************************************************************/</code></div></div>
<br />
thanks ! <img src="images/smilies/smile.gif" style="vertical-align: middle;" border="0" alt="smile" title="smile" />]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Vegetation and direct lighting]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=10550</link>
			<pubDate>Sun, 16 Jan 2022 23:13:07 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=10550</guid>
			<description><![CDATA[I have the K4 Vegetation Pack from the store and have noticed that when importing the grass model fbx files the models remain unlit as far as direct lighting is concerned, in other words the lighting remains constant all around the models regardless of the angle of the Sun.  <br />
<br />
I suspect that due to them comprising just a few angled planes this is maybe to avoid odd lighting effects if the planes responded to direct lighting, but my question is ... how is this accomplished?  It doesn't appear to be related to the shader in use or any particular material setting so I'm guessing its inherent in the model itself.<br />
<br />
Not being a modeller I have no direct knowledge but I assume its something to do with the normals, as if I import it into a modelling app and export without the smoothing groups then the imported model now responds to the direct lighting.<br />
<br />
Just something I'd like to understand, if someone would be kind enough to explain, as it seems a useful technique to make use of at times.]]></description>
			<content:encoded><![CDATA[I have the K4 Vegetation Pack from the store and have noticed that when importing the grass model fbx files the models remain unlit as far as direct lighting is concerned, in other words the lighting remains constant all around the models regardless of the angle of the Sun.  <br />
<br />
I suspect that due to them comprising just a few angled planes this is maybe to avoid odd lighting effects if the planes responded to direct lighting, but my question is ... how is this accomplished?  It doesn't appear to be related to the shader in use or any particular material setting so I'm guessing its inherent in the model itself.<br />
<br />
Not being a modeller I have no direct knowledge but I assume its something to do with the normals, as if I import it into a modelling app and export without the smoothing groups then the imported model now responds to the direct lighting.<br />
<br />
Just something I'd like to understand, if someone would be kind enough to explain, as it seems a useful technique to make use of at times.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Depth Of Field and litColRTPrecision problem]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=10530</link>
			<pubDate>Wed, 08 Dec 2021 21:11:03 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=10530</guid>
			<description><![CDATA[After applying litColRTPrecision(IMAGE_PRECISION_[Above 8]), there is a render problem when using Depth of Field effect<br />
<br />
<a href="https://streamable.com/or6r7d" target="_blank">https://streamable.com/or6r7d</a>]]></description>
			<content:encoded><![CDATA[After applying litColRTPrecision(IMAGE_PRECISION_[Above 8]), there is a render problem when using Depth of Field effect<br />
<br />
<a href="https://streamable.com/or6r7d" target="_blank">https://streamable.com/or6r7d</a>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Trying to create night environment but it looks so wrong]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=10523</link>
			<pubDate>Sun, 05 Dec 2021 08:44:59 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=10523</guid>
			<description><![CDATA[At daylight setting for environment, everything goes well. But when I try to create a night environment. I realized problem of material render without light<br />
<br />
I turn off Sun and Ambient in Environment setting. Expect getting a pit black map because there is no light at all, but look at all material, they are shining<br />
<br />
<img src="https://i.gyazo.com/036f93fec821c57c8ce315c525a48a4c.png" border="0" alt="[Image: 036f93fec821c57c8ce315c525a48a4c.png]" /><br />
<br />
It is worse if material has high Smoothness and Refectivity value. setting both of them to 0 does not help. Reducing Normal value can make material look much "dark" but it affects material quality on "day light".<br />
<br />
After reduce all above 3 values to 0, the ground material still look shiny at far range.<br />
Anyway, I cant reduce every material because it make my game's material broken<br />
<br />
<img src="https://i.gyazo.com/88da78c8cd05d0dfd8c15d8a07d205fc.png" border="0" alt="[Image: 88da78c8cd05d0dfd8c15d8a07d205fc.png]" /><br />
<img src="https://i.gyazo.com/d15597aa05711252bec4419abed0bdb3.png" border="0" alt="[Image: d15597aa05711252bec4419abed0bdb3.png]" /><br />
<br />
How can I create a real night ? how to solve the shiny material problem<br />
btw, why does the cloud look so ugly, and many partical effect is broken at night time]]></description>
			<content:encoded><![CDATA[At daylight setting for environment, everything goes well. But when I try to create a night environment. I realized problem of material render without light<br />
<br />
I turn off Sun and Ambient in Environment setting. Expect getting a pit black map because there is no light at all, but look at all material, they are shining<br />
<br />
<img src="https://i.gyazo.com/036f93fec821c57c8ce315c525a48a4c.png" border="0" alt="[Image: 036f93fec821c57c8ce315c525a48a4c.png]" /><br />
<br />
It is worse if material has high Smoothness and Refectivity value. setting both of them to 0 does not help. Reducing Normal value can make material look much "dark" but it affects material quality on "day light".<br />
<br />
After reduce all above 3 values to 0, the ground material still look shiny at far range.<br />
Anyway, I cant reduce every material because it make my game's material broken<br />
<br />
<img src="https://i.gyazo.com/88da78c8cd05d0dfd8c15d8a07d205fc.png" border="0" alt="[Image: 88da78c8cd05d0dfd8c15d8a07d205fc.png]" /><br />
<img src="https://i.gyazo.com/d15597aa05711252bec4419abed0bdb3.png" border="0" alt="[Image: d15597aa05711252bec4419abed0bdb3.png]" /><br />
<br />
How can I create a real night ? how to solve the shiny material problem<br />
btw, why does the cloud look so ugly, and many partical effect is broken at night time]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Texture position on plane]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=10494</link>
			<pubDate>Mon, 11 Oct 2021 13:40:12 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=10494</guid>
			<description><![CDATA[As locking large images takes a lot of time I started to search for some optimizations.<br />
<br />
The best solution would be just to split image into parts. <br />
And here's the problem:<br />
There is always visible line between parts, very visible if edge area is not too colorful.<br />
It looks to me like few pixels from the right side are displayed on the very left.<br />
Boxes look like every sides texture just start on previous side. <br />
Creating plane or two triangles changes nothing.<br />
<br />
Is this something that can be overcome?<br /><!-- start: postbit_attachments_attachment -->
<br /><img src="images/attachtypes/image.gif" border="0" alt=".png" />&nbsp;&nbsp;<a href="attachment.php?aid=3235" target="_blank">11.png</a> (Size: 277.76 KB / Downloads: 46)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[As locking large images takes a lot of time I started to search for some optimizations.<br />
<br />
The best solution would be just to split image into parts. <br />
And here's the problem:<br />
There is always visible line between parts, very visible if edge area is not too colorful.<br />
It looks to me like few pixels from the right side are displayed on the very left.<br />
Boxes look like every sides texture just start on previous side. <br />
Creating plane or two triangles changes nothing.<br />
<br />
Is this something that can be overcome?<br /><!-- start: postbit_attachments_attachment -->
<br /><img src="images/attachtypes/image.gif" border="0" alt=".png" />&nbsp;&nbsp;<a href="attachment.php?aid=3235" target="_blank">11.png</a> (Size: 277.76 KB / Downloads: 46)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[D.motionMode(MOTION_CAMERA_OBJECT) give me this]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=10489</link>
			<pubDate>Sat, 02 Oct 2021 17:59:39 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=10489</guid>
			<description><![CDATA[My mouse stays still<br />
<br />
<img src="https://i.gyazo.com/32271e0293fe843dcc67b78d3c1f41b4.png" border="0" alt="[Image: 32271e0293fe843dcc67b78d3c1f41b4.png]" />]]></description>
			<content:encoded><![CDATA[My mouse stays still<br />
<br />
<img src="https://i.gyazo.com/32271e0293fe843dcc67b78d3c1f41b4.png" border="0" alt="[Image: 32271e0293fe843dcc67b78d3c1f41b4.png]" />]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Detail Mask - Masked Detail Texture]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=10478</link>
			<pubDate>Fri, 17 Sep 2021 22:49:14 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=10478</guid>
			<description><![CDATA[Is it possible to somehow blend between the detail texture-set and the basic texture-set,<br />
so that the Detail-map only shows up at specific masked places?<br />
(Something like a blend map / blend mask)<br />
<br />
I see that this isn't possible within the material editor<br />
but maybe I overlooked something in code?<br />
<br />
<br />
I am basically looking for a way to do something like this but with EE's detail texture.<br />
(This example is from Stride. But Unigine and others have similar<br />
approaches to this with blend-masking Texture-Sets, not blend-mapping 2 completely different<br />
materials, which is the better approach IMO):<br />
<!-- start: postbit_attachments_attachment -->
<br /><img src="images/attachtypes/image.gif" border="0" alt=".png" />&nbsp;&nbsp;<a href="attachment.php?aid=3231" target="_blank">Capture2.PNG</a> (Size: 131.69 KB / Downloads: 26)
<!-- end: postbit_attachments_attachment --><br />
<br />
<br />
<br />
Otherwise maybe an option to use the alpha texture  (or even the macro texture)  for detail-masking would be a pretty cool and easy option some day?]]></description>
			<content:encoded><![CDATA[Is it possible to somehow blend between the detail texture-set and the basic texture-set,<br />
so that the Detail-map only shows up at specific masked places?<br />
(Something like a blend map / blend mask)<br />
<br />
I see that this isn't possible within the material editor<br />
but maybe I overlooked something in code?<br />
<br />
<br />
I am basically looking for a way to do something like this but with EE's detail texture.<br />
(This example is from Stride. But Unigine and others have similar<br />
approaches to this with blend-masking Texture-Sets, not blend-mapping 2 completely different<br />
materials, which is the better approach IMO):<br />
<!-- start: postbit_attachments_attachment -->
<br /><img src="images/attachtypes/image.gif" border="0" alt=".png" />&nbsp;&nbsp;<a href="attachment.php?aid=3231" target="_blank">Capture2.PNG</a> (Size: 131.69 KB / Downloads: 26)
<!-- end: postbit_attachments_attachment --><br />
<br />
<br />
<br />
Otherwise maybe an option to use the alpha texture  (or even the macro texture)  for detail-masking would be a pretty cool and easy option some day?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[underneath water not rendering properly]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=10475</link>
			<pubDate>Fri, 10 Sep 2021 03:37:54 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=10475</guid>
			<description><![CDATA[Hi,<br />
<br />
please see the image below for under water render<br />
<a href="https://gyazo.com/13a9571e44f7974d564a06a78310456f" target="_blank">https://gyazo.com/13a9571e44f7974d564a06a78310456f</a><br />
<br />
top of water works fine<br />
<a href="https://gyazo.com/4b50d964b1a15f02a63ddb60be4615a4" target="_blank">https://gyazo.com/4b50d964b1a15f02a63ddb60be4615a4</a><br />
<br />
No rush, i dont personally use that<br />
thanks <img src="images/smilies/smile.gif" style="vertical-align: middle;" border="0" alt="smile" title="smile" />]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
please see the image below for under water render<br />
<a href="https://gyazo.com/13a9571e44f7974d564a06a78310456f" target="_blank">https://gyazo.com/13a9571e44f7974d564a06a78310456f</a><br />
<br />
top of water works fine<br />
<a href="https://gyazo.com/4b50d964b1a15f02a63ddb60be4615a4" target="_blank">https://gyazo.com/4b50d964b1a15f02a63ddb60be4615a4</a><br />
<br />
No rush, i dont personally use that<br />
thanks <img src="images/smilies/smile.gif" style="vertical-align: middle;" border="0" alt="smile" title="smile" />]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Texture Lighting Flickering Issue...]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=10465</link>
			<pubDate>Fri, 03 Sep 2021 23:39:59 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=10465</guid>
			<description><![CDATA[Hey there,<br />
<br />
got some strange, not really flickering, but kinda, when I rotate the camera.<br />
Take a look here:<br />
<br />
<a href="https://streamable.com/udyzdd" target="_blank">https://streamable.com/udyzdd</a><br />
<br />
or dropbox:<br />
<a href="https://www.dropbox.com/s/v52p106tzf9zl4z/Flickering.zip?dl=0" target="_blank">https://www.dropbox.com/s/v52p106tzf9zl4...g.zip?dl=0</a><br />
<br />
<br />
Any idea what might cause this?<br />
<br />
(I have this quite often when rotating, no matter in which project.<br />
Also, textures tend to skip to lighter/darker depending on the angle...)]]></description>
			<content:encoded><![CDATA[Hey there,<br />
<br />
got some strange, not really flickering, but kinda, when I rotate the camera.<br />
Take a look here:<br />
<br />
<a href="https://streamable.com/udyzdd" target="_blank">https://streamable.com/udyzdd</a><br />
<br />
or dropbox:<br />
<a href="https://www.dropbox.com/s/v52p106tzf9zl4z/Flickering.zip?dl=0" target="_blank">https://www.dropbox.com/s/v52p106tzf9zl4...g.zip?dl=0</a><br />
<br />
<br />
Any idea what might cause this?<br />
<br />
(I have this quite often when rotating, no matter in which project.<br />
Also, textures tend to skip to lighter/darker depending on the angle...)]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[SOLVED] Enviroment Map / Cubemap --> No IBL?]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=10461</link>
			<pubDate>Sun, 29 Aug 2021 05:57:02 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=10461</guid>
			<description><![CDATA[I imported some cubemaps that I use in another engine <br />
into a new image set to Environment Map on my travel laptop (Win 10)<br />
 to see how they might change the scene lighting in Esenthel. <br />
<br />
To my surprise they didn't change anything on the Mesh materials. At all.<br />
<br />
Did I miss something here? Usually PBR is IBL based, so different skyboxes<br />
tend to have quite the impact on the scene. Do I have to do something in addition<br />
to what I already did?<br />
<br />
<br />
According to the docs:<br />
<blockquote><cite>Quote:</cite>Environment - Same as "Cube Texture" except its mip-maps will be blurred in a special way, allowing it to be used as Environment Map for PBR</blockquote>
<br />
Sounds like it should, no? So I am not sure what went wrong here.<br />
<br />
(Maybe multi-channel PRB maps are needed for this to work?<br />
Can't test this until tomorrow though...)]]></description>
			<content:encoded><![CDATA[I imported some cubemaps that I use in another engine <br />
into a new image set to Environment Map on my travel laptop (Win 10)<br />
 to see how they might change the scene lighting in Esenthel. <br />
<br />
To my surprise they didn't change anything on the Mesh materials. At all.<br />
<br />
Did I miss something here? Usually PBR is IBL based, so different skyboxes<br />
tend to have quite the impact on the scene. Do I have to do something in addition<br />
to what I already did?<br />
<br />
<br />
According to the docs:<br />
<blockquote><cite>Quote:</cite>Environment - Same as "Cube Texture" except its mip-maps will be blurred in a special way, allowing it to be used as Environment Map for PBR</blockquote>
<br />
Sounds like it should, no? So I am not sure what went wrong here.<br />
<br />
(Maybe multi-channel PRB maps are needed for this to work?<br />
Can't test this until tomorrow though...)]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[DirectX Device lost]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=10451</link>
			<pubDate>Mon, 23 Aug 2021 10:42:26 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=10451</guid>
			<description><![CDATA[since the last update i keep getting errors.<br />
<br />
<img src="https://i.ibb.co/jyyShh5/Error.png" border="0" alt="[Image: Error.png]" /><br />
<br />
<a href="https://ibb.co/488HWWf" target="_blank">https://ibb.co/488HWWf</a><br />
<br />
what can that be?]]></description>
			<content:encoded><![CDATA[since the last update i keep getting errors.<br />
<br />
<img src="https://i.ibb.co/jyyShh5/Error.png" border="0" alt="[Image: Error.png]" /><br />
<br />
<a href="https://ibb.co/488HWWf" target="_blank">https://ibb.co/488HWWf</a><br />
<br />
what can that be?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Shadow glitches...]]></title>
			<link>https://esenthel.com/forum/showthread.php?tid=10445</link>
			<pubDate>Sat, 21 Aug 2021 18:39:38 +0000</pubDate>
			<guid isPermaLink="false">https://esenthel.com/forum/showthread.php?tid=10445</guid>
			<description><![CDATA[Hey there,<br />
<br />
I have some strange shadow glitches.<br />
<br />
I've made a .gif where you can get a better idea what I am talking about.<br />
<br />
I tested this on OSX-&gt;AMD and Win10-&gt; Nvidia , same thing.<br />
<br />
Any idea what that might be?<br />
<br />
Thanks,<br />
tL.<br />
<br />
<!-- start: postbit_attachments_attachment -->
<br /><img src="images/attachtypes/image.gif" border="0" alt=".gif" />&nbsp;&nbsp;<a href="attachment.php?aid=3225" target="_blank">ezgif.com-gif-maker.gif</a> (Size: 343.11 KB / Downloads: 75)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[Hey there,<br />
<br />
I have some strange shadow glitches.<br />
<br />
I've made a .gif where you can get a better idea what I am talking about.<br />
<br />
I tested this on OSX-&gt;AMD and Win10-&gt; Nvidia , same thing.<br />
<br />
Any idea what that might be?<br />
<br />
Thanks,<br />
tL.<br />
<br />
<!-- start: postbit_attachments_attachment -->
<br /><img src="images/attachtypes/image.gif" border="0" alt=".gif" />&nbsp;&nbsp;<a href="attachment.php?aid=3225" target="_blank">ezgif.com-gif-maker.gif</a> (Size: 343.11 KB / Downloads: 75)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
	</channel>
</rss>