TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Making a 3D modeler in C in a week

680 pointsby jasimabout 1 year ago

32 comments

netuleabout 1 year ago
I agree entirely with the author on the limitations of Raylib. I&#x27;m currently working on a tower-defense style game that I started in Raylib, but I&#x27;m running into many of the same limitations (and more). Things such as toggling fullscreen not working consistently across platforms, not being able to enumerate screen modes, toggling rendering features at runtime, saving compiled shaders etc., etc. Having said that, I appreciate Ray&#x27;s work on this library and will continue to sponsor him. Raylib is great for quickly banging out a prototype, but not much beyond that unless you&#x27;re okay with living with severe limitations.<p>Lesson learned, for sure, but I&#x27;m too far into the development to swap all of the Raylib stuff out for SDL (or something else) now.
评论 #40240709 未加载
评论 #40239909 未加载
评论 #40242353 未加载
评论 #40242694 未加载
评论 #40240118 未加载
评论 #40246720 未加载
评论 #40242831 未加载
评论 #40241215 未加载
评论 #40242863 未加载
SoKamilabout 1 year ago
&gt; The Shapes are kept in a statically allocated array [...] Can’t fail to allocate, can’t be leaked, no fluff. Lovely. The 100 shape limit wasn’t limiting in practice. With very little time to optimize the renderer, the framerate would drop before you even got to 100 shapes.<p>That&#x27;s the best example of avoiding premature optimization I&#x27;ve seen in a while.
评论 #40244045 未加载
评论 #40247293 未加载
runevaultabout 1 year ago
Super interesting post, and appreciate him talking about the various decisions like his handling of memory (and the issues he ran into with raylib). As someone who&#x27;s finally diving into part 2 of crafting interpreters (and using it to refresh myself on C) being reminded of what C does well is great.
fallingsquirrelabout 1 year ago
I really love the live demonstrations in the video. Forget building the app, I couldn&#x27;t even produce that video in a week if I tried.
评论 #40240744 未加载
ttulabout 1 year ago
Long ago, I worked on the operating system for a desk phone. With only 64K of RAM, there was no dynamic memory management whatsoever. We made heavy use of static variables and let the compiler figure out how to allocate everything at compile time.<p>It’s easy to forget that many applications probably don’t need dynamic memory management at all. You can often get away with allocating a few fixed size buffers and just handling the edge cases nicely when those buffers are full.<p>And in such a context, C is indeed a whole lot safer. No memory leaks. Your only concern is buffer overflows, which can be managed through careful use of sizeof when all of your variables are statically allocated. I’m not saying Rust and Go aren’t great options these days, but humble old C still works and doesn’t have to be nightmarishly complex.
drtghabout 1 year ago
Off-Topic:<p>Glad to see for the first time a WebAssembly interface where the text does not look blurry. I repeat, it is the first time.<p>Extending this to programs and some operating systems (such as Windows), in the past few years, there has been a pervasive issue with the text rasterization methods that have become a common trend and default setting.<p>Unfortunately, users often do not have the option of turning off anti-aliasing to get sharp text, and in the rare cases where this option is available, the interface (menus, etc.) still uses anti-aliasing.
评论 #40243493 未加载
评论 #40245978 未加载
kuonabout 1 year ago
I really like this kind of projects. I still like the low level of C. Now I work with rust a lot and elixir&#x2F;erlang but I often miss the simplicity and explicitness of C. For this, I use zig a lot too. It is a very nice improvement over C while keeping a lot of its philosophy.
评论 #40258869 未加载
ngcc_hkabout 1 year ago
Really agreed with his assertion of c. More to his “ Its syntax doesn’t hide complex operations. It’s simple enough that I don’t have to constantly look things up”, and further if you need to look up something about c, it is very easy and very informative. Simple and old lang has its benefits.
rkagererabout 1 year ago
<i>You could certainly make it harder on yourself by malloc-ing each Shape individually and storing those pointers in a dynamic array. Using a language like C# ... would force that allocation structure.</i><p>What&#x27;s stopping you from using a fixed array of structs in C#, just as the author has done in C?
评论 #40244641 未加载
antirezabout 1 year ago
I hope somebody will continue this project. It&#x27;s a few months away to be a serious alternative to Blender &#x2F; FreeCAD for certain use cases, with a much softer learning curve.
评论 #40245005 未加载
评论 #40241493 未加载
评论 #40246106 未加载
评论 #40242501 未加载
评论 #40243441 未加载
评论 #40242366 未加载
freecodyxabout 1 year ago
I sometimes think, that c is all we need
评论 #40242922 未加载
评论 #40246858 未加载
ederamenabout 1 year ago
Just started using Raylib, bummed to hear about the limitations!<p>As a novice C programmer, the simplicity and immediacy of results opened my eyes to how C can feel as productive as higher level languages with robust standard libs.
评论 #40244333 未加载
ffitchabout 1 year ago
&gt; The project is 2024 lines of C<p>got to appreciate the effort to make the irony possible : )
评论 #40242001 未加载
评论 #40242404 未加载
parastiabout 1 year ago
There&#x27;s something really powerful about taking the tools that you know very well and just making something cool with them. Really enjoyed this writeup, thanks.
gorkermannabout 1 year ago
To get a look at SDF rendering in a game, check out the blue clouds on the ground in Solar Ash:<p><a href="https:&#x2F;&#x2F;youtu.be&#x2F;HqQpYSQDIZQ?si=vMKplmGJIGvUn_LT" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;HqQpYSQDIZQ?si=vMKplmGJIGvUn_LT</a>
jasonjmcgheeabout 1 year ago
This looks like such a fun jam - wish I&#x27;d have known about it!<p>When&#x27;s the next one?
评论 #40242548 未加载
koushikabout 1 year ago
This looks cool, after 3 years in financial technology industry working on c&#x2F;c++ projects I’m in process of revisiting textbooks and relearning computer science fundamentals! Added raylib to my ‘explore’ list<p>I love this idea of reinventing wheel with such explicit goal (even if it sounds counterintuitive to some), we can rethink initial assumptions, best case scenario we come out with better implementations and paradigms than existing standards, worst case scenario you learn internals of tools and techniques you use daily!
neonsunsetabout 1 year ago
&quot;Using a language like C#, Javascript, or Python would force that allocation structure.&quot;<p>No. C# structs are C structs. Shape[], Span&lt;Shape&gt; or Shape* would not be an array of pointers. Any of the following would work:<p><pre><code> var fromHeap = new Shape[100]; var fromStack = (stackalloc Shape[100]); var fromPool = ArrayPool&lt;Shape&gt;.Shared.Rent(100); var fromMalloc = (Shape*)NativeMemory.Alloc(sizeof(Shape) * 100);</code></pre>
Jachabout 1 year ago
Really cool and the video was great too. Indie devs should probably consider doing this sort of thing more often, building these simple tools in service of a game rather than just using the industry standard tool. It can be a great way to add artistic character as well as rigorously enforce some limitations if that&#x27;s what you&#x27;re after.
dhooperabout 1 year ago
Thanks for the share!
swiftcoderabout 1 year ago
That&#x27;s some impressive development speed. Really enjoyed the explainer video too!
naaskingabout 1 year ago
Nice, I was considering a project like this myself. Signed distance fields are awesome. Everyone into modelling should check out ImplicitCAD based on SDFs.
kewpabout 1 year ago
I wish he had tried instead to do the faster subset of typescript, that is a pet peeve of mine and I&#x27;ve love to see how it would be done!
评论 #40245780 未加载
syphiantabout 1 year ago
Impossible! Wow! This is absolutely mind blowing.
sandwichukuleleabout 1 year ago
is the source code available? I looked through the blog post and linked videos but could not find a github repo or anything similar
评论 #40240788 未加载
评论 #40240738 未加载
rationalfaithabout 1 year ago
Good stuff! As a c&#x2F;c++ coder maintaining his game engine (for commercial and hobby purposes), this is always good to see!
RamiAwarabout 1 year ago
Amazing write up, thanks! Really enjoyed it, miss working on C&#x2F;C++ apps from scratch and having full control
xixixaoabout 1 year ago
Super impresssive for getting this done in a week. Being able to make pretty demo models definitely helps too! :)
gromneerabout 1 year ago
getting tired of the underhanded shilling for c and procedural style programming. the people doing this still pretend they are the underdogs but their point of view is over saturated.
评论 #40257778 未加载
评论 #40259379 未加载
评论 #40260837 未加载
emmanueloga_about 1 year ago
What is a stablished 3d modeler that uses the same kind of modeling as this one?
评论 #40241099 未加载
评论 #40241961 未加载
评论 #40241025 未加载
评论 #40242598 未加载
评论 #40249592 未加载
评论 #40241762 未加载
评论 #40241199 未加载
JabavuAdamsabout 1 year ago
This is really great! Nice work, and thanks for sharing.
anthkabout 1 year ago
Can I compile it with GNUStep?