<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Unity &#8211; Gary Michael Angelone Jr.</title>
	<atom:link href="https://garyangelonejr.me/tag/unity-it/feed/" rel="self" type="application/rss+xml" />
	<link>https://garyangelonejr.me</link>
	<description></description>
	<lastBuildDate>Wed, 12 Nov 2025 19:33:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Toon Grass Auto-Blending</title>
		<link>https://garyangelonejr.me/toon-grass-auto-blending/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 14 Aug 2023 14:17:40 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Unity]]></category>
		<guid isPermaLink="false">http://localhost/?p=40</guid>

					<description><![CDATA[Something that bothers me about grass are the hard edges at the roots. I'd seen some pigmentation solutions which were tedious, so I created a shader that can blend the grass with the terrain automatically.]]></description>
										<content:encoded><![CDATA[<div class="fusion-fullwidth fullwidth-box fusion-builder-row-1 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling" style="--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-flex-wrap:wrap;"><div class="fusion-builder-row fusion-row fusion-flex-align-items-flex-start fusion-flex-content-wrap" style="max-width:1248px;margin-left: calc(-4% / 2 );margin-right: calc(-4% / 2 );"><div class="fusion-layout-column fusion_builder_column fusion-builder-column-0 fusion_builder_column_1_1 1_1 fusion-flex-column" style="--awb-bg-size:cover;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:1.92%;--awb-margin-bottom-large:0px;--awb-spacing-left-large:1.92%;--awb-width-medium:100%;--awb-spacing-right-medium:1.92%;--awb-spacing-left-medium:1.92%;--awb-width-small:100%;--awb-spacing-right-small:1.92%;--awb-spacing-left-small:1.92%;"><div class="fusion-column-wrapper fusion-flex-justify-content-flex-start fusion-content-layout-column"><div class="fusion-text fusion-text-1 translate lang-en "><p>Something that bothers me about grass are the hard edges at the roots. I'd seen some pigmentation solutions which were tedious, so I created a shader that can blend the grass with the terrain automatically. The cel shading look of my project meant it would be a litle more complicated than usual. I opted for <a href="https://amplify.pt/unity/amplify-shader-editor/">Amplify Shader Editor</a> to speed up the process.</p>
</div><div class="fusion-text fusion-text-2 translate lang-de"><p>Was mich an Gras stört, sind die harten Kanten an den Wurzeln. Ich hatte einige Pigmentierungslösungen gesehen, die sehr mühsam waren, also habe ich einen Shader entwickelt, der das Gras automatisch mit dem Gelände verschmelzen kann. Durch den Cel-Shading-Look meines Projekts war das etwas komplizierter als sonst. Ich habe mich für den <a href="https://amplify.pt/unity/amplify-shader-editor/">Amplify Shader Editor</a> entschieden, um den Prozess zu beschleunigen.</p>
</div><div class="fusion-text fusion-text-3 translate lang-it"><p>Una cosa che mi dà fastidio dell'erba sono i bordi netti alle radici. Avevo visto alcune soluzioni di pigmentazione piuttosto noiose, quindi ho creato uno shader in grado di fondere automaticamente l'erba con il terreno. Lo stile cel shading del mio progetto rendeva il tutto un po' più complicato del solito. Ho optato per <a href="https://amplify.pt/unity/amplify-shader-editor/">Amplify Shader Editor</a> per velocizzare il processo.</p>
</div><div class="fusion-image-element " style="--awb-margin-bottom:3em;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);"><span class=" fusion-imageframe imageframe-none imageframe-1 hover-type-none" style="border:2px solid var(--awb-color2);border-radius:1em;"><a href="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_001.webp" class="fusion-lightbox" data-rel="iLightbox[aef233de65e7f644c14]" data-title="Screenshot_BlendedGrass_001" title="Screenshot_BlendedGrass_001"><img fetchpriority="high" decoding="async" width="1016" height="399" src="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_001.webp" alt class="img-responsive wp-image-3273" srcset="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_001-200x79.webp 200w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_001-300x118.webp 300w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_001-400x157.webp 400w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_001-512x201.webp 512w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_001-600x236.webp 600w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_001-768x302.webp 768w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_001-800x314.webp 800w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_001.webp 1016w" sizes="(max-width: 640px) 100vw, 1016px"></a></span></div><div class="fusion-text fusion-text-4 translate lang-en "><p>Both the terrain and the grass needed to use the same lighting, using a toon ramp.</p>
</div><div class="fusion-text fusion-text-5 translate lang-de"><p>Sowohl das Gelände als auch das Gras mussten mit derselben Beleuchtung versehen werden, wobei eine Toon-Rampe zum Einsatz kam.</p>
</div><div class="fusion-text fusion-text-6 translate lang-it"><p>Sia il terreno che l'erba dovevano utilizzare la stessa illuminazione, utilizzando una rampa toon.</p>
</div><div class="fusion-image-element " style="--awb-margin-bottom:3em;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);"><span class=" fusion-imageframe imageframe-none imageframe-2 hover-type-none" style="border:2px solid var(--awb-color2);border-radius:1em;"><a href="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_004-1024x254.webp" class="fusion-lightbox" data-rel="iLightbox[0620cdf9c01acffc7e4]" data-title="Screenshot_BlendedGrass_004" title="Screenshot_BlendedGrass_004"><img decoding="async" width="1024" height="254" src="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_004-1024x254.webp" alt class="img-responsive wp-image-3276" srcset="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_004-200x50.webp 200w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_004-300x74.webp 300w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_004-400x99.webp 400w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_004-512x127.webp 512w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_004-600x149.webp 600w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_004-768x191.webp 768w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_004-800x198.webp 800w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_004-1024x254.webp 1024w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_004.webp 1048w" sizes="(max-width: 640px) 100vw, 1024px"></a></span></div><div class="fusion-text fusion-text-7 translate lang-en "><p>To grab the terrain colormap, I went straight to the terrain data and stitched the splat maps.</p>
</div><div class="fusion-text fusion-text-8 translate lang-de"><p>Um die Terrain-Farbkarte zu erhalten, habe ich mich direkt an die Terrain-Daten gemacht und die Splat-Karten zusammengefügt.</p>
</div><div class="fusion-text fusion-text-9 translate lang-it"><p>Per ottenere la mappa dei colori del terreno, sono andato direttamente ai dati del terreno e ho unito le mappe splat.</p>
</div><div class="fusion-image-element " style="--awb-margin-bottom:3em;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);"><span class=" fusion-imageframe imageframe-none imageframe-3 hover-type-none" style="border:2px solid var(--awb-color2);border-radius:1em;"><a href="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_005-1024x752.webp" class="fusion-lightbox" data-rel="iLightbox[5c642e48b9f3f535427]" data-title="Screenshot_BlendedGrass_005" title="Screenshot_BlendedGrass_005"><img decoding="async" width="1024" height="752" src="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_005-1024x752.webp" alt class="img-responsive wp-image-3277" srcset="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_005-200x147.webp 200w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_005-300x220.webp 300w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_005-400x294.webp 400w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_005-512x376.webp 512w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_005-600x441.webp 600w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_005-768x564.webp 768w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_005-800x588.webp 800w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_005-1024x752.webp 1024w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_005.webp 1092w" sizes="(max-width: 640px) 100vw, 1024px"></a></span></div><style type="text/css" scopped="scopped">.fusion-syntax-highlighter-1 > .CodeMirror, .fusion-syntax-highlighter-1 > .CodeMirror .CodeMirror-gutters {background-color:transparent;}.fusion-syntax-highlighter-1 > .CodeMirror .CodeMirror-gutters { background-color: transparent; }.fusion-syntax-highlighter-1 > .CodeMirror .CodeMirror-linenumber { color: var(--awb-color3); }</style><div class="fusion-syntax-highlighter-container fusion-syntax-highlighter-1 fusion-syntax-highlighter-theme-light no-translate" style="opacity:0;margin-top:0px;margin-right:0px;margin-bottom:2em;margin-left:0px;font-size:14px;border-width:2px;border-style:dashed;border-color:var(--awb-color2);"><div class="syntax-highlighter-copy-code"><span class="syntax-highlighter-copy-code-title" data-id="fusion_syntax_highlighter_1" style="font-size:14px;">Copy to Clipboard</span></div><label for="fusion_syntax_highlighter_1" class="screen-reader-text">Syntax Highlighter</label><textarea class="fusion-syntax-highlighter-textarea" id="fusion_syntax_highlighter_1" data-readonly="nocursor" data-linenumbers="1" data-linewrapping="1" data-theme="default" data-mode="text/x-sh">public void ReconstructSplats(){
  if(terrains==null||terrains.Length==0||terrainBounds==null){return;}

  Bounds b=terrainBounds;
  if(b.size.x==0||b.size.y==0){return;}

  float ratio = (1/b.size.x)*(resolution);

  int tw=(int)(b.size.x*ratio); int th=(int)(b.size.z*ratio);

  if(splat1 != null){ splat1.Release(); splat1.width = tw; splat1.height = th; }
  if(splat2 != null){ splat2.Release(); splat2.width = tw; splat2.height = th; }

  for(int t=0;t<terrains.length if texture2d s1="CornTools.GetSplatTexture(terrains[t]," s2="CornTools.GetSplatTexture(terrains[t]," bounds bb="terrains[t].terrainData.bounds;" float r="ratio;" int left="(int)(b.center.x" b.extents.x top="(int)(b.center.z" b.extents.z width="(int)(bb.size.x);" height="(int)(bb.size.z);" x="(int)(terrains[t].transform.position.x);" y="(int)(terrains[t].transform.position.z);" sx="0;" sy="0;" dx="(int)(x-left);" dy="(int)(y-top);" splat1 splat2 for t="0;t&lt;terrains.Length;t++){" terrainlayer layers="terrains[t].terrainData.terrainLayers;" tex0="null;" tex1="null;" tex2="null;" tex3="null;" tex4="null;" tex5="null;" tex6="null;" tex7="null;">0&amp;&amp;layers[0]!=null&amp;&amp;layers[0].diffuseTexture!=null){tex0=layers[0].diffuseTexture;}
      if(layers.Length&gt;1&amp;&amp;layers[1]!=null&amp;&amp;layers[1].diffuseTexture!=null){tex1=layers[1].diffuseTexture;}
      if(layers.Length&gt;2&amp;&amp;layers[2]!=null&amp;&amp;layers[2].diffuseTexture!=null){tex2=layers[2].diffuseTexture;}
      if(layers.Length&gt;3&amp;&amp;layers[3]!=null&amp;&amp;layers[3].diffuseTexture!=null){tex3=layers[3].diffuseTexture;}

      if(layers.Length&gt;4&amp;&amp;layers[4]!=null&amp;&amp;layers[4].diffuseTexture!=null){tex4=layers[4].diffuseTexture;}
      if(layers.Length&gt;5&amp;&amp;layers[5]!=null&amp;&amp;layers[5].diffuseTexture!=null){tex5=layers[5].diffuseTexture;}
    if(layers.Length&gt;6&amp;&amp;layers[6]!=null&amp;&amp;layers[6].diffuseTexture!=null){tex6=layers[6].diffuseTexture;}
      if(layers.Length&gt;7&amp;&amp;layers[7]!=null&amp;&amp;layers[7].diffuseTexture!=null){tex7=layers[7].diffuseTexture;}

      if(grassMaterials!=null){
          for(int m=0;m<grassmaterials.count if tex0 tex1 tex2 tex3 tex4 tex5 tex6 tex7 splat1 splat2></grassmaterials.count></terrains.length></textarea></div><div class="fusion-text fusion-text-10 translate lang-en "><p>The terrain coordinates had to match the shader.</p>
</div><div class="fusion-text fusion-text-11 translate lang-de"><p>Die Geländekoordinaten mussten mit dem Shader übereinstimmen.</p>
</div><div class="fusion-text fusion-text-12 translate lang-it"><p>Le coordinate del terreno dovevano corrispondere allo shader.</p>
</div><div class="fusion-image-element " style="--awb-margin-bottom:3em;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);"><span class=" fusion-imageframe imageframe-none imageframe-4 hover-type-none" style="border:2px solid var(--awb-color2);border-radius:1em;"><a href="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_003-1024x482.webp" class="fusion-lightbox" data-rel="iLightbox[b7023248bd506aed9b2]" data-title="Screenshot_BlendedGrass_003" title="Screenshot_BlendedGrass_003"><img decoding="async" width="1024" height="482" src="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_003-1024x482.webp" alt class="img-responsive wp-image-3275" srcset="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_003-200x94.webp 200w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_003-300x141.webp 300w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_003-400x188.webp 400w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_003-512x241.webp 512w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_003-600x283.webp 600w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_003-768x362.webp 768w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_003-800x377.webp 800w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_003-1024x482.webp 1024w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_003-1200x565.webp 1200w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_003.webp 1312w" sizes="(max-width: 640px) 100vw, 1200px"></a></span></div><style type="text/css" scopped="scopped">.fusion-syntax-highlighter-2 > .CodeMirror, .fusion-syntax-highlighter-2 > .CodeMirror .CodeMirror-gutters {background-color:transparent;}.fusion-syntax-highlighter-2 > .CodeMirror .CodeMirror-gutters { background-color: transparent; }.fusion-syntax-highlighter-2 > .CodeMirror .CodeMirror-linenumber { color: var(--awb-color3); }</style><div class="fusion-syntax-highlighter-container fusion-syntax-highlighter-2 fusion-syntax-highlighter-theme-light no-translate" style="opacity:0;margin-top:0px;margin-right:0px;margin-bottom:2em;margin-left:0px;font-size:14px;border-width:2px;border-style:dashed;border-color:var(--awb-color2);"><div class="syntax-highlighter-copy-code"><span class="syntax-highlighter-copy-code-title" data-id="fusion_syntax_highlighter_2" style="font-size:14px;">Copy to Clipboard</span></div><label for="fusion_syntax_highlighter_2" class="screen-reader-text">Syntax Highlighter</label><textarea class="fusion-syntax-highlighter-textarea" id="fusion_syntax_highlighter_2" data-readonly="nocursor" data-linenumbers="1" data-linewrapping="1" data-theme="default" data-mode="text/x-sh">private Vector3 terrainPosition;
public bool CheckTerrainChange(){
	...
    bool changed=false; string reason="";
    if(terrains.Length&gt;0&amp;&amp;transform.hasChanged)
    {
        for(int t=0;t<terrains.length if reason terrain position changed="true;" terrainposition="transform.position;" ... return></terrains.length></textarea></div><div class="fusion-text fusion-text-13 translate lang-en "><p>Since I am using custom lighting, it was necessary to capture the normals of the terrain.</p>
</div><div class="fusion-text fusion-text-14 translate lang-de"><p>Da ich benutzerdefinierte Beleuchtung verwende, war es notwendig, die Normalen des Geländes zu erfassen.</p>
</div><div class="fusion-text fusion-text-15 translate lang-it"><p>Poiché sto utilizzando un'illuminazione personalizzata, è stato necessario acquisire le normali del terreno.</p>
</div><div class="fusion-image-element " style="--awb-margin-bottom:3em;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);"><span class=" fusion-imageframe imageframe-none imageframe-5 hover-type-none" style="border:2px solid var(--awb-color2);border-radius:1em;"><a href="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_002.webp" class="fusion-lightbox" data-rel="iLightbox[a9166a261f4f539d729]" data-title="Screenshot_BlendedGrass_002" title="Screenshot_BlendedGrass_002"><img decoding="async" width="901" height="518" src="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_002.webp" alt class="img-responsive wp-image-3274" srcset="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_002-200x115.webp 200w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_002-300x172.webp 300w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_002-400x230.webp 400w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_002-512x294.webp 512w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_002-600x345.webp 600w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_002-768x442.webp 768w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_002-800x460.webp 800w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_002.webp 901w" sizes="(max-width: 640px) 100vw, 901px"></a></span></div><style type="text/css" scopped="scopped">.fusion-syntax-highlighter-3 > .CodeMirror, .fusion-syntax-highlighter-3 > .CodeMirror .CodeMirror-gutters {background-color:transparent;}.fusion-syntax-highlighter-3 > .CodeMirror .CodeMirror-gutters { background-color: transparent; }.fusion-syntax-highlighter-3 > .CodeMirror .CodeMirror-linenumber { color: var(--awb-color3); }</style><div class="fusion-syntax-highlighter-container fusion-syntax-highlighter-3 fusion-syntax-highlighter-theme-light no-translate" style="opacity:0;margin-top:0px;margin-right:0px;margin-bottom:2em;margin-left:0px;font-size:14px;border-width:2px;border-style:dashed;border-color:var(--awb-color2);"><div class="syntax-highlighter-copy-code"><span class="syntax-highlighter-copy-code-title" data-id="fusion_syntax_highlighter_3" style="font-size:14px;">Copy to Clipboard</span></div><label for="fusion_syntax_highlighter_3" class="screen-reader-text">Syntax Highlighter</label><textarea class="fusion-syntax-highlighter-textarea" id="fusion_syntax_highlighter_3" data-readonly="nocursor" data-linenumbers="1" data-linewrapping="1" data-theme="default" data-mode="text/x-sh">public void UpdateCam(){
    if(captureCam==null||terrainBounds==null){return;}

    Vector3 size=terrainBounds.extents;
    Vector3 pos=terrainBounds.center-(terrainBounds.extents/2);
    Vector3 center=new Vector3(pos.x+size.x/2,pos.y+size.y/2,pos.z+size.z/2);
    Vector3 center_bottom=new Vector3(pos.x+size.x/2,pos.y-size.y,pos.z+size.z/2);
    Vector3 center_top=new Vector3(pos.x+size.x/2,pos.y+(size.y/2),pos.z+size.z/2);

    captureCam.clearFlags=CameraClearFlags.Nothing;
    captureCam.depthTextureMode = DepthTextureMode.None;
    captureCam.cullingMask = (1 &lt;&lt; ColormapLayer);
    captureCam.orthographic = true;
    captureCam.targetTexture = colormap;
    captureCam.allowHDR = false;
    captureCam.allowHDR = false;
    captureCam.allowMSAA = false;

    captureCam.transform.position=center+(Vector3.up*(size.y*3));
    captureCam.useOcclusionCulling = true;

    if(captureCam.orthographic==true){
        captureCam.aspect = size.x / size.z;
        captureCam.orthographicSize = size.z;
    }else{
        captureCam.fieldOfView=60;
    }
}

public void RenderGo(int mode){
    captureCam.enabled=true;
    UpdateCam();
	
    ...
  
        if(material.HasProperty("_CaptureMode")){
            material.SetInt("_CaptureMode",1);
            if(captureCam.targetTexture!=normalmap){
                captureCam.targetTexture=normalmap;
            }
            captureCam.Render();
        }

     ...

    captureCam.enabled=false;
}</textarea></div><div class="fusion-image-element " style="--awb-margin-bottom:3em;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);"><span class=" fusion-imageframe imageframe-none imageframe-6 hover-type-none" style="border:2px solid var(--awb-color2);border-radius:1em;"><a href="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_MapPlane-1024x512.gif" class="fusion-lightbox" data-rel="iLightbox[d01f1120c0b39103b28]" data-title="Screenshot_BlendedGrass_MapPlane" title="Screenshot_BlendedGrass_MapPlane"><img decoding="async" width="1024" height="512" src="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_MapPlane-1024x512.gif" alt class="img-responsive wp-image-3278" srcset="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_MapPlane-200x100.gif 200w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_MapPlane-400x200.gif 400w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_MapPlane-600x300.gif 600w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_MapPlane-800x400.gif 800w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_BlendedGrass_MapPlane-1200x600.gif 1200w" sizes="(max-width: 640px) 100vw, 1200px"></a></span></div><div class="fusion-text fusion-text-16 translate lang-en "><p>To sync up the terrain and grass materials, I checked on update, if the main material's CRC had changed.</p>
</div><div class="fusion-text fusion-text-17 translate lang-de"><p>Um die Gelände- und Grasmaterialien zu synchronisieren, habe ich bei der Aktualisierung überprüft, ob sich der CRC-Wert des Hauptmaterials geändert hat.</p>
</div><div class="fusion-text fusion-text-18 translate lang-it"><p>Per sincronizzare i materiali del terreno e dell'erba, ho verificato l'aggiornamento, se il CRC del materiale principale era cambiato.</p>
</div><style type="text/css" scopped="scopped">.fusion-syntax-highlighter-4 > .CodeMirror, .fusion-syntax-highlighter-4 > .CodeMirror .CodeMirror-gutters {background-color:transparent;}.fusion-syntax-highlighter-4 > .CodeMirror .CodeMirror-gutters { background-color: transparent; }.fusion-syntax-highlighter-4 > .CodeMirror .CodeMirror-linenumber { color: var(--awb-color3); }</style><div class="fusion-syntax-highlighter-container fusion-syntax-highlighter-4 fusion-syntax-highlighter-theme-light no-translate" style="opacity:0;margin-top:0px;margin-right:0px;margin-bottom:2em;margin-left:0px;font-size:14px;border-width:2px;border-style:dashed;border-color:var(--awb-color2);"><div class="syntax-highlighter-copy-code"><span class="syntax-highlighter-copy-code-title" data-id="fusion_syntax_highlighter_4" style="font-size:14px;">Copy to Clipboard</span></div><label for="fusion_syntax_highlighter_4" class="screen-reader-text">Syntax Highlighter</label><textarea class="fusion-syntax-highlighter-textarea" id="fusion_syntax_highlighter_4" data-readonly="nocursor" data-linenumbers="1" data-linewrapping="1" data-theme="default" data-mode="text/x-sh">public void SyncMaterials(){
    if(terrains==null||terrains.Length==0||terrains[0]==null){return;}

    terrainMaterial=terrains[0].materialTemplate;

    if(terrainMaterial.HasProperty("_BaseColor")){TerrainBaseColor=terrainMaterial.GetColor("_BaseColor");}
    if(terrainMaterial.HasProperty("_HighlightColor")){TerrainHighlightColor=terrainMaterial.GetColor("_HighlightColor");}
    if(terrainMaterial.HasProperty("_ShadowColor")){TerrainShadowColor=terrainMaterial.GetColor("_ShadowColor");}
    if(terrainMaterial.HasProperty("_Threshold")){TerrainThreshold=terrainMaterial.GetFloat("_Threshold");}
    if(terrainMaterial.HasProperty("_Smoothing")){TerrainSmoothing=terrainMaterial.GetFloat("_Smoothing");}

    material.SetColor("BaseColor",TerrainBaseColor);
    material.SetColor("HighlightColor",TerrainHighlightColor);
    material.SetColor("ShadowColor",TerrainShadowColor);

    material.SetFloat("Threshold",TerrainThreshold);
    material.SetFloat("Smoothing",TerrainSmoothing);

    if(terrainBounds!=null){Offset=terrainBounds.center+(terrainBounds.extents);}
    if(terrainBounds!=null){MapSize=terrainBounds.extents;}
    if(captureCam!=null){CamSize=captureCam.orthographicSize;}

    if(grassMaterials!=null){
            for(int m=0;m<grassmaterials.count grassmaterials offset mapsize camsize if refreshrenderer></grassmaterials.count></textarea></div></div></div><div class="fusion-layout-column fusion_builder_column fusion-builder-column-1 fusion_builder_column_1_1 1_1 fusion-flex-column hidden" style="--awb-padding-top:3em;--awb-padding-bottom:6em;--awb-bg-size:cover;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:3.072%;--awb-margin-bottom-large:0px;--awb-spacing-left-large:1.92%;--awb-width-medium:100%;--awb-order-medium:0;--awb-spacing-right-medium:3.072%;--awb-spacing-left-medium:1.92%;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:1.92%;--awb-spacing-left-small:1.92%;"><div class="fusion-column-wrapper fusion-column-has-shadow fusion-flex-justify-content-flex-start fusion-content-layout-column"><div style="text-align:center;"><a class="fusion-button button-flat fusion-button-default-size button-default fusion-button-default button-1 fusion-button-default-span fusion-button-default-type fusion-animated translate lang-en " data-animationtype="flipiny" data-animationduration="0.3" data-animationoffset="top-into-view" target="_self" href="/data/Toon%20Grass%20Auto-Blending.zip"><i class="fa-arrow-circle-down fas awb-button__icon awb-button__icon--default button-icon-left" aria-hidden="true"></i><span class="fusion-button-text awb-button__text awb-button__text--default">Download Project</span></a></div><div style="text-align:center;"><a class="fusion-button button-flat fusion-button-default-size button-default fusion-button-default button-2 fusion-button-default-span fusion-button-default-type fusion-animated translate lang-de" data-animationtype="flipiny" data-animationduration="0.3" data-animationoffset="top-into-view" target="_self" href="/data/Toon%20Grass%20Auto-Blending.zip"><i class="fa-arrow-circle-down fas awb-button__icon awb-button__icon--default button-icon-left" aria-hidden="true"></i><span class="fusion-button-text awb-button__text awb-button__text--default">Projekt herunterladen</span></a></div></div></div></div></div>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Character Creator</title>
		<link>https://garyangelonejr.me/character-creator/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 06 Aug 2023 12:19:48 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Unity]]></category>
		<guid isPermaLink="false">http://localhost/?p=175</guid>

					<description><![CDATA[A toon character creator, using Blender blendshapes. (WIP)]]></description>
										<content:encoded><![CDATA[<div class="fusion-fullwidth fullwidth-box fusion-builder-row-2 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling" style="--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-flex-wrap:wrap;" ><div class="fusion-builder-row fusion-row fusion-flex-align-items-flex-start fusion-flex-content-wrap" style="max-width:1248px;margin-left: calc(-4% / 2 );margin-right: calc(-4% / 2 );"><div class="fusion-layout-column fusion_builder_column fusion-builder-column-2 fusion_builder_column_1_1 1_1 fusion-flex-column" style="--awb-bg-size:cover;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:1.92%;--awb-margin-bottom-large:0px;--awb-spacing-left-large:1.92%;--awb-width-medium:100%;--awb-spacing-right-medium:1.92%;--awb-spacing-left-medium:1.92%;--awb-width-small:100%;--awb-spacing-right-small:1.92%;--awb-spacing-left-small:1.92%;"><div class="fusion-column-wrapper fusion-flex-justify-content-flex-start fusion-content-layout-column"><div class="fusion-text fusion-text-19 translate lang-en "><p>A toon character creator, using <a href="https://www.blender.org/">Blender</a> blendshapes. (WIP)</p>
</div><div class="fusion-text fusion-text-20 translate lang-de"><p>Ein Toon-Charakter-Ersteller, der <a href="https://www.blender.org/">Blender</a> verwendet. (In Arbeit)</p>
</div><div class="fusion-text fusion-text-21 translate lang-it"><p>Un creatore di personaggi animati che utilizza i blendshape di <a href="https://www.blender.org/">Blender</a>. (In fase di sviluppo)</p>
</div><div class="fusion-video fusion-selfhosted-video bordered" style="max-width:100%;"><div class="video-wrapper"><video playsinline="true" width="100%" style="object-fit: cover;" autoplay="true" muted="true" loop="true" preload="auto"><source src="/vid/post/CharacterMaker.mp4" type="video/mp4">Sorry, your browser doesn&#039;t support embedded videos.</video></div></div></div></div></div></div>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Mesh Clouds</title>
		<link>https://garyangelonejr.me/mesh-clouds/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 03 Aug 2023 15:08:01 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Unity]]></category>
		<guid isPermaLink="false">http://localhost/?p=49</guid>

					<description><![CDATA[A mesh cloud renderer. (WIP)]]></description>
										<content:encoded><![CDATA[<div class="fusion-fullwidth fullwidth-box fusion-builder-row-3 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling" style="--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-flex-wrap:wrap;" ><div class="fusion-builder-row fusion-row fusion-flex-align-items-flex-start fusion-flex-content-wrap" style="max-width:1248px;margin-left: calc(-4% / 2 );margin-right: calc(-4% / 2 );"><div class="fusion-layout-column fusion_builder_column fusion-builder-column-3 fusion_builder_column_1_1 1_1 fusion-flex-column" style="--awb-bg-size:cover;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:1.92%;--awb-margin-bottom-large:0px;--awb-spacing-left-large:1.92%;--awb-width-medium:100%;--awb-spacing-right-medium:1.92%;--awb-spacing-left-medium:1.92%;--awb-width-small:100%;--awb-spacing-right-small:1.92%;--awb-spacing-left-small:1.92%;"><div class="fusion-column-wrapper fusion-flex-justify-content-flex-start fusion-content-layout-column"><div class="fusion-text fusion-text-22 translate lang-en "><p>A mesh cloud renderer. (WIP)</p>
</div><div class="fusion-text fusion-text-23 translate lang-de"><p>Ein Mesh-Cloud-Renderer. (In Entwicklung)</p>
</div><div class="fusion-text fusion-text-24 translate lang-it"><p>Un renderizzatore cloud mesh. (In fase di sviluppo)</p>
</div><div class="fusion-video fusion-selfhosted-video bordered" style="max-width:100%;"><div class="video-wrapper"><video playsinline="true" width="100%" style="object-fit: cover;" autoplay="true" muted="true" loop="true" preload="auto"><source src="/vid/post/Mesh-Clouds.mp4" type="video/mp4">Sorry, your browser doesn&#039;t support embedded videos.</video></div></div></div></div></div></div>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>2.5D Physics</title>
		<link>https://garyangelonejr.me/2-5d-physics/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 02 Aug 2023 16:21:47 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Unity]]></category>
		<guid isPermaLink="false">http://localhost/?p=1</guid>

					<description><![CDATA[For a new project, I wanted to go with a 2.5d solution. Unfortunately, for optimization, Unity does not allow the rotation of terrains and mesh-based terrains wouldn't be ideal. In order to allow for exciting background scenery, while keeping the illusion of a 2D game, movement along a spline would be important.]]></description>
										<content:encoded><![CDATA[<div class="fusion-fullwidth fullwidth-box fusion-builder-row-4 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling" style="--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-flex-wrap:wrap;"><div class="fusion-builder-row fusion-row fusion-flex-align-items-flex-start fusion-flex-content-wrap" style="max-width:1248px;margin-left: calc(-4% / 2 );margin-right: calc(-4% / 2 );"><div class="fusion-layout-column fusion_builder_column fusion-builder-column-4 fusion_builder_column_1_1 1_1 fusion-flex-column" style="--awb-bg-size:cover;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:1.92%;--awb-margin-bottom-large:0px;--awb-spacing-left-large:1.92%;--awb-width-medium:100%;--awb-spacing-right-medium:1.92%;--awb-spacing-left-medium:1.92%;--awb-width-small:100%;--awb-spacing-right-small:1.92%;--awb-spacing-left-small:1.92%;"><div class="fusion-column-wrapper fusion-flex-justify-content-flex-start fusion-content-layout-column"><div class="fusion-text fusion-text-25 translate lang-en "><p>For a new project, I wanted to go with a 2.5d solution. Unfortunately, for optimization, Unity does not allow the rotation of terrains and mesh-based terrains wouldn't be ideal. In order to allow for exciting background scenery, while keeping the illusion of a 2D game, movement along a spline would be important.</p>
</div><div class="fusion-text fusion-text-26 translate lang-de"><p>Für ein neues Projekt wollte ich eine 2,5D-Lösung verwenden. Leider erlaubt Unity aus Optimierungsgründen keine Drehung von Terrains, und meshbasierte Terrains wären nicht ideal. Um spannende Hintergrundlandschaften zu ermöglichen und gleichzeitig die Illusion eines 2D-Spiels zu bewahren, wäre eine Bewegung entlang einer Spline wichtig.</p>
</div><div class="fusion-text fusion-text-27 translate lang-it"><p>Per un nuovo progetto, volevo optare per una soluzione 2.5D. Purtroppo, per motivi di ottimizzazione, Unity non consente la rotazione dei terreni e i terreni basati su mesh non sarebbero l'ideale. Per ottenere uno scenario di sfondo emozionante, pur mantenendo l'illusione di un gioco 2D, sarebbe importante il movimento lungo una spline.</p>
</div><div class="fusion-text fusion-text-28 translate lang-en "><p>For the splines, I started with <a href="https://github.com/bansheeGz/BGCurve">BansheeGz/BGCurve</a>.</p>
</div><div class="fusion-text fusion-text-29 translate lang-de"><p>Für die Splines habe ich mit <a href="https://github.com/bansheeGz/BGCurve">BansheeGz/BGCurve</a> begonnen.</p>
</div><div class="fusion-text fusion-text-30 translate lang-it "><p>Per le spline, ho iniziato con <a href="https://github.com/bansheeGz/BGCurve">BansheeGz/BGCurve</a>.</p>
</div><div class="fusion-image-element " style="--awb-margin-bottom:3em;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);"><span class=" fusion-imageframe imageframe-none imageframe-7 hover-type-none" style="border:2px solid var(--awb-color3);border-radius:1em;"><img decoding="async" width="1024" height="451" title="Screenshot_25D_Physics_001" src="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_25D_Physics_001-1024x451.jpg" alt class="img-responsive wp-image-3279" srcset="https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_25D_Physics_001-200x88.jpg 200w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_25D_Physics_001-400x176.jpg 400w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_25D_Physics_001-600x264.jpg 600w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_25D_Physics_001-800x352.jpg 800w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_25D_Physics_001-1200x529.jpg 1200w, https://garyangelonejr.me/wp-content/uploads/2025/08/Screenshot_25D_Physics_001.jpg 1305w" sizes="(max-width: 640px) 100vw, 1200px"></span></div><div class="fusion-text fusion-text-31 translate lang-en "><p>The core function is to have the object always looking forward, by calculating the tangent of the closest point.</p>
</div><div class="fusion-text fusion-text-32 translate lang-de"><p>Die Kernfunktion besteht darin, das Objekt immer nach vorne schauen zu lassen, indem die Tangente des nächstgelegenen Punktes berechnet wird.</p>
</div><div class="fusion-text fusion-text-33 translate lang-it"><p>La funzione principale è quella di mantenere l'oggetto sempre rivolto in avanti, calcolando la tangente del punto più vicino.</p>
</div><style type="text/css" scopped="scopped">.fusion-syntax-highlighter-5 > .CodeMirror, .fusion-syntax-highlighter-5 > .CodeMirror .CodeMirror-gutters {background-color:transparent;}.fusion-syntax-highlighter-5 > .CodeMirror .CodeMirror-gutters { background-color: transparent; }.fusion-syntax-highlighter-5 > .CodeMirror .CodeMirror-linenumber { color: var(--awb-color3); }</style><div class="fusion-syntax-highlighter-container fusion-syntax-highlighter-5 fusion-syntax-highlighter-theme-light no-translate" style="opacity:0;margin-top:0px;margin-right:0px;margin-bottom:2em;margin-left:0px;font-size:14px;border-width:2px;border-style:dashed;border-color:var(--awb-color2);"><div class="syntax-highlighter-copy-code"><span class="syntax-highlighter-copy-code-title" data-id="fusion_syntax_highlighter_5" style="font-size:14px;">Copy to Clipboard</span></div><label for="fusion_syntax_highlighter_5" class="screen-reader-text">Syntax Highlighter</label><textarea class="fusion-syntax-highlighter-textarea" id="fusion_syntax_highlighter_5" data-readonly="nocursor" data-linenumbers="1" data-linewrapping="1" data-theme="default" data-mode="text/x-sh">public static Vector3 FwdFromCPoint(BGCurveBaseMath math, Vector3 outsidePoint, out Vector3 curvePoint, Vector3? offset = null)
{
    if (offset == null){offset = Vector3.zero;}else{offset=(Vector3)offset;}
    Vector3 forward = CalculateTangentFromClosestPoint(math, outsidePoint, out curvePoint, offset);
    forward.y = 0;
    return forward.normalized;
}

private static Vector3 TanFromCPoint(BGCurveBaseMath math, Vector3 outsidePoint, out Vector3 curvePoint, Vector3? offset = null)
{
    if (offset == null){offset = Vector3.zero;}else{offset=(Vector3)offset;}
    float curvePointDistance;
    curvePoint = math.CalcPositionByClosestPoint(outsidePoint-(Vector3)offset, out curvePointDistance)+(Vector3)offset;
    Vector3 tangent = math.CalcTangentByDistance(curvePointDistance);
    return tangent;
}</textarea></div><div class="fusion-text fusion-text-34 translate lang-en "><p>The Y axis needed to be freed to allow for gravity.</p>
</div><div class="fusion-text fusion-text-35 translate lang-de"><p>Die Y-Achse musste freigegeben werden, um die Schwerkraft zu berücksichtigen.</p>
</div><div class="fusion-text fusion-text-36 translate lang-it"><p>L'asse Y doveva essere liberato per consentire l'azione della gravità.</p>
</div><style type="text/css" scopped="scopped">.fusion-syntax-highlighter-6 > .CodeMirror, .fusion-syntax-highlighter-6 > .CodeMirror .CodeMirror-gutters {background-color:transparent;}.fusion-syntax-highlighter-6 > .CodeMirror .CodeMirror-gutters { background-color: transparent; }.fusion-syntax-highlighter-6 > .CodeMirror .CodeMirror-linenumber { color: var(--awb-color3); }</style><div class="fusion-syntax-highlighter-container fusion-syntax-highlighter-6 fusion-syntax-highlighter-theme-light no-translate" style="opacity:0;margin-top:0px;margin-right:0px;margin-bottom:2em;margin-left:0px;font-size:14px;border-width:2px;border-style:dashed;border-color:var(--awb-color2);"><div class="syntax-highlighter-copy-code"><span class="syntax-highlighter-copy-code-title" data-id="fusion_syntax_highlighter_6" style="font-size:14px;">Copy to Clipboard</span></div><label for="fusion_syntax_highlighter_6" class="screen-reader-text">Syntax Highlighter</label><textarea class="fusion-syntax-highlighter-textarea" id="fusion_syntax_highlighter_6" data-readonly="nocursor" data-linenumbers="1" data-linewrapping="1" data-theme="default" data-mode="text/x-sh">public static Vector3 GetFlatPos(Vector3 pos, float y=0){
    return (Vector3.right*pos.x)+(Vector3.up*y)+(Vector3.forward*pos.z);
}</textarea></div><div class="fusion-text fusion-text-37 translate lang-en "><p>The Y axis needed to be freed to allow for gravity, and to smooth out the physics I also projected the velocity along the spline.</p>
</div><div class="fusion-text fusion-text-38 translate lang-de"><p>Die Y-Achse musste freigegeben werden, um die Schwerkraft zu berücksichtigen, und um die Physik zu glätten, habe ich auch die Geschwindigkeit entlang der Spline projiziert.</p>
</div><div class="fusion-text fusion-text-39 translate lang-it"><p>L'asse Y doveva essere liberato per consentire l'azione della gravità e, per uniformare la fisica, ho anche proiettato la velocità lungo la spline.</p>
</div><style type="text/css" scopped="scopped">.fusion-syntax-highlighter-7 > .CodeMirror, .fusion-syntax-highlighter-7 > .CodeMirror .CodeMirror-gutters {background-color:transparent;}.fusion-syntax-highlighter-7 > .CodeMirror .CodeMirror-gutters { background-color: transparent; }.fusion-syntax-highlighter-7 > .CodeMirror .CodeMirror-linenumber { color: var(--awb-color3); }</style><div class="fusion-syntax-highlighter-container fusion-syntax-highlighter-7 fusion-syntax-highlighter-theme-light no-translate" style="opacity:0;margin-top:0px;margin-right:0px;margin-bottom:2em;margin-left:0px;font-size:14px;border-width:2px;border-style:dashed;border-color:var(--awb-color2);"><div class="syntax-highlighter-copy-code"><span class="syntax-highlighter-copy-code-title" data-id="fusion_syntax_highlighter_7" style="font-size:14px;">Copy to Clipboard</span></div><label for="fusion_syntax_highlighter_7" class="screen-reader-text">Syntax Highlighter</label><textarea class="fusion-syntax-highlighter-textarea" id="fusion_syntax_highlighter_7" data-readonly="nocursor" data-linenumbers="1" data-linewrapping="1" data-theme="default" data-mode="text/x-sh">void Move(){
    if(_math==null||_rigidbody==null||_collider==null){return;}
    if(isStatic||isPathStatic){return;}

  // CALCULATE OFF PATH OFFSET
    if(isPushedOffPath){return;}
    zOff=CalculateZOffset();
    fPoint=PathMath.FwdFromCPoint(_math, PathMath.GetFlatPos(_rbody.position,cPoint.y),  out cPoint, zOff);
    vDir=GetFlatPos(fPoint,0).normalized;

  // REDIRECT VELOCITY
    if(!isPushedOffPath){
        Vector3 vProject = Vector3.Project(_rbody.velocity, -vDir);
        _rigidbody.velocity = PathMath.GetFlatPos(vProject,_rigidbody.velocity.y);
    }

    forward=fPoint;
}</textarea></div><div class="video has-mask" style='mask-position:center center;mask-size:cover;mask-image:url("https://garyangelonejr.me/wp-content/themes/Avada-Child-Theme/img/masks/mask-00.png");'><div class="fusion-video fusion-selfhosted-video mask  wrapped" style="max-width:100%;"><div class="video-wrapper"><video playsinline="true" width="100%" style="object-fit: cover;" autoplay="true" muted="true" loop="true" preload="auto"><source src="/vid/post/MonkeyFootball.mp4" type="video/mp4">Sorry, your browser doesn't support embedded videos.</source></video></div></div></div></div></div><div class="fusion-layout-column fusion_builder_column fusion-builder-column-5 fusion_builder_column_1_1 1_1 fusion-flex-column" style="--awb-padding-top:3em;--awb-padding-bottom:6em;--awb-bg-size:cover;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:3.072%;--awb-margin-bottom-large:0px;--awb-spacing-left-large:1.92%;--awb-width-medium:100%;--awb-order-medium:0;--awb-spacing-right-medium:3.072%;--awb-spacing-left-medium:1.92%;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:1.92%;--awb-spacing-left-small:1.92%;"><div class="fusion-column-wrapper fusion-column-has-shadow fusion-flex-justify-content-flex-start fusion-content-layout-column"><div style="text-align:center;"><a class="fusion-button button-flat fusion-button-default-size button-default fusion-button-default button-3 fusion-button-default-span fusion-button-default-type fusion-animated" data-animationtype="flipiny" data-animationduration="0.3" data-animationoffset="top-into-view" target="_blank" rel="noopener noreferrer" href="https://github.com/KoschKX/Unity-25DPhysics"><i class="fa-arrow-circle-down fas awb-button__icon awb-button__icon--default button-icon-left" aria-hidden="true"></i><span class="fusion-button-text awb-button__text awb-button__text--default">GitHub Project</span></a></div></div></div></div></div>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Lattice Mesh Deformer</title>
		<link>https://garyangelonejr.me/lattice-mesh-deformer/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 03 Dec 2022 12:06:32 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Unity]]></category>
		<guid isPermaLink="false">http://localhost/?p=33</guid>

					<description><![CDATA[To get a toon look for architecture, I needed a lattice deformer. There is an open source solution which nearly did the trick, but the bounds function was broken.]]></description>
										<content:encoded><![CDATA[<div class="fusion-fullwidth fullwidth-box fusion-builder-row-5 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling" style="--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-flex-wrap:wrap;"><div class="fusion-builder-row fusion-row fusion-flex-align-items-flex-start fusion-flex-content-wrap" style="max-width:1248px;margin-left: calc(-4% / 2 );margin-right: calc(-4% / 2 );"><div class="fusion-layout-column fusion_builder_column fusion-builder-column-6 fusion_builder_column_1_1 1_1 fusion-flex-column" style="--awb-bg-size:cover;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:1.92%;--awb-margin-bottom-large:0px;--awb-spacing-left-large:1.92%;--awb-width-medium:100%;--awb-spacing-right-medium:1.92%;--awb-spacing-left-medium:1.92%;--awb-width-small:100%;--awb-spacing-right-small:1.92%;--awb-spacing-left-small:1.92%;"><div class="fusion-column-wrapper fusion-flex-justify-content-flex-start fusion-content-layout-column"><div class="fusion-text fusion-text-40 translate lang-en "><p>To get a toon look for architecture, I needed a lattice deformer. There is an <a href="https://github.com/keenanwoodall/Deform">open source solution</a> which nearly did the trick, but the bounds function was broken.</p>
</div><div class="fusion-text fusion-text-41 translate lang-de"><p>Um einen Cartoon-Look für die Architektur zu erzielen, benötigte ich einen Gitter-Deformer. Es gibt eine <a href="https://github.com/keenanwoodall/Deform">Open-Source-Lösung</a>, die fast das gewünschte Ergebnis lieferte, aber die Bounds-Funktion war defekt.</p>
</div><div class="fusion-text fusion-text-42 translate lang-it"><p>Per ottenere un effetto cartoonesco nell'architettura, avevo bisogno di un deformatore a reticolo. Esiste una <a href="https://github.com/keenanwoodall/Deform">soluzione open source</a> che quasi funzionava, ma la funzione di delimitazione era difettosa.</p>
</div><div class="fusion-text fusion-text-43 translate lang-en "><p>The bounds functions had to be rewritten.</p>
</div><div class="fusion-text fusion-text-44 translate lang-de"><p>Die Bounds-Funktionen mussten neu geschrieben werden.</p>
</div><div class="fusion-text fusion-text-45 translate lang-it"><p>Le funzioni dei limiti dovevano essere riscritte.</p>
</div><style type="text/css" scopped="scopped">.fusion-syntax-highlighter-8 > .CodeMirror, .fusion-syntax-highlighter-8 > .CodeMirror .CodeMirror-gutters {background-color:transparent;}.fusion-syntax-highlighter-8 > .CodeMirror .CodeMirror-gutters { background-color: transparent; }.fusion-syntax-highlighter-8 > .CodeMirror .CodeMirror-linenumber { color: var(--awb-color3); }</style><div class="fusion-syntax-highlighter-container fusion-syntax-highlighter-8 fusion-syntax-highlighter-theme-light" style="opacity:0;margin-top:0px;margin-right:0px;margin-bottom:2em;margin-left:0px;font-size:14px;border-width:2px;border-style:dashed;border-color:var(--awb-color2);"><div class="syntax-highlighter-copy-code"><span class="syntax-highlighter-copy-code-title" data-id="fusion_syntax_highlighter_8" style="font-size:14px;">Copy to Clipboard</span></div><label for="fusion_syntax_highlighter_8" class="screen-reader-text">Syntax Highlighter</label><textarea class="fusion-syntax-highlighter-textarea" id="fusion_syntax_highlighter_8" data-readonly="nocursor" data-linenumbers="1" data-linewrapping="1" data-theme="default" data-mode="text/x-csrc"> Vector3 calculateCentroid()
  {
    Vector3 centroid = Vector3.zero;
    if (children.Length &gt; 0 )
    {
      foreach(GameObject child in children)
      {
          centroid += child.transform.position+child.transform.localPosition;
      }
      centroid /= (children.Length+1);
    }
    return centroid;
  }

  Bounds CalculateBounds()
  {
      Vector3 center = calculateCentroid();
      Bounds bounds = new Bounds(center, Vector3.zero);
      foreach (GameObject child in children)
      {
          if(child.GetComponent<renderer>()!=null){
              Renderer r = child.GetComponent<renderer>();
              Bounds b = r.bounds;
              bounds.Encapsulate(r.bounds);
          }
      }
      return bounds;
   }</renderer></renderer></textarea></div><div class="fusion-text fusion-text-46 translate lang-en "><p>Scale and global positioning needed to be respected.</p>
</div><div class="fusion-text fusion-text-47 translate lang-de"><p>Maßstab und globale Positionierung mussten beachtet werden.</p>
</div><div class="fusion-text fusion-text-48 translate lang-it"><p>Era necessario rispettare le dimensioni e il posizionamento globale.</p>
</div><style type="text/css" scopped="scopped">.fusion-syntax-highlighter-9 > .CodeMirror, .fusion-syntax-highlighter-9 > .CodeMirror .CodeMirror-gutters {background-color:transparent;}.fusion-syntax-highlighter-9 > .CodeMirror .CodeMirror-gutters { background-color: transparent; }.fusion-syntax-highlighter-9 > .CodeMirror .CodeMirror-linenumber { color: var(--awb-color3); }</style><div class="fusion-syntax-highlighter-container fusion-syntax-highlighter-9 fusion-syntax-highlighter-theme-light" style="opacity:0;margin-top:0px;margin-right:0px;margin-bottom:2em;margin-left:0px;font-size:14px;border-width:2px;border-style:dashed;border-color:var(--awb-color2);"><div class="syntax-highlighter-copy-code"><span class="syntax-highlighter-copy-code-title" data-id="fusion_syntax_highlighter_9" style="font-size:14px;">Copy to Clipboard</span></div><label for="fusion_syntax_highlighter_9" class="screen-reader-text">Syntax Highlighter</label><textarea class="fusion-syntax-highlighter-textarea" id="fusion_syntax_highlighter_9" data-readonly="nocursor" data-linenumbers="1" data-linewrapping="1" data-theme="default" data-mode="text/x-csrc">public void FitBounds()
{
    Bounds b = CalculateBounds();

    if(inEditMode){
        gameObject.transform.localScale=b.size;
        gameObject.transform.position=b.center;
        Bounds = new Bounds (Vector3.zero, Vector3.one);
    }else{
        Bounds = b;
        transform.localScale=Vector3.one;
        transform.localPosition=Vector3.zero;
   }

}

public void FitScaleToBounds()
{
    Bounds b = Bounds;
    transform.localScale=b.size;
    transform.localPosition=b.center;
    Bounds = new Bounds (Vector3.zero, Vector3.one);
}

public void FitBoundsToScale()
{
    Bounds = new Bounds (transform.localPosition, transform.localScale);
    transform.localScale=Vector3.one;
    transform.localPosition=Vector3.zero;
}
</textarea></div><div class="fusion-text fusion-text-49 translate lang-en "><p>In order to keep the effect within the bounds, the source vertices needed to be clamped.</p>
</div><div class="fusion-text fusion-text-50 translate lang-de"><p>Um den Effekt innerhalb der Grenzen zu halten, mussten die Quell-Scheitelpunkte begrenzt werden.</p>
</div><div class="fusion-text fusion-text-51 translate lang-it"><p>Per mantenere l'effetto entro i limiti, è stato necessario bloccare i vertici sorgente.</p>
</div><style type="text/css" scopped="scopped">.fusion-syntax-highlighter-10 > .CodeMirror, .fusion-syntax-highlighter-10 > .CodeMirror .CodeMirror-gutters {background-color:transparent;}.fusion-syntax-highlighter-10 > .CodeMirror .CodeMirror-gutters { background-color: transparent; }.fusion-syntax-highlighter-10 > .CodeMirror .CodeMirror-linenumber { color: var(--awb-color3); }</style><div class="fusion-syntax-highlighter-container fusion-syntax-highlighter-10 fusion-syntax-highlighter-theme-light" style="opacity:0;margin-top:0px;margin-right:0px;margin-bottom:2em;margin-left:0px;font-size:14px;border-width:2px;border-style:dashed;border-color:var(--awb-color2);"><div class="syntax-highlighter-copy-code"><span class="syntax-highlighter-copy-code-title" data-id="fusion_syntax_highlighter_10" style="font-size:14px;">Copy to Clipboard</span></div><label for="fusion_syntax_highlighter_10" class="screen-reader-text">Syntax Highlighter</label><textarea class="fusion-syntax-highlighter-textarea" id="fusion_syntax_highlighter_10" data-readonly="nocursor" data-linenumbers="1" data-linewrapping="1" data-theme="default" data-mode="text/x-csrc">if ( !clamp &amp;&amp;
      (sourcePosition.x &gt; 1 || sourcePosition.x &lt; 0
    || sourcePosition.z &gt; 1 || sourcePosition.z &lt; 0
    || sourcePosition.y &gt; 1 || sourcePosition.y &lt; 0)
   ){

    newPosition = point;
}</textarea></div><div class="fusion-text fusion-text-52 translate lang-en "><p>There was also some unecessary math happening in the runtime code. I was able to get more FPS by correcting it.</p>
</div><div class="fusion-text fusion-text-53 translate lang-de"><p>Es gab auch einige unnötige Berechnungen im Laufzeitcode. Durch deren Korrektur konnte ich mehr FPS erzielen.</p>
</div><div class="fusion-text fusion-text-54 translate lang-it"><p>C'erano anche alcuni calcoli matematici superflui nel codice di runtime. Sono riuscito a ottenere un numero maggiore di FPS correggendoli.</p>
</div><div class="fusion-video fusion-selfhosted-video bordered mask_/2025/08/mask-00.png" style="max-width:100%;"><div class="video-wrapper"><video playsinline="true" width="100%" style="object-fit: cover;" autoplay="true" muted="true" loop="true" preload="auto"><source src="/vid/post/LatticeMulti.mp4" type="video/mp4">Sorry, your browser doesn't support embedded videos.</source></video></div></div></div></div><div class="fusion-layout-column fusion_builder_column fusion-builder-column-7 fusion_builder_column_1_1 1_1 fusion-flex-column" style="--awb-padding-top:3em;--awb-padding-bottom:6em;--awb-bg-size:cover;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:3.072%;--awb-margin-bottom-large:0px;--awb-spacing-left-large:1.92%;--awb-width-medium:100%;--awb-order-medium:0;--awb-spacing-right-medium:3.072%;--awb-spacing-left-medium:1.92%;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:1.92%;--awb-spacing-left-small:1.92%;"><div class="fusion-column-wrapper fusion-column-has-shadow fusion-flex-justify-content-flex-start fusion-content-layout-column"><div style="text-align:center;"><a class="fusion-button button-flat fusion-button-default-size button-default fusion-button-default button-4 fusion-button-default-span fusion-button-default-type fusion-animated" data-animationtype="flipiny" data-animationduration="0.3" data-animationoffset="top-into-view" target="_blank" rel="noopener noreferrer" href="https://github.com/KoschKX/Unity-LatticeMeshDeformer"><i class="fa-arrow-circle-down fas awb-button__icon awb-button__icon--default button-icon-left" aria-hidden="true"></i><span class="fusion-button-text awb-button__text awb-button__text--default">GitHub Project</span></a></div></div></div></div></div>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
