<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Omid Saadat on Medium]]></title>
        <description><![CDATA[Stories by Omid Saadat on Medium]]></description>
        <link>https://medium.com/@omid3098?source=rss-ada624d19519------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*sx6D_pnvTZeBGiJafbar4Q.jpeg</url>
            <title>Stories by Omid Saadat on Medium</title>
            <link>https://medium.com/@omid3098?source=rss-ada624d19519------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 22:53:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@omid3098/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Using Unity`s ShaderGraph as a procedural “Texture” Creation tool!]]></title>
            <link>https://medium.com/@omid3098/using-unity-s-shadergraph-as-a-procedural-texture-creation-tool-54fc5836534e?source=rss-ada624d19519------2</link>
            <guid isPermaLink="false">https://medium.com/p/54fc5836534e</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[gamedev]]></category>
            <category><![CDATA[shaders]]></category>
            <category><![CDATA[indie]]></category>
            <category><![CDATA[procedural-generation]]></category>
            <dc:creator><![CDATA[Omid Saadat]]></dc:creator>
            <pubDate>Tue, 05 Jul 2022 13:11:39 GMT</pubDate>
            <atom:updated>2022-07-05T13:11:39.423Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*K3KYBqjUcsnCNL4vUayh-A.png" /></figure><h4>The idea:</h4><p>ShaderGraph is a tool to create node base shaders in Unity. We have too many nodes to mix and create amazing shaders (just like Substance designer) or even make our own custom nodes to implement new functionalities. What if we use these awesome resource of nodes to bake textures?</p><p>Pros:</p><ul><li>We can have a very complex and heavy shader and bake the results into separate textures for Color, Normal, Height, etc.. and use a lightweight shader to only sample these textures.</li><li>Many nodes are available and there are even more samples <a href="https://docs.unity3d.com/Packages/com.unity.shadergraph@13.1/manual/ShaderGraph-Samples.html#available-samples">here</a> to make complex textures like the way we do in substance designer or blender.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y6U5NEHVpE58R7-v.png" /></figure><ul><li>Can make our own nodes if there is not a node available.</li></ul><p>Cons:</p><ul><li>Can not be used for animated shaders. (however it’s possible to bake into a texture array instead of a single texture!)</li><li>Although there are many nodes available, but compared to substance designer with huge library of nodes, it takes more time to have a rich library of custom nodes.</li></ul><h4>Implementation:</h4><p>I have a shader with different slots like color, normal, etc..<br>Following this amazing <a href="https://www.ronja-tutorials.com/post/030-baking-shaders/">tutorial by Ronja</a>, I can bake from materials into textures using Graphics.Blit() function. <br>So In order to bake shaders, we can simply create a material using that shader in code and bake the result using that material.<br>BUT what about different maps?</p><p>Graphics.Blit() can get a parameter called pass to only render desired pass. I could find the pass index for normal (pass 4) but I could not find passes for other maps. So I have to come up with another way.</p><p>If I can parse shader graph files and swap final nodes that goes to different surface and vertex nodes of the shader, connect them to base color and do the rendering, I can get all available maps!</p><p>So lets modify a shadergraph file on the fly. <br>After analyzing shadergraph source, it seems that we don’t have access to shadergraph API to create new nodes or connections between nodes. most of the classes are internal to it’s own namespace. but the good news is that shader graph files are stored as multiple JSONs into a single file.</p><p>So I have to write my own shadergraph parser to read the source shader, find different nodes I want, swap them, remove nodes or edges, or create new edges between nodes and write back the JSON into a temporary file with “.shadergraph” format, make a material using that shader, render the results and remove the temp shader.</p><p>The easiest way for me to have a custom editor is to have a scriptable object and have a button using <a href="https://github.com/dbrizov/NaughtyAttributes">NaughtyAttributes</a> to execute functions in editor. I can write a better custom editor later :)</p><p>So here is the basic Interface:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*w7JeEq60LbjGFVR7dHS-uA.png" /></figure><h4>Problem:</h4><p>Normal maps are much darker when I bake them. “WHY?” I asked. <br>I posted this <a href="https://forum.unity.com/threads/what-happens-to-colors-of-a-normal-map-when-we-sample-them-in-shadergraph.1300098/">question in Unity`s forum</a> but did not received any good answer.</p><p>Lets learn more about what happens when we do sample a normal map in shader. Normal map textures are in stored in RGB range (0,1)and when we use them in shadergraph, the data needs to be converted into vector space(-1,1). you can check <a href="https://forum.unity.com/threads/what-happens-to-colors-of-a-normal-map-when-we-sample-them-in-shadergraph.1300098/#post-8231016">this answer</a> for more info.</p><p>So I have to reverse that pipeline to convert from vector range to RGB range ((-1,1) to (0,1)) to have the correct normal map and save it. after converting back to RGB range, the results are not the same as the original Normal texture I have used. It was a little brighter. which means I have another challenge!</p><p>It took more than a week to figure this one out! the calculation is correct but when I save the texture, the default render texture I use is sRGB and my existing normal map is in Linear format. I suddenly remembered than recently I had an interview with <a href="https://www.splashdamage.com/">SpashDamage </a>that during the interview they asked “when do we use sRGB and when do we use Linear?” and I did not know the answer! (And I did not get the job!)<br>And the problem is exactly because of this lack of knowledge! I need to store baked normal texture in Linear instead of sRGB. and now after doing so, everything works fine!</p><p>Left: Procedural brick shader<br>Right: Baked shader into 1024 textures</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ofhskTrR_kt8i8hopMSp5g.png" /></figure><p>Note: Sampling a texture is not always the cheapest method and using this tool is recommended when we have a really heavy shader that does lots of instructions and baking will give you better performance or when you just want to play around and create procedural textures.</p><p>The early version is available <a href="https://github.com/omid3098/ShaderGraphBaker">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54fc5836534e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Real life camera shake in Unity]]></title>
            <link>https://medium.com/@omid3098/real-life-camera-shake-in-unity-ffae4b5976ac?source=rss-ada624d19519------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffae4b5976ac</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[camera-shake]]></category>
            <category><![CDATA[technical-artist]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Omid Saadat]]></dc:creator>
            <pubDate>Sat, 18 Jun 2022 12:44:27 GMT</pubDate>
            <atom:updated>2022-06-18T12:44:27.574Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*7Vz5FsjYVxVbreDNLkeXLA.png" /></figure><p>If you ever wanted to have camera shake in unity, you probably end up using one of these two methods:</p><ul><li>Adding a random position and rotation to your camera.</li><li>Use a Cinemachine virtual camera with a Basic Multi Channel Perlin noise.</li></ul><figure><img alt="Basic Multi Channel Perlin noise in virtual camera" src="https://cdn-images-1.medium.com/max/424/1*sNNbe57YaVR9avIIrwgagA.png" /><figcaption>Basic Multi Channel Perlin noise in Cinemachine virtual camera</figcaption></figure><p>The second method is pretty cool but not realistic enough to a real life camera movement.</p><p>Here is another solution:</p><p><a href="https://twitter.com/Mrdodobird">Ian Hubert</a> has developed a real life camera shake for blender for different scenarios. you can <a href="https://www.youtube.com/watch?v=4lCm_jqoBrI">watch the video</a> or download the <a href="https://github.com/EatTheFuture/camera_shakify">Blender plugin</a>.</p><p>So if we can have these movement data in Unity, other engines or other 3d Software, we can animate the camera wherever we want! (another implementation to have this shake effect in <a href="https://twitter.com/thebrokemonkey/status/1448662005603180544?s=20&amp;t=-Fp8Nw2FB9N2A3RIlpCqsA">Houdini</a>)</p><blockquote><strong>Everything is data!</strong></blockquote><p>All the camera shake data was stored in <a href="https://github.com/EatTheFuture/camera_shakify/blob/master/shake_data.py">shake_data.py</a> so I had to convert that data into something like a JSON format to be able to use it in Unity and because it was using a nested dictionary, I could not simply just use json.dump(data) in python.</p><p>So I wrote a python script to load the data and write it into a valid JSON format. then I deserialized JSON into a c# object and stored data into separate animation curves in unity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/0*-ZqVoaZ8-L6JlIXx" /></figure><p>Now I have all the position and rotation data in Unity. with a simple component, I can use this data to animate the camera:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SMYFRSnzZBgX89u4F95vvA.png" /></figure><p>And apply this component to the camera.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FA4ZS1_9mkBc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DA4ZS1_9mkBc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FA4ZS1_9mkBc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/860dcf040fdd5fe0ba0db9fc1c15923c/href">https://medium.com/media/860dcf040fdd5fe0ba0db9fc1c15923c/href</a></iframe><p>You can have the source code at my GitHub:<br><a href="https://github.com/omid3098/camera_shakify_unity">omid3098/camera_shakify_unity: Blender`s Shakify addon in Unity!</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffae4b5976ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How did I write a PackageManager with GitHub]]></title>
            <link>https://medium.com/@omid3098/how-did-i-write-a-packagemanager-with-github-cdc34d3dbdac?source=rss-ada624d19519------2</link>
            <guid isPermaLink="false">https://medium.com/p/cdc34d3dbdac</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[package-management]]></category>
            <dc:creator><![CDATA[Omid Saadat]]></dc:creator>
            <pubDate>Sat, 07 Jul 2018 19:19:34 GMT</pubDate>
            <atom:updated>2018-07-07T19:19:34.363Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*yjqWLI6egRtbFueYbYJl8w.png" /></figure><p>(If you are a developer -not a game developer- you still might find this helpful)</p><p>When I started game development, I wanted to be able to use some of codes and assets I use a lot, in my other projects. One way was to put all assets together in a folder, zip them, (export as unitypackage in Unity), and import into other projects.<br>Advantage:<br>- Fast<br>- Safe (because it worked in the previous project)<br>Disadvantages:<br>- Packages are not up to date<br>- You can not manage these packages<br>- Does not feel geek 👾</p><p>I was getting to know about package managers like npm, but I had no idea how to get started with writing something like that.</p><p>On the other hand, Unity has its own AssetStore to download various Asset, but personally I do not use much of it except for premium assets.</p><h3>First try:</h3><p>A year ago - I began to read and learn about the mechanism of a package manager. I’ve found that I need to have a server that keeps the list of all packages with packages source (I had neither enough knowledge how to do that nor had my own server), I had to write a CLI to download packages from the server (and again the error: knowledge not enough) and I was humbled, and without making additional noises, closed web pages and went away.</p><h3>Second try:</h3><p>Unity’s 2018 has its own internal Package manager that only handles their own packages(published or wrote by unity company). So I remembered my old dream and It went on my nerves again.</p><p>since the last time, I had some repositories in my GitHub and I used to know more about GitHub rather than last year.<br>- I know that we can have files with direct download link in GitHub.<br>- I could see that if we have a repository name, its owner’s name and the version code in Release page, then we have its zipped download link:</p><pre><a href="https://github.com/omid3098/OpenAudio/archive/1.0.0.zip">https://github.com/:author/:packageName/archive/:versiontag.zip</a></pre><p>If I have a JSON containing some package info, I can download them.</p><pre>{<br>    &quot;packages&quot;: [<br>        {<br>            &quot;name&quot;: &quot;Open Audio&quot;,<br>            &quot;description&quot;: &quot;An easy to use Unity audio service&quot;,<br>            &quot;packageName&quot;: &quot;OpenAudio&quot;,<br>            &quot;author&quot;: &quot;omid3098&quot;<br>        },<br>        {<br>            &quot;name&quot;: &quot;Open Framework&quot;,<br>            &quot;description&quot;: &quot;A Lightweight framework for unity.&quot;,<br>            &quot;packageName&quot;: &quot;OpenFramework&quot;,<br>            &quot;author&quot;: &quot;omid3098&quot;<br>        }<br>    ],<br>    &quot;server&quot;: &quot;<a href="https://github.com/">https://github.com/</a>&quot;<br>}</pre><p>Digging sometime in GitHub API, I’ve found that we do not need the version number and we can get the latest changes for each package by having only the package name and author:</p><pre><a href="https://api.github.com/repos/">https://api.github.com/repos/</a>:author/:packageName/zipball</pre><p>Here we can access the zipped version of each package. we just need to download and unzip it in the right place. (You can also download the tarball)</p><ul><li>A place to have all packages (Github) ✅</li><li>A place to store package meta (Github) ✅</li><li>CLI or a tool to search and manage these packages. 👨‍🔧</li></ul><p>Apparently we only need to write a tool to manage these packages and the rest is between package developer and end user. Whenever the developer releases a new version, this Package Manager will automatically look for latest repository zip.</p><p>So with some knowledge of editor tool development for Unity, I’ve made <a href="https://github.com/omid3098/OpenPackageManager">this tool</a>. You can search through packages and download them in desired location in your project.</p><p>If you also have a package for Unity that you want to put into this package manager, just send the repository link with <a href="https://github.com/omid3098/OpenPackageManagerRepository">as described here</a>.</p><h3>What else?</h3><p>Please consider that this tool is at the beginning of the way. it can be improved by the API provided by GitHub, like the date of the last release, Latest commit tag, consider package dependencies and more.</p><p>You also can use something like this method for other situations than game development or Unity engine.</p><p>Feel free to contribute in <a href="https://github.com/omid3098/OpenPackageManager">GitHub repository</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cdc34d3dbdac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop being X, be Y instead]]></title>
            <link>https://medium.com/@omid3098/stop-being-x-be-y-instead-5b1a92fa7d17?source=rss-ada624d19519------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b1a92fa7d17</guid>
            <category><![CDATA[life]]></category>
            <category><![CDATA[3d-modeling]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[happy]]></category>
            <dc:creator><![CDATA[Omid Saadat]]></dc:creator>
            <pubDate>Mon, 13 Nov 2017 17:30:46 GMT</pubDate>
            <atom:updated>2025-11-14T09:17:32.752Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*L6kUo_86LI__NrWQJMMjjQ.jpeg" /></figure><p>When I was 12–13 years old, my father bought me a PC with some cool games running windows. every month we were allowed to go for buying new CDs. I was looking at the CD labels with joy trying to decide which one I want to have this month. there were Discreet 3ds max CD with a funny stupid 3D soldier on its cover. but that was not a game! and shipping that CD would be waste of money for my father. I never got that CD and forgot that.. *</p><p>At University, we started a game development team as 5 young engineering students with absolutely no ideas how to develop a game. just because we thought games are fun! OK, now were should we start? I remembered that CD:</p><blockquote>“I want to be an Artist!”</blockquote><p>I said.</p><p>we’ve spent a whole summer developing a game called “Satyar-Return to Parseh” and won the best game award of 2nd Broadcast Engineering Conference in 2007.</p><p>And I’ve spent 7 years as 3D Artist.</p><p>after 7 years full of joy, work, and earning money from 3D artist works , one day I said to myself, hey, you can be one of top 10 best character/environment artists in the world! do you want to be as good as Alex Alvarez?! of course I do! beside that, I started to learn how to work with “Game maker studio” after 3–4 month playing with the tool and making some simple apps/games I found that field truly amusing! Suddenly one of my friends told me that we need a programmer for our game can you do it?! after listening to the project description, and thinking about that I can do every thing that the game designer wants, I have accepted the project and!</p><blockquote>“I want to be a Programmer!”</blockquote><p>I said.</p><p><a href="https://www.kickstarter.com/projects/1929139578/memoranda">The Memoranda game</a> went well. So I kept looking for more programming opportunities. one thing led to another and here am I with 4 years of experiment as a game programmer.</p><p>Do I want to be one of the top 10 best game programmers in the world? Yes I do!</p><p>But I want to live a happy life. I want to enjoy my work and I need to learn more before my time is up!</p><p>So who knows?! some day I may stop being x = “game programmer” and be y = ? instead!</p><p>— * There were no Copyrights in Iran and we could buy a 3d studio max CD for less than $1.</p><p>Update — Nov 2025:<br>This is 8 years later. I don’t want to be top X or top Y in the world anymore. I don’t even find this goal a healthy one neither looking at the world the same way.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b1a92fa7d17" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>