Better HN
topnewbestaskshowjobs
Log inSign up

SuboptimalEng

296 karma · joined Sep 3, 2020 (6y ago) · 111 submissions

Indian-American software engineer and YouTuber interested in computer graphics, anime, video games, and long-distance running.
Submissions

comment 2y ago · link · parent

Oh interesting, I always read (on r/GraphicsProgramming) that XCode has some of the best debugging tools out there. That's the main reason it's been on my mind. I just need better debugging tools on Mac!

Fair point about the health tech industry.

comment 2y ago · link · parent

It's interesting to hear that Cpp is faster even though there is an overhead of moving data from WASM <-> JS/TS. I'm not yet ready to "take the leap" to learn Cpp + Metal + XCode + WASM because those are some big hurdles to jump through (especially just in my free time), but you do raise some good points.

I'm certain you could turn this knowledge into a blog post and help many more engineers who are silently struggling through this path. Self-studying graphics programming is tough!

It should pop up first on YouTube if you search "What is WebGPU Suboptimal Engineer", but I'll link it here[0] in case anyone else wants to watch it. (No need for you to actually fact-check it. I didn't mean to put random work on your plate on a Sunday haha.)

[0] https://www.youtube.com/watch?v=oIur9NATg-I

comment 2y ago · link · parent

Wow! First of all, thank you for your amazing blog posts and tutorials! I wouldn't have been able to make it this far without them. Seriously, I was stuck for so long until a random Google search linked me to that WebGL ray-casting article you wrote. (I'd pin your comment if I could.)

The funny thing is that I was getting more confident about using JS + WebGL/WebGPU ecosystem for graphics programming after having read your posts. Very interesting to hear that you've come full circle back to Cpp + WebGL/WebGPU + WebAssembly. I'll look more closely to assess options as I head down this journey. Thank you for your tips and advice!

Edit: Perhaps you'd find my "What is WebGPU" video on YouTube interesting. I'd love to get it fact-checked by someone who's been doing WebGl/WebGPU way longer than most people! I only got into this field ~2 years ago.

comment 2y ago · link · parent

Good question! If I knew how to do it, I'd probably write this in just TypeScript. Turns out I don't know how to set that up. So I instead start with Vite and throw React in there to handle rerenders and simple state management. I think R3F is interesting, but I never used it because it makes graphics programming too front-endy.

The most important reason for my code structure is that I just like writing GLSL shaders! It's annoying that I need to set up Vite, TypeScript, Tailwind, React, etc. all so that I can write some shaders. I know I can write shaders in ShaderToy, but then I won't be able to upload custom 3D texture files or add simple user controls.

comment 2y ago · link · parent

My app does not support DICOM files as input. Just Uint8 256x256x256 raw files that are scaled 1x1x1. Maybe if I had the chance to work on it full-time I'd have the time to add those features, but it's just a side project for now.

Have you looked into Slicer3D[0] which is a multi-platform desktop app or Open Health Image Foundations dicom viewer[1] which is web-based? Perhaps one of these will help.

[0] https://www.slicer.org/

[1] https://github.com/OHIF/Viewers

comment 2y ago · link · parent

Cool thank you! I'm using a library called Dat.gui which was easy to download and use thanks to NPM. Maybe I've been too hard on the JS ecosystem heh.

I've heard good things about ImGUI so I'll have to check that out if I ever go down the Cpp route.

comment 2y ago · link · parent

That's one of the main benefits of Metal and it's made me think twice about it. I struggled quite a bit trying to debug my shaders. But Brendan Duncan's WebGPU Inspector caught my eye so I'll check that out for now.

Oh wow, your project looks really cool too! I'll check it out.

Interesting. I did not know that CDs did not need to get HIPAA compliance. I suppose web apps would certainly need that. I wonder what will happen once Gen Alpha starts needing to get MRI scans.

comment 2y ago · link · parent

