<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Master Mind</title>
    <description>The latest articles on DEV Community by Master Mind (@iboss21).</description>
    <link>https://dev.to/iboss21</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2978036%2Fb9a27069-7353-4d67-ada4-b7beeab7a3a5.png</url>
      <title>DEV Community: Master Mind</title>
      <link>https://dev.to/iboss21</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/iboss21"/>
    <language>en</language>
    <item>
      <title>I ray traced a real diamond in a fragment shader (no textures, no models, 73 planes)</title>
      <dc:creator>Master Mind</dc:creator>
      <pubDate>Wed, 28 Oct 2026 06:44:28 +0000</pubDate>
      <link>https://dev.to/iboss21/i-ray-traced-a-real-diamond-in-a-fragment-shader-no-textures-no-models-73-planes-7p9</link>
      <guid>https://dev.to/iboss21/i-ray-traced-a-real-diamond-in-a-fragment-shader-no-textures-no-models-73-planes-7p9</guid>
      <description>&lt;p&gt;Most "3D diamonds" on the web are a glass material with a sparkle texture. They look fine in a thumbnail and dead the moment you move the light.&lt;/p&gt;

&lt;p&gt;I wanted the real thing: light that enters the stone, bounces around inside it, and leaves as tiny rainbows. So I built it as a ray tracer that runs per pixel in a three.js fragment shader.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fokcm1slygtn2dg7w39lc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fokcm1slygtn2dg7w39lc.jpg" alt="The diamond hero: a ray traced round brilliant over a spectral caustic floor" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Play with it first:&lt;/strong&gt; &lt;a href="https://animatedwebs.com/demos/wren-halloway-diamonds/index.html" rel="noopener noreferrer"&gt;the live demo&lt;/a&gt;. Move your cursor to swing the studio lights, drag the stone, and push the dispersion slider.&lt;/p&gt;

&lt;h2&gt;
  
  
  The trick: a diamond is just a list of planes
&lt;/h2&gt;

&lt;p&gt;A brilliant cut is a convex polyhedron. Every convex polyhedron is the intersection of half-spaces, so the whole stone fits in an array of planes, each one &lt;code&gt;n · p &amp;lt;= d&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1 table&lt;/li&gt;
&lt;li&gt;8 stars, 8 bezels, 16 upper halves&lt;/li&gt;
&lt;li&gt;16 girdle facets&lt;/li&gt;
&lt;li&gt;8 pavilion mains, 16 lower halves&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is 73 planes. No mesh data in the shader at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Entering the stone
&lt;/h2&gt;

&lt;p&gt;For a ray from the camera, every plane facing the ray narrows the entry point and every plane facing away narrows the exit. Keep the largest entry and the smallest exit; if entry beats exit, you missed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight glsl"&gt;&lt;code&gt;&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;tin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;1e9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tout&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1e9&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="kt"&gt;vec3&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;MAXP&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;uN&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kt"&gt;vec4&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;uP&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
  &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;dn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;xyz&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;xyz&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;dn&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dn&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;tin&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;tin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;xyz&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="n"&gt;tout&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tout&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tin&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;tout&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;discard&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The plane that won is the facet you hit, so you get a perfect flat normal for free. Bonus: the gap between the best and second-best entry plane tells you how close you are to a facet edge, which is how the page draws the glowing blueprint view.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frdrxfi0193g3p5wwxzsy.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frdrxfi0193g3p5wwxzsy.jpg" alt="The same shader drawing every facet edge as a blueprint while the counter reaches 73" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Bouncing inside
&lt;/h2&gt;

&lt;p&gt;Refract in with an index of 2.418. Then, up to six times: find the nearest exit plane, try to refract out, and reflect back in if the angle is past diamond's critical angle (24.4 degrees). That total internal reflection is why diamonds look full of light.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fire is three exits, not three rays
&lt;/h2&gt;

&lt;p&gt;Tracing red, green and violet separately triples the cost. Instead I trace one path and split only at the exit, refracting with three slightly different indices. Diamond spreads red to violet by about 0.044, and that alone produces believable fire. The slider just exaggerates the spread.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fda39kqamvdenzpckmcws.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fda39kqamvdenzpckmcws.jpg" alt="Fire: dispersion turned up, light leaving the stone as small spectra" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The light is fake on purpose
&lt;/h2&gt;

&lt;p&gt;There is no HDR image. The environment is a function: a dark gradient plus four soft rectangular "softboxes" and a thin ring light, rotated by your cursor. Moving the lights is what makes the stone flash, so it had to be cheap and controllable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making it a real page
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A tight hull mesh (computed from triple-plane intersections) means only the stone's pixels run the shader.&lt;/li&gt;
&lt;li&gt;Bloom only catches the HDR highlights, so the sparkle glows without washing out the copy.&lt;/li&gt;
&lt;li&gt;A carbon lattice made of real diamond-cubic points, clipped to the cut, assembles into the stone as you scroll.&lt;/li&gt;
&lt;li&gt;Three cuts (round, oval, emerald) are just three plane lists. Oval is the round list scaled through the inverse transpose.&lt;/li&gt;
&lt;li&gt;Pause motion, reduced motion and adaptive resolution are built in, because a beautiful page that melts a laptop is not beautiful.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feocoptyzayalidb8jrf4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feocoptyzayalidb8jrf4.jpg" alt="The configurator: pick a cut, carat and color, and the traced stone updates with a live price" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://animatedwebs.com/demos/wren-halloway-diamonds/index.html" rel="noopener noreferrer"&gt;Live demo&lt;/a&gt; · &lt;a href="https://animatedwebs.com/templates/wren-halloway-diamonds" rel="noopener noreferrer"&gt;The template&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is part of &lt;a href="https://animatedwebs.com" rel="noopener noreferrer"&gt;AnimatedWebs&lt;/a&gt;, where every template is a playable demo plus a build prompt you can take into Claude Code, Cursor, Lovable, v0 or Bolt. There is a free &lt;a href="https://animatedwebs.com/mcp" rel="noopener noreferrer"&gt;MCP server&lt;/a&gt; so your coding agent can search the library itself, and an &lt;a href="https://animatedwebs.com/agents" rel="noopener noreferrer"&gt;agent hub&lt;/a&gt; if you build with AI agents.&lt;/p&gt;

&lt;h2&gt;
  
  
  Also from our team
&lt;/h2&gt;

&lt;p&gt;We are a small studio, &lt;a href="https://www.likeakinginc.com/" rel="noopener noreferrer"&gt;Like a King Inc.&lt;/a&gt;, and we build everything ourselves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://animatedwebs.com" rel="noopener noreferrer"&gt;AnimatedWebs&lt;/a&gt;: animated website templates with live demos and AI build prompts&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://motionvault.site" rel="noopener noreferrer"&gt;MotionVault&lt;/a&gt;: cinematic website templates and design assets&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://regescore.pro" rel="noopener noreferrer"&gt;RegesCore&lt;/a&gt;: a private AI assistant that runs on your own PC&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://regescode.com" rel="noopener noreferrer"&gt;Reges Code&lt;/a&gt;: a free, local-first AI code editor&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://regesarc.com" rel="noopener noreferrer"&gt;RegesARC&lt;/a&gt;: a local AI workstation for running your own models&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://heymillicent.com" rel="noopener noreferrer"&gt;Millicent&lt;/a&gt;: an AI sidekick with personality and memory&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://trustcertia.com" rel="noopener noreferrer"&gt;TrustCertia&lt;/a&gt;: verifiable trust records for websites&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://creditfixexpert.com" rel="noopener noreferrer"&gt;CreditFixExpert&lt;/a&gt;: evidence-linked credit report disputes&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://mylittlebots.com" rel="noopener noreferrer"&gt;My Little Bots&lt;/a&gt;: ready-made jobs for your Grok bot&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://regestown.com" rel="noopener noreferrer"&gt;Reges Town&lt;/a&gt;: a living 3D city run by AI citizens&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://lxrcore.com" rel="noopener noreferrer"&gt;LXR Core&lt;/a&gt;: game server resources&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://davidio.dev" rel="noopener noreferrer"&gt;davidio.dev&lt;/a&gt;: the developer behind it all&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What would you ray trace next? I am leaning toward a watch movement.&lt;/p&gt;

</description>
      <category>webgl</category>
      <category>threejs</category>
      <category>graphics</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Ai Dev - ive launched few projects and kind get use to it.</title>
      <dc:creator>Master Mind</dc:creator>
      <pubDate>Wed, 03 Dec 2025 05:22:37 +0000</pubDate>
      <link>https://dev.to/iboss21/ai-dev-ive-launched-few-projects-and-kind-get-use-to-it-3ldn</link>
      <guid>https://dev.to/iboss21/ai-dev-ive-launched-few-projects-and-kind-get-use-to-it-3ldn</guid>
      <description>&lt;p&gt;Ai Dev - ive launched few projects and kind get use to it. &lt;br&gt;
its really me or i just dont want to build website or app anywhere else? &lt;/p&gt;

&lt;p&gt;ive launched. &lt;br&gt;
ecoshine.pro&lt;br&gt;
fixitfast.nyc&lt;br&gt;
wolves.land &lt;/p&gt;

&lt;p&gt;and god damn it. i like it. &lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