I also heard that sometimes you need to physically carry CDs to doctor's office. I suppose getting pictures of your MRI scans via Web is a good middle ground.

It just really irked me that people got CDs instead of being fully digital. The last time I used a CD (besides my PS4) was 10+ years ago. I don't even have a CD player anymore. I'm sure Gen Alpha will look at CDs the way I look at floppy disks.

comment 2y ago · link · parent

Yea, that's what I love about the web. Though I do consider myself to be pretty experienced on the JS side as I've worked with it for a while. I think the main reason I ran into these issues is because I've been trying to use the Web for something that it's not fully built for (graphics programming). And also, it's been a while since I started setting up a new project.

Here are some questions that came up:

- Do I use Next.js or Vite.js or CRA (is that still used these days)

  - With Vite.js do I pick React or go with TypeScript template?
- Okay now I need Tailwind (because quite honestly, I'm terrible at CSS which I admit is my own doing)

- But what if I don't want to write GLSL files in raw text, and use GLSL file extension?

  - Oh now you want to import GLSL files directly, well you can't do that

  - Oh, I needed to install a Vite plugin but then TS throws errors saying it can't read files that end with .glsl

  - Wait is my TS server running? No, I thought this always starts up in VS Code

  - Okay so I can't even find the button to restart TS server, so now I need to... okay figured that out

  - That still didn't fix it the TS errors

  - After some more research, ah so you can import text files like this a.glsl?raw extension

40.

Show HN: Volume rendering 3D data in Three.js and GLSL(github.com ↗)

108 points · by SuboptimalEng · 2y ago · 37 comments

41.

The tech industry favors specialized engineers over generalists(old.reddit.com ↗)

1 points · by SuboptimalEng · 2y ago · 1 comment

comment 2y ago · link · parent

It is interesting to hear that you prefer generalists. A glance at your profile tells me that you are a tech lead (focused on data engineering) and it looks like you are hiring data engineers -- which to me is a specialized role.

43.

Ask HN: Is it better to specialize in economic downturns?

4 points · by SuboptimalEng · 2y ago · 4 comments

comment 3y ago · link · parent

Here is a slowly rotating checkerboard.

  uniform float time;
  varying vec2 vUv;
  varying vec3 vNormal;

  vec2 rot(vec2 uv, float angle) {
    float c = cos(angle);
    float s = sin(angle);
    mat2 rot = mat2(s, -c, c, s);
    return uv * rot;
  }

  void main(){
    vec3 black = vec3(0.0);
    vec3 white = vec3(1.0);
    vec3 color = black;

    vec2 uv = vUv;
    uv = rot(uv, sin(time) * 0.05);

    float boardSize = 24.0;
    uv = uv * boardSize;

    vec2 gridId = floor(uv);

    if (mod(gridId.x + gridId.y, 2.0) <= 0.01) {
      color = white;
    } else {
      color = black;
    }

    gl_FragColor = vec4(color, 1.0);
  }

comment 3y ago · link · parent

You can start learning graphics by writing shaders on Shadertoy. It’s where tons of graphics programmers get their start.

Shameless self promotion, I’ve made 10+ tutorials going over topics like: how to write shaders in VS Code, SDFs, ray marching, noise functions, fractional brownian motion, etc.

https://github.com/suboptimaleng/shader-tutorials

I’m certainly standing on the shoulders of giants like Inigo Quilez, The Art of Code, SimonDev and Acerola.

comment 3y ago · link · parent

Typed arrays are essential for web apps that use WebGL and WebGPU. Being able to send this type of data to run computations on the GPU can give you 1000x speed up.

You can see it in action on this WebGL fluid simulator[0] by PavelDoGreat.

[0] https://github.com/PavelDoGreat/WebGL-Fluid-Simulation

comment 3y ago · link · parent

I feel this is a weak argument. Like saying Bill Gates and Zuckerberg dropped out — but they dropped out of Harvard.

IIRC, George Hotz studied at CMU for a semester, took 4 difficult classes, got a 4.0, and won a CTF competition before dropping out.

My take is that the normal programmer (frontend, backend, systems, etc.) would benefit greatly from a CS degree.

comment 3y ago · link · parent

And operator overloading. TS code tends to look like this `c.add(b.add(a))` or `add(add(a, b), c)` instead of `a + b + c` as you might write in Python.

That was my biggest pain-point with using TS for graphics related projects. If operator overloading existed, then TS would be a no brainer for entry level graphics + AI/ML projects.

Edit: This gets more complicated when doing operations that force you to manually respect PEMDAS. For example, `add(div(a, b), multiply(c, d))` in TypeScript would simplify to `a / b + c * d` in Python. The TS version is unreadable.

49.

Ask HN: Have you ever pivoted your career?

4 points · by SuboptimalEng · 3y ago · 2 comments

comment 3y ago · link · parent

I started my channel[0] in 2019 focusing on LeetCode style tutorials in Python. This was before NeetCode and the best source for coding interview prep (at the time) was Tushar Roy's YouTube channel.

Turns out this was a super fast way to grow, but I decided to change directions as I didn't want to become an interview prep channel. Unlisted most of my videos and started fresh in early 2021. (You can still find them on a playlist on my channel.)

From then I made videos focusing on tech I was interested in like Vue.js, Tailwind CSS, React, TypeScript, VS Code, and Vim! Late 2021, I stumbled upon Three.js and graphics programming and that's the main focus of my channel now. My latest video was a tutorial on the Phong lighting method.

Stats: 14k+ subscribers, 1M+ total views, $100-200 per month (passive) income.

[0] https://www.youtube.com/SuboptimalEng

comment 4y ago · link · parent

As a YouTuber who makes educational coding content, this is huge news! One of the biggest hurdles for making a course (for me) has been figuring out which platform to put it on. My entire audience is on YouTube so it makes total sense to put a course directly on my channel.

Most big creators have (some form of) courses on other platforms as they are a great source of income. For example, Ali Abdaal (back when he had 1M subs) made 40K - 60K[0] per month by making courses on SkillShare. Convincing your audience to buy a course on another platform may be a viable for big creators, but it is much harder for small creators like myself. Having courses directly on YouTube is the best alternative.

I've always wanted this feature, but never knew how to bring it up to anyone working at YouTube! If any one from YouTube is reading this feel free to reach out - I've got lots of ideas on this!

[0] https://youtu.be/VTTp5A-rSdc?t=2013

comment 4y ago · link · parent

Great to see the project on the front page of HN - congrats on launching!

The author's got tons of video demos on their YouTube channel[0] as well.

[0] https://www.youtube.com/c/xima1

comment 4y ago · link · parent

Sports and dating still exist today, but, both of these combined do not come close to the amount time a kid spends by themselves on a weekly basis.

I was a 12 season runner in high school (averaged 30-60 miles per week), but I still had 6-8 hours of free time once I got home from school every night.

Now imagine this same high school scenario in 2020 vs 1990. In 1990, no social media, no games, no decent phone (for texting), and no computer (for most people in the world). The only fun thing to do was to literally pick up a book and read it.

comment 4y ago · link · parent

The thing to realize here is that these "legendary developers" grew up in a time where the MOST addicting thing to do was write programs on a screen or read books. There was LITERALLY nothing more exciting to do.

No games, no good tv/phones, and no social media.

And my theory was (essentially) confirmed when John Carmack tweeted[0] about how he avoids distractions in the present day. So it's safe to assume he would've struggled with distractions just like we did growing up (if said distractions existed at that time).

Point being, don't stress too much. We grew up in a different time. At a young age, we just didn't know any better. At least now you are more aware and can make better decisions.

[0] https://news.ycombinator.com/item?id=32583257

55.

Ten Lessons from “Senior” Software Engineering(happycoding.io ↗)

9 points · by SuboptimalEng · 4y ago · discuss

1234