#Foundations - Learning Graphics Programming with the Zig Programming language
1 messages · Page 7 of 1
Nice
I had no idea what direction has been in all this time
Yeah very helpful
It’s pretty cool! I mistakenly had srgb enabled though. 
mistakenly? 🙂
I'm just a machine
time to keep going
those days that are gray were either really good days, like the day I went to Rome, or really bad days
like really bad days
that gray day in August was not a good day
Ah I don't use github for my job coding
that explains it
Is it possible it ignores branches or something?
I don't think it ignore branches
it doesn't consider unmerged PRs
until they're merged
so I think it does ignore branches
Maybe because I don't close the branches? Idk
I'm looking at several dozen commits from june right now
if you ever merge them it will backdate it
also
you can totally game that chart
people draw stuff on their charts
Lol
I can't pull up the statistics for the repo since it's private but it's definitely not accurate I've made thousands of lines of changes this year
it does branches
do you have a green square for that commit
I remember not seeing green squares appear until I merge
that list is orthogonal I think to the squares
actually maybe not hold on
Yeah it also shows zero contributions in november when I wrote 5,000 lines of networking code so I must have just changed my workflow or something
ok yeah it does not do branches
it's commits
I thought that was a commit to a non-main branch, but it is a commit to a main branch
can't find any of my other contributions to SU from the surrounding time period 
Idk where you got that from but you can generate those in space engine so you can go wherever you want in the universe and tune the exposure and stuff to get just the skybox you want
that's really cool I will check that out thank you
if you dont want realism there is also spacescape
I was scratching my head trying to remember spacescape
I searched for skyscape and was "huh, wasn't there something like this"
hehe been there done that
I can remove my unnecessary stb dependency by just storing gzips of rgba values and do a bare bones simple noise algorithm
stb doesn’t feel good in zig tbh and I don’t need it
I want to remove glfw too and just work directly with windows api eventually
I think eventually I can just a single dependency on the vulkan sdk being available
Although vulkan has a window thing iirc
I think gzipped bmp
I just want to always deal with one image format and, yesterdays texture headache will be totally avoided and stb can go in the bin and I will always know what bytes I have
gz each individual entry, throw it into a cpio, then apply xz twice
very efficient for file size
What about linux?
proton should work?
Win32Surface, iirc
I will get a linux laptop and figure it out
(I brute forced compressing the minecraft jar’s contents; don’t remember if with or without assets; at some point to try to maximize compression. I actually used lzma for that, but I believe xz is the same thing without as many checksums, so xz ends up with a smaller file size)
I don’t want to deal with wayland/x windows so using windows apis and linking proton or however that works for linux is the thought I have, but maybe a vulkan specific thing exists
I care more about ease of the asset pipeline and am not trying to maximize compression or reduce disk space

Vulkan does not have a windowing API of its own
There is a thing
Hm?
I had figured out that you weren’t trying to maximize compression 
I was just continuing my talk about compression
A nm
I will try the win32 thing
I just care about making progress on my goals and not about needling into specific tech tbh. I think it’s great for learning though you are building a wide base of knowledge
Nah I think i will use sdl
I can live with a sdl as a single dependency
Maybe vma
I return an error from my uniform now when it's not initialized, and added panics for everywhere I was creating uniforms if that error is encountered and I have found like 4 scenes that are crashing now
5
holyshit more things
my uniforms are a disaster
lol
I tend to go with -1 for uninitialized uniforms and just let the implementer decide if they want to panic or not 
java too has proper errors… other than that they’re slow
Do you have stacktraces?
errors don't cause the program to exit
you're just forced to handle it
you can choose to crash
and then yes you have a stack trace
Java gets the stacktrace to then provide the error with the stacktrace to the handler 
Even if the handler doesn’t care about the error object at all 
you should give zig a try, unless you like a stable language with good editor tooling and an ecosystem of any kind
I somewhat rely on an ecosystem and rely almost entirely on editor tooling 
I just make my own ecosystem
literally zero plans to ever write anything in java
java is a great language and platform
I just don't plan on using is all, that wasn't intended as a slight
lol
java’s currently playing catchup to modern languages tbf
When it comes to the modern era, java is currently not great
I guess I fix all these issues then
I can't believe I have so many broken uniforms
hrmm
cool cool my shadowmaps were creating uniforms for textures for the depth pass
which weren't used or needed
that's gone, and those scenes work again
I need to test my scenes so I don't cause regressions like this
even with this uniform fix, I have to actually run the scene still to know it broke and I have so many scenes now
maybe a test scenes that just runs through all the scenes quickly
that's horrid
java issues: why is using a logging library so painful
also -1 for a uniform location is perfectly valid, just means its unused or optimized away, i wouldn't consider that an error. and if you say lookup block locations youll find they report -1 for certain things. but is still valid to upload to them, they more or less just no-op.
if anything id say its a warning at most
jni isnt as bad as i thought it was going to be when i tried it, granted no it isnt the nicest way to deal with stuff but it definitly can be worse
This
i will say there is something nice about cleaning up your shaders to not have unused stuff in it
it's not good for me I need those things to exist
i'm not making them to not exist
thats fair too, i just use introspection to dynamically get my uniform information so its sorta a non issue for my stuff
Look if ur email in git config matches the one on thr github
I've just been fixing scenes since deccer pointed out my errors :(
found so much stuff that was broken I didn't know

nearly done
I'm never sharing my code ever again with anyone
that's the real lesson
@ivory verge there you go, here's why my cubemaps didn't work with bindless https://github.com/btipling/foundations/commit/eaaaf5c61b795a6b68086ccd82b2dad29b5eb0fc
thanks for looking at my code
I think I fixed all the shit
there was a lot of it
back to uh regular stuff I guess
classic 😄
if you insist on using strings and have them map to the locations, you could setup shader reflection, ask the program (after linking it) to give you the list of active uniforms, which you then stuff in a dictionary of sorts, and whenever you .Uniform("typoedUniformHere", 3.14f); it checks whether that string exists in the dictionary or not and yells at you if it doesnt
Oh I can just declare the locations
In the shader
I am smort
No I don’t want to use strings
I am going to build a template tool in zig I am so over my shader mess
My own stb include
Just like go templates
for my asset pipeline
Compile time not run time
Straight to spirv sit in a compressed asset folder, one for each scene/level
With models, textures, materials etc
One file load instead of many, maybe bundle shared things
Hot reloading of assets
you could technically define a .h file
with #define SAMPLER_BASECOLOR_TEXTURE 0 etc
and share it in code and glsl
and use SAMPLER_BASECOLOR_TEXTURE in
layout(binding = SAMPLER_BASECOLOR_TEXTURE) uniform sampler2D u_base_color;
...
glBindTextureUnit(SAMPLER_BASECOLOR_TEXTURE, yourbaseColorTextureId);
Which is part of what I’m doing
My aut… fauderisms saved the day for once
i just use hard coded numbers, since i know which slot goes to what, and the bindings usually never change
mmm but that kills moddability
lol
what would anyone mod
there's nothing
0% percent anyone would want to mod anything I made
you would make it moddable by exposing a Renderer interface
and not just one tiny aspect of a specifically implemented - lets say - deferred renderer
and if you want to implement another deferred renderer for god knows reasons, just reimplement it the way you want
also all my projects and games are going to just be public on github with an MIT license so fully moddable if that was something people would ever want to do
just patch the binary
. modern modders are lazy AF
As a compiled application moddability is dead anyways
Unless you have an extensive scripting API
E.g. the game code is written in script
Talented people will not taken open source game and steal it for profit, they will make their own game and people who want to play games will get it through steam unless the demand is high but your price is higher than the burden of going outside steam for non-technical players
So I like open source
Yeah the modularity is what makes modding something that becomes a big ecosystem though
So just making the game open source doesn't get you to that point
That’s fair, I don’t have any goals for it personally atm
Yeah just saying it's a more delicate thing than it might seem
If you want to do it natively you'd want to expose a dll interface so that people can load the mod code in a modular way
There's also the issue that native code mods are a security risk so makes partaking in a modding ecosystem more risky for users
Having said that if you want big publisher support or investment don’t open source
I don’t think it would help
Like if you’re pitching your game
They might have a license policy
I only know how this works in b2b saas not video game industry
adding mod capabilities is certainly a rabbit hole
I have a scheme to do it
Well just for certain things
Basically just a way for weapons to be added in DLLs
My personal approach is just not to think about mods at all
yeah not for the first game anyway 🙂
i start with mod support that make my own life easier lmao
env mapping
that coordinate cross that shows the cardinal axes is so fucking helpful
idk why I waited so long to add it
what do you all think about SDL3's GPU API? https://wiki.libsdl.org/SDL3/CategoryGPU It's like a new WebGPU
so much GPU
it's kind of like they made a better OpenGL/WebGPU, and you don't have to use wgsl
looks sorta like vulkan and directx to me
ok lemme correct myself: vulkan or directx if they were high level
right, I mean that sounds nice doesn't it?
(opengl to me is still opengl 3X and lower)
https://github.com/TheSpydog/SDL_gpu_examples/blob/979d6a6c9ecddea75ab80b07f61a826e6064e49b/Examples/TexturedQuad.c#L82-L83
so long as I don't have to keep my shaders as part of my pipeline
I don't really know how any of that works
a lot of my pipelines end up being the same thing but shader x instead of shader y and it's kinda annoying to deal with that
it looks like it's kneecapped in the same way as webgpu
modern cross-platform API with limitations from the 2000s. no thanks
if you must ship a product on desktop and consoles, it might not be a bad choice
I would worry how to do more advanced techniques I'll read about using it, there would probably be a vulkan example
that I could find
probably not for this
The key to rendering photorealistic images is to properly account for light's behavior as it interacts with the objects in the scene.
Recording my notes of chapter 11 of GEA after having read it. A great chapter. Kind of an obvious point, but I like it anyway
100 page chapter heh
Basically a broad overview of a rendering engine
I now have 58 markdown files of notes in my note book repo
I should add it too
I guess I always had the same objects and walls right from the start, so I know my way around 😅 But if I toggled those off, it would be problematic yeah
every one of my scenes is a totally independent rendering without any kind of real mechanism to know up from down, it can be really disorienting once I moved away from the original camera position
so it was super helpful in my case, and especially helpful with cubemaps to understand if I did those correctly
and it helped me debug my env map
I could see that I yet again had another LH x up related issue
I was lost until I looked at the cross and realized oh something isn't being transformed into x up
(the normals of the cubemap in camera space)
in this particular case
it's probably less of an urgent issue if you're just going with basic RH Y up as the GL gods intended
I also do not impose any kind of orientation restriction on my camera, like the LOGL one limits you iirc from being able to end up looking upside down, I don't want that
my camera orientation is unique and so is my look at, I am really proud of my camera tbh
I can easily have multiple cameras with different characteristics
I use quaternions instead of three axis vectors
the camera produces that effect that makes my shuttle not appear stuck in the center of the screen as it orients around space
I gotta stop trying to read these 100 page GEA chapters in 1 day
I got 4 left, and one of them is like 40 pages and the rest are all over 100 pages I just have to like not rush
You will be so godlike after a year
It’s just a one time fixed cost to do this and then I don’t ever have to do it again
There’s no way I could have built all this context I have now by just “doing”, books work.
I actually think I like GLSL not at all
like fuck globals
normal mapping, worked first try
first thing I did I didn't have a LH x-up issue
thank god for tangent space
or is your normal map inverted or something
also I knew to store the LH in the w for the tangent vector thanks to Lengyel even though the opengl book didnt' say to
why
how is it inverted
I am going to put the actual texture on it
it's correct the way I have it
that light is on the the side of the crater in which the light is coming from
I need a skybox on this

ok
the earth comes with a height map and a normal map
let me try that one
you know at some point I'm going to just be mostly spending time making animations, models and materials
and very little coding
I'm going to use Houdini + Marmoset for all of that
just get good at making animations at some point and using those tools
I'm not going to use blender
Why not blender?
looks good
because it's not as good
marmoset is amazing for making materials
and houdini is really amazing for making character animations
it's not that much for an individual
you can get Houdini from steam
marmoset is also really great for baking in textures
Literally my mindset 
do you use it for your project? I just am going to need a lot of good animation
I was looking at the videos for animating
houdini for animation is meh
the main thing with houdini, is that its a toolkit of 3d art tools/anims/sims/etc
yes
but not a program, a toolkit
hrm
you can animate in houdini, but blender is better at that
where houdini becomes better than blender is when you have completely cracked and complicated rig systems
because in houdini all the bones/constraints/etc are in the node view and you can connect them with formulas, math, etc. You can use it to have very complicated semi-simulated animations and fancy rigs
this is not normally useful for typical game animation
I just want really good character animations
Cascadeur is a standalone software for 3D keyframe animation of humanoids or other characters. Never before making animation from scratch or editing one has been so easy and fun. Thanks to its AI-assisted tools, you can make key poses really fast, instantly see the physical results and adjust secondary motion. All while retaining full control at...
this is probably the best
for like the npcs in my game
i know a few other indie devs using this, its kind of a cheat code for mediocre animators
its main gimmick is that it does physical simulation alongside the animations
so its much easier to animate characters that move naturally with inertia and stuff
the AI-assisted is just investors/seobait, its not really AI, it works through physics simulations and fancy iks
I see
Cascadeur has just launched on Product Hunt! https://www.producthunt.com/posts/cascadeur
Come say hi and support us there!
ProductHunt.com is an international platform where entrepreneurs share their new software, gadgets and business ideas. As soon as a new product has been introduced to the community by a "hunter", all users have the chance t...
the reason to use houdini is because you can use it for simply an absolute shitload of stuff
want some fancypants smoke particle fx? its literally the AAA standard there
want some terrains with procedural forests/roads/etc? also the AAA standard there
it comes built-in with a fuckload of scripts/tools/nodes for stuff like automatically optimizing meshes for games, baking AO textures, and processing photoscanned assets
nice
on my VR game i used it to create a set of automatic optimizer "scripts"
using those nodes from the game-tools
so for example one i had which was a win was this:
I had a cave level, the cave level was made out of massive amounts of rock meshes just placed to build the cave walls. This was a lot of objects, and a lot of tris
the auto-optimizer with houdini was conected to unreal through the houdini engine plugin, and it grabbed all those rock meshes, booleaned them all together (to remove internal faces), and then, for each of their faces, raytraced against some point of interests in the map. The faces that are found to not be visible from those points got deleted.
After that, i ran a polygon reducer, biased by distance to those point of interest (to remove some polycount), and then the final optimized mesh, wich covered the whole level, got clusterized to split it into sections so that i can still frustum-cull them in-engine
wow, how much work was that?
seems like a lot
but sounds amazing
do you have a video?
that was made in 1 hour
it was like 10 nodes
its considered "simple" for what people use houdini for
i also had a system that automatically optimized zbrush rocks. My artist made like 20 super-high-res rocks, i then loaded the 20 of them in houdini, polyreduced them, UV-d them all into the same texture for the 20 rocks, and did the AO/normal bakes, then saved it out of houding as 20 separate fbx files
that was pretty simple too
the downside of houdini is that the UI in general is atrociously bad
and its insanely complex a software
it does a lot
there is just so much to it, its basically a massive SDK for tech-art stuff, and it has five programming languages on it
there's a lot of videos and tutorials for houdini
houdiuni is so insanely massive you need to restrict yourself to a small area or its impossible
i mostly focused on the mesh/bakes/procgen stuff
I want to build small space station interiors and animate characters
for character animation i already mention you dont really want it
right
for space station interiors its def useful
you can create some semi-procedural assets that do autopaneling with decals and other fun things
there is some videos around it, lemme see if i can find it
Indie-Pixel Patreon: https://www.patreon.com/indiepixel
In this tutorial we are going to look at a technique for creating paneling designs procedurally. This is
great for things like airplanes, boats, and spaceships! Check it out!
If you are looking to download the files for the project, join the indie-pixel patreon site to get access to t...
there is a lot but this is a small example
yes just like that, thank you
I was looking at this for the animation https://www.sidefx.com/tutorials/animation-workshop/
An in-depth walkthrough of the tools, features and workflows for animating KineFX Characters that have been rigged using APEX in Houdini 20.5. You wlll start with the basics such as setting up selection sets, then move to more advanced features. By the end of the workshop, you will have the knowledge and understanding to animate in Houdini.
it looks more capable than blender to me, but I don't have any experience with it and you do
dont really recomend it vs blender and specially cascadeur
the ui is just kinda bad, its slow to use
when you are doing something like a movie, the houdini utilities become much more useful
but game anims are a very different thing
houdini still has cool things for rigs, weightpainting, and animation retargetting
but the anims themselves you are better making them in blender or cascadeur
one thing i used houdini for is on the weight painting of the vertices to the bones
blender systems there frankly are just utter garbage
its been unchanged for 20 years, literally, and it was never good to begin with
thats why you see the arms on my game characters be wonky and stuff. the weights are not set properly
I didn't notice
looking at cascadeur
looks good too
thank you for giving me all that context, I appreciate it 🙏
I had a brutal lesson in what -1 from a uniform location means today
and also I hate not being able to use bindless with renderdoc
I thought what -1 meant was that it couldn't find the uniform
and that's kind of what it means, but what it does is if you don't use uniform get rid of it, so me staring at my fucking shader, looking at the uniform
seeing it is there
and getting a -1
well
I learned to check if it was actually being used
after some misery
ready for vulkan
and validation layers
vulkan man, take me by the hand
ok height map added
mf is really going for the actual "Foundation", building worlds 😛
this is super cool already
thanks!
hey that's super realistic I don't think you've been to space
yeah I think the moon is so tiny and far away from the earth
I mean in real life
I have to share some of these in the zig game dev channel so they don't think I'm a scrub
I mean I am
anyway, back to more GEA I guess lol
moon is 280kkm away, and the earth diameter is ~12kkm
23 times the earth diameter is the moon away from earf
wesome
crazy how those numbers explode when you goto mars or further
play in the sand
280K km
not a place you're gonna want to forget something important when you leave
hehe
yeah
to the moon and back is not THAT terrible
i believe its 2-3 days per trip
mars is 3 months or so if the planet is close to us
or 6 months?
I really like looking at trees
like seriously
looking at leaves blow in the wind
you could bring a bonsai 😛 and a fan
i know i know
it is a cool idea
but that's a one way trip, I'm sure of it
the first people going aren't coming back
I think that's with minimal fuel expenditure
ye and we wont be having cost effective travelling back and forth on big shipz
mankind will destroy itself before that is going to happen
Maybe it'll be terraformed some day
New fauna etc.
Could be interesting
Probably
that would be cool
yeah
I should build a gltf importer
tired of not having one
maybe take a break from reading just to get this
the next GEA chapter is animation anyway
hard to do any animating without some kind of animation thing
this is just going to delay vulkan though
maybe I power through the CGPOC book
CGPOC, vulkan, gltf, finish GEA and the rest of the books
I got to get out of this GL hole
none of the things you mentioned are going to run away 🙂
right, it's more about making progress on original goals and not leaving sight of them
but I guess with learning comes new information which can result in different decisions being revisited
and i also liked the funny looking blocken game thing before with the funny enderman-like people 😄
man I had no idea what I was doing, amazing how much progress I made
thats unbelievable
I could probably build a lot of that now in much less time and it would be way better
I think literally everything was in its own coordinate system
hehe
i feel quite the opposite these days
when i saw the planes thing on those screenshots i shared the other day
i was like wtf, i made this
i dont feel as capable as i was, its weird
it's still all there!
my thing is, I have done the jump around project thing, it doesn't lead to anything, I want to have something to show for my spare time
perhaps a reboot of blocken
that's the real goal, just to have something to point to that I did that I'm proud of and is worth showing off
nah I am going to build my little robot escape game idea
when you land your ships from space on any planet hehe, you get that blocky world or so
ah
no more open world voxel engines for me
you got like three of these types of voxel game community threads active on this server
i will support any idea you have
vulpengine, horde engine and project ascendant
don't need a blockens engine lol
their tech is so amazing
: )
perhaps you can make the enderman like person live in the new game though, he/she was really cool 😄
oh yeah for sure
the game idea I have is an obsolete old worker robot on a space station trying to escape reclamation
the maps wil sort of be like original Doom maps, though without having any combat capabilities, just puzzle solving and trying to get away from traps and things chasing you
ah thats a cool idea
I really want to limit the scale to be achievable
just build one level at a time
focus on gameplay without making any of it look good at first
the robot needs to reach the emergency capsule of sorts?
I think the idea is that throughout the game the robot becomes to care about more than just their own survival
and that escaping the end result is not really possible
spoilers sorry
the end cannot be avoided, but perhaps it can be made more meaningful
i see
like side quests to help others, multiple story lines, but all in a small game that's easy to make
im looking forward to play : )
me too
the problems I had in the last week and yesterday with uniforms and textures has really pushed me more to try out Vulkan. I have to load so many textures now, with cubes, height maps, normal maps, shadows and multiple objects and with bindless it's trivial, they just work, with non-bindless holy shit. I think if I was just not doing bindless this would probably be less painful than trying to maintain bindless and keep renderdoc working, and my issues with uniforms, which cost me like 3-5 hours yesterday, mostly to learn how uniforms in GL actually work, was brutal. I'm not making an argument against GL I just want to try validation layers and live the bindless life fully
it's also just a problem with how I wrote some of the code to be generic which I am just not going to do that anymore
no more generic code, everything will be hand crafted to the scene. I will want some shader building templating tools though to avoid code duplication, but I rather have duplication than some kind of generic shader generator that just causes more work in the long run everytime I want to do something new and different
we'll see maybe I end up hating 
ok ok back to work
: )
a year ago or so
before that actually, because i got that rtx4070 a year ago pretty much
but before that i didnt have any bindless support, so i was forced to be a bit smort about my shit
and shedding a bike is always fun 🙂 i setup various texture2darrays for all my textures
and sorted all of them into buckets, one per resolution
and had an ivec2 pointing at and into the bucket
i think i used 8 texture2d arrays, to cover resolutions from 4096 down to whatever there was 32x32 or so
hrm so for one texture you had multiple resolutions? is that to save gpu memory?
I have just been loading the full resolution and mipmapping but these are just simple learning scenes and they don't exactly load fast when I load 8k textures
and big 3d models all blocking on the main thread
I got frames that last like a good few seconds atm :D
I'm just focused on learning the graphics techniques
ohh
some where 1024x1024 some were just 128x128
with their dimensions i knew into which bucket they go when i upload the pixel data
I was looking at some zig packing libraries a while back
with packing i dont mean packing textures into an atlas
but that would be yet another option
that one is not zig obviously
I understood it just made me think of packing though, packing probably doesn't always make sense
or reminded me of it
hrm
ah
packing is a tiny bit tricky
not the packing itself, thats somewhat solved
but whether you leave some space between the tiles or not
oh right
where did you share these btw? I didn't see this
uh good question
i keep forgetting where i post shit
i think i abused Jake's post
or lofty lagoon 😄
lofty lagoop
#1126099727621046332 message
apparently it was splitscreen 😄
2 people could fly around at the same time
using the keyboard hehe
the same keyboard?
that's really cool, this is with delphi?
are those mountains geometry?
how did you render those
I love this color scehme
haha no 😄 thats supposed to be a sky cube, but the cube was just a big ass box, not a proper skybox
i think that was the stock win2k colorscheme
ah but all the color gradients were custom
i was inspired by that other engine, i keep forgetting its name, not leadwerks but something similar, froyok will probably know 🙂
yes?
how do you install AOL on that
Ahead of Linux
win95, win98, win98se, winme, win2k, winxp, winxp64, vista very very briefly, win7, win8, win81, win10
the full tour
ye, win11 only for work
ah no, my pc has a win11 partition too
win8 was not any badder, tbh, the only weird thing was winrt apps and the menu, but i didnt mind really, i hardly spend time in the menu to be upset about not being able to see the bloody wallpaper
I feel really old suddenly
I logged on to BBS
my dad had a work computer which was like a mac from Olympia where he worked, a german computer company
BBSes are so cool
this was like the 80's
Olympia-Werke AG was an important German manufacturer of typewriters. Since the plant in Roffhausen near Wilhelmshaven was closed in 1991, only the brand name has survived.
uh thats cool
i miss the old green and amber phosphor CRTs
ah speaking of pcs
i was also exposed to apple hardware
not the first ones, but shit that existed in the 90s... i remember apple powerbook 150 something
and two or three different powermacs for desktop
256 colors and flat crt somehow
macos 4, till 8
and some cool games... Loom, Hellcats and Shufflepuck
yeah, like the BRRRRRRRRRRRRRRRZZZZT degaussing sound when you switched them on 😄
the loudest thing I ever had was the zip disk
it had like a really loud physical clicking sound
i always wanted one 🙂
they were awful
yeah
i think i eventually got one right before nobody would use them anymore
and never used it for anything either
it's good, because you would have lost whatever you stored on them
unlike the CD and CD-R drives 😄 the early burner drives with special caddies
the failure rate was ridiculous
Click of death is a term that had become common in the late 1990s referring to the clicking sound in disk storage systems that signals a disk drive has failed, often catastrophically.
The clicking sound itself arises from the unexpected movement of the disk's read/write actuator. At startup, and during use, the disk head must move correctly and ...
man I wish the minidisc had taken off
I saw minidisk players in japan when I was stationed in okinawa and wanted to get one, seemed like they flopped as soon as they arrived
yeah
i wanted one back then too, and much much later, like 10 years ago or so i tried to see if i can get some second hand or so
but they are too expensive 😄
I am not surprised, floppy disks are expensive too now
there is 1 guy left on the planet
who keeps buying all stock when possible
and from him you can still buy packs of floppies
:|
airlines buy from him too 😄
that's a cool business
i think its a german dude, old fart
I'm glad my flight's safety is in the hands of floppy disk technologies
and the subway in NYC too
I have a ton of em, you need some? 🤣
: )
there's your retirement fund, pure gold
I'm making my own little stb_include I'm so over my awful shader situation I just want include and defines, it's going to start of being really basic, a new executable in my build.zig
even at a most basic level it will be 100x better than my current situation
Glsl supports defines already though. You don't need custom preprocessor for it
#include tho you'll want it. It's really nice
i suppose bjorn was saying that he will write his own because zig cant wrap headers only? or can it?
No clue but in glsl code you can happily define. ifdef if defined etc
That stuff works. There's also an extention for native #include but I wouldn't rely on that
yes thats out of ze question
I've tried it and it does work but mann
yeah I don't want those
I want to be able to see the compiled shader source as it will be linked
it's nice those are valid GLSL though because I don't want my template system to break the GLSL syntax highlighting
I'm basically going to overload define and include to mean what I want them to mean for me
I don't know what wrap header only means
The way I do it is I just have a section of defines dynamically generated for the stb include
yeah I am basically going to make my own stb include to avoid the Cisms of it
I mean it's already in progress
I probably will as well since stb include isn't actively worked on and doesn't support the features I want anyhow
I am going to get rid of stb_image also by just using gzipped bmps
and then stb_perlin I want to remove also with a simple noise function, I barely use it
I think my dependencies will just be vulkan sdk, vulkan memory allocator, and vulkan zig bindings and SDL
SDL has audio that's good enough if not something else, and idk how far I can get without something like jolt or bullet
I am going to write my own glft importer
Crazy
why?
it's a pretty straightforward spec
just json with some binary blobs at the end
Not actuslly crazy. I'm just losing my mind.
Like all of what you said there is reasonable
taking me a bit, my actual day job is basically a 24 hour a day job at this point constantly interrupting my life, weekends, nights and evenings, every day
I got this far today
$ zig build fssc -- --source .\src\foundations\scenes\cgpoc\chapter10\surface_detail\earth_frag.glsl --name earth_frag_improved --output .\src\foundations\scenes\cgpoc\chapter10\surface_detail\
Starting compiler.
args:
--source .\src\foundations\scenes\cgpoc\chapter10\surface_detail\earth_frag.glsl
--output .\src\foundations\scenes\cgpoc\chapter10\surface_detail\
--name: earth_frag_improved
file path C:\Users\swart\projects\foundations\.\src\foundations\scenes\cgpoc\chapter10\surface_detail\earth_frag.glsl
numbytes: 836
Found 1 includes.
src/foundations/shaders/f_calc_new_normal.glsl
Compiler finished.
so close
What is your day job btw?
inb4 keeping frogs out of nuclear launch sites
I am a tech lead for an engineering team at a security/identity/access management startup
well we don't provide single sign on as a service, we just help you manage access to your employees and review that access
like automatic onboarding
and compliance stuff
ah so more like HCIM/HRIS
human capital/human resources stuff
it's more security and compliance, it's super cross team stuff
like IT, HR, security
i see
so we have customers who operate at IST time
good, its not workday or icims 🙂
and that's been keeping me up
well we have a workday connector
and also we have potential customers we're trying to make successful and convert to paying customers and that requires being super responsive at any hour
oof
Rough
There's pros and cons to working for a giant corporation
But at least my schedule is pretty stable
yes, I have been working at startups my entire career except when the startup was acquired so had a couple of times I ended up at a large corp before going to the next startup
I really don't like working at big corps
it's hard work at startup, but everything you do matters
there's no working a year on something that never sees the light of day
my compiler works
I can't use it yet, because I need it to generate both a bindless and non-bindless version for when textures are present and I am so over this
having to worry about both bindless and not
you know
I'll just have two source files for now I don't care
I am going to go vulkan soon
I am going to just add my shader compiler to my zig build as a build step command and it will build my shaders automatically
So I have both an executable i can run at will or just import the code the binary uses as part of the build
Just zig things. When your build system is the same language at your application source code
I haven’t built a non-zig target build step before so will have to look that up
Or maybe run it as a comptime tool?
I can just string replace the bindless layout with a texture unit number thst increments and not actually write the output
Embed both versions
I hate non-bindless
const needle: []const u8 = "layout(bindless_sampler)";
const needle_len: usize = needle.len;
pub fn replaceBindless(
bytes: []const u8,
locations: []const usize,
) !struct { bytes: []const u8, loc: usize } {
var buf: [50]u8 = undefined;
var linesIterator = std.mem.splitScalar(u8, bytes, '\n');
var loc: usize = 0;
while (linesIterator.next()) |line| {
const replacement_buf = " " ** needle_len;
if (line.len < needle_len) continue;
if (!std.mem.eql(line[0..needle_len], needle)) continue;
const replacement = try std.fmt.bufPrint(
&buf,
"layout(binding={d})",
.{locations[loc]},
);
@memcpy(replacement_buf[0..replacement.len], replacement);
@memcpy(line[0..needle_len], replacement_buf[0..needle_len]);
loc += 1;
if (loc == locations.len) return;
}
}
for making me write code like that
I think this will work
it's close to something that will work
once this works I don't have to worry about non-bindless too much anymore though
this has to be the worst code I have ever written
anyway
back to rendering stuff
the code isnt bad if it works 
you know what I was thinking was
what if I wanted to update one of my structs, that's in like every shader, my camera struct
I would have to update every shader
this situation is better now mostly
I am doing the compile still at runtime because I wanted to see how that worked it worked well, it is slower though, but I can actually update my shader code now without rebuilding
Ah I thought you were referring to the interface structs
like the data you pass into the program
the thing I built is both an executable and something I load in as run time
I meant the ubo ssbo structs
not yet
Don't the inputs have fixed layouts
yeah those I couldn't update without rebuilding
I want to get to hot reloading
zig doesn't have translation units like C++ or C
you have to like intentionally create a translation unit
I mean there are TUs, but it's not at all the same
so excited about how nice it will be now to write lots of good shader code, reusable and everything, no more worrying about bindless or application code getting in the way
I'm going to write some right now
I am tempted to try Vcc or some of those new fancy shader things but I think they're not ready yet
what's a Vcc let me look hrmm
gob's experimental C++-to-SPIR-V compiler
ohh I see
yeah zig has zig to spirv
I can't use it with gl as I understand it, it mostly just works in compute atm iirc
I started using stb_include as of a couple months ago for my more complex foliage pipeline stuff and yeah shader includes are very handy
it's also experimental
yeah if I were writing C or C++ I would use stb but I'm trying to get rid of it in my zig
it's too unzig like
ah
I got all these tools now, I make a new scene, I add a camera, I add my little axis cross, boom stuff shows up, it's nice
a lot of work already put into this
a little bit of boiler plate for each object I add, I'll have to make that better
I need more of a callback thing
define callbacks on my objects instead of dropping the functions in my scenes or something
and people say C++ is unreadable
it's pretty readable, you're just not used to it!
I think C++ is readable though 🤔
yeah I was just joking I can read it if I go through it carefully
I think ruby and lisp is unreadable
after all this time I can just look at C++ and basically instantly see what's going on
give me curly braces or give me death
my zig is not good zig, also that code doesn't work, I just wrote it thinking it would work
the gist shows what actually worked
and it's nothing like what I initially wrote
I was not close :/
the gist is much worse
I like being able to return anonymous structs
all these splits and shit in std.mem are immutable and I'm trying to write to these things so I don't have to allocate memory weirdly
man what if we just had a C++ 2 that ditched a lot of the compatibility with C and older versions to just fix up some things and make it a better lang
no D has a completely different syntax
I'm sure someone uses it
Circle with some of the features enabled that fix old cpp shit is kinda that
trying out a hardware tessellator thingy

oh I wonder what it looks like in renderdoc
you dont need all that layout(bindless_sampler) bs
i suppose you usually dont pass individual bindless handles via programuniform64nv
you stuff texturehandles into a boofer and make use of the int64_t extension, which you can just enable
and then texture(sampler2D(material.base_color_texture), v_uv)...
yeah
cool the mesh viewer is useless
maybe I need a more complex tessallation thingy
texture(sampler2D(material.base_color_texture), v_uv)...
I like this
I already have a materials buffer
so that makes sense
that ain't going to work with uh renderdoc though I think?
ok checking nsight then going to bed
it will work in renderdoc
but
not for bindless handles, remember
the "good" thing is
64bit texture handles can be represented by a i or uvec2
and a i/uvec2 you can use to address texture atlasses as i described ages ago
ah
you have resolution based texture2Darrays, lets say 8 of them
where each represents a fixed resolution, from 32x32 up to 4096x4096, that should cover most if not all texture needs
right I remember you saying this
and then you use the uvec2 to texture(u_textures[uvec2.x], uvec2.y, v_uv)...
the only caveat is the spooky nonuniform access bs, where you would need to employ a bit of shader magic, if you searchbox-text for NonUniformIndex
hmm actually im not sure on the stuff i just removed
its pretty much the same
you get another parameter you have to pass into the sampling function, for texture2Darrays its just the layer
yeah they seem like a nice way to just send a whole bunch of textures in one buffer and then you only need one sampler? that's cool
I think I get it
so you don't run out of texture units and have to manage them
potentially there could be a problem, now that i think about it
SAMPLER being the key here 😄
oh is it doing like bilinear sampling across the textures
perhaps your scene requires more than one specific sampler (min/mag/warpR/warpS)
then you need a bit of permutation galore, or you split your draws across those
but even finking further, perhaps the idea of encoding textures like i just described makes no sense at all for that sort of thing, and you are perhaps fucked when you need more than 1 sampler
samplers can be "embedded" into texture objects directly, thats what the whole glGenTextures+glTexParameterx... does... or you can have them separated... texture objects (glcreatetextures+glTextureStorage) and sampler objects glCreateSamplers+glSamplerParameter... and setup min/mag/warpr/warps there
so much I don't know :\
I am going to bed gn some more tessallation tomorrow I think
oki 🙂 🇬🇳
i keep thinking out loud for another minute
you still do glBindTextureUnit... as usual with texture2darrays
and if you split your draws across different samplers because you need one cube nearest filtered for some reason, you can just draw that cube then with glBindSampler(...the_sampler_with_nearest_filtereing) and keep the rest as is
materialindex is encoded into your instancedata ubo/ssbo perhaps
// vs
layout(index = ...) flat out int v_material_index;
...
layout (binding = 0) uniform GlobalUniforms
{
mat4 ProjectionMatrix;
mat4 ViewMatrix;
...
};
layout (binding = 1) buffer readonly InstanceBuffer
{
mat4 WorldMatrix;
ivec4 InstanceData;
};
void main()
{
GpuInstance instance = InstanceBuffer.Instances[gl_DrawID];
v_material_index = instance.Material.x;
gl_Position = p * v * instance.WorldMatrix * vec4(i_position, 1.0);
}
// fs
uint NonUniformIndex(...) {
// searchbox find that function... look for BayBoyKiller's thing
}
...
layout(index = ...) flat int in v_material_index;
...
struct GpuMaterial
{
vec4 BaseColor;
vec4 BaseFactors; // xyzw = normal strength, metalness/roughness factor, emissive strength
uvec2 BaseColorTextureIndex;
uvec2 NormalTextureIndex;
uvec2 ArmTextureIndex; // arm = ambientocclusion/roughness/metalness
uvec2 EmissiveTextureIndex;
};
layout(binding = 0) buffer readonly MaterialBuffer
{
GpuMaterial Materials[];
};
layout(binding = 8) sampler2Darray u_textures[8];
void main()
{
GpuMaterial material = MaterialBuffer.Materials[v_material_index];
o_color = texture2D(u_textures[NonUniformIndex(material.BaseColorTextureIndex.x)], material.BaseColorTextureIndex.y, v_uv);
}
for the bindless path you can reuse the texture indices as handles and just sampler2D(...) them
i think i would also have 2 physical fragment shaders then, one for bindless and one for nonbindless and not do #ifdef magic, since im controlling that from my cpp code anyway whether i support bindless or not
I like that setup, a lot. I don’t have anything that fancy. That’s a nice structure.
i just noticed the instancebuffer thing is wrong up there
struct GpuInstance
{
mat4 WorldMatrix;
ivec4 InstanceData;
};
layout(..., std430) buffer readonly InstanceBuffer
{
GpuInstance Instances[];
}
Hey bjorn, what brands do you test on?
What type of brands do you mean?
AMD and NVIDIA are the most important ones to test on tbh
Not testing on AMD, especially with vulkan, is signing up for disaster
that applies to OpenGL as well
there is a lot of shit nvidia silently will just accept, which intel/amd dont
As long as it works for me I am good
In the off chance someone would want to run something I make it will always be MIT licensed and on GitHub but I am not supporting that use case
I don't want it to be broken on amd though tbh, I just don't have the hardware to test it on right now
yall if I get a linux machine will it actually work, or is linux still a meme
like will I be able to print stuff on a printer out of the box, can I copy text from one app to another, can I like install vs code and run my sdl vulkan app and it just works
we are all here to help 🙂 and we have different hardware too
i dont use printers anymore, so i cant tell, but everything else you said works
that's good, that's all I need then
printers are supposed to also work, especially older models
all I will do is use a browser, a pdf reader, and vs code
I am going to use DCC apps on windows, like Houdini, Blender Marmoset Maya whatever
blender works on lunix just fine too
linux distros can be daunting though
perhaps get a spare sata3 ssd, plug it in and install 2 or 3 different ones - at a time - on that one and then boot menu into that one, dont dual boot
I use linux for my dev server at work, a mac for where I code, all because I have to
yeah I don't want to dual boot
I will have a windows desktop and laptop still, this is just an extra linux amd laptop
i have windows on a dedicated ssd, linux too and games on a shared nvme
i use the bios boot menu to chose what to boot
yea
i stay away from wayland, its not ready yet, i think
getting back to writing some code
going to make this more interesting
it's just so much easier to write shaders now, man that include thing was worth the time I spent on it jfc
I was so miserable with my app shader abstraction
NURBS generator 2024
what's a nurbs
I'm just following the example in the book, this is a bezier surface
its splines spanned across a surface, with control points
It's like bezier surfaces but more general
yeah this has control points, and it's a tessellation shader ya
hehe
it was gluNurb back in the dark ages not just glunurb, also glMap/glMapGrid, glEvalCoord/glEvalMesh and friends
gonna put a texture on this 😅
crazy how much fixed pipeline crap is in opengl 😄
they had to do all that before stages were programmable yeah, and they're like lets stop adding more and let people just write these things themselves
yeah
what's a good place to find free textures?
my notes are terrible I remember Jake shared something and I wrote it down but I can't find it now
thank you!
the first one requires a license for commercial use, but he sells them for very cheap
free for non commercial uses tho
yeah this is just for my little learning scene here
the texture in the book is too low res
yeah you can get pretty good resolutions stuff at all these places
thank you so much!
ezpz
and works in renderdoc pretty much automatically with no extra shader or heartaches 
when you inspect stuff in renderdoc (or any other api debugger)
keep the events on draw/dispatch/clear/blit focused
everything else in between is somehow in between and might not show the ackchual state
opengl is a state machine, and you prepare state for actual draw/dispatch commands
with glEnable(GL_THISORTHAT), glCullFace, glWhatever, glBindThisAndWhatnot
it's np
right, I do when I'm debugging the data, I just wanted to see the texture load
i also seem to be typing words which i didnt mean to type sometimes, idk whats wrong with me
I understood
to see if the texture loaded there is another simple trick
label your shit, with glObjectLabel
and then when capturing make sure to select "Ref All Resources" or something, and then you can just go into View -> Resources, and find it there, you will also see then where its being used
thanks
debug groups is another thing, yeah, handy for grouping your commands as a visual aid in the debugger
I don't render a lot in these small scenes
thats ok
but I should use them to get used to it
but if you have stuff like "depth prepass", "geometry pass", "resolve geometry pass", "ao", "idkwhatelse"
right
not a must ofc, but its handy 🙂
Recorded live on twitch, GET IN
Guest
Casey Muratori | https://x.com/cmuratori?ref_src=twsrc^google|twcamp^serp|twgr^author
My Stream
https://twitch.tv/ThePrimeagen
Best Way To Support Me
Become a backend engineer. Its my favorite site
https://boot.dev/?promo=PRIMEYT
This is also the best way to support me is to suppo...
this is a great video
instruction cache misses are an interesting topic
anyway
back to tessellation
that's an unfortunate thumbnail though
#1147711082702589973 has competition
Moon level DLC
Are the colors from normals or purely from a texture
Yeah something is strange
wait a minute
do you have an actual heightmap or are you just using the color map as the height
that would explain why both look wrong, it's making one side of the crater a ridge and the other side a valley
Go grab a proper displacement map
oh for this example the book has just the color map
but for the next it has a proper height map
I'm just following along in the book
that nasa site is great
let me try this next example in the book
this example only has the one texture, the next has a height map, a normals map and a texture
cool
your moon looks fantastic though
Yeah ignore me then you'll get the correct results later
that's the heightmap
Actually maybe it's a normal map I forget
yeah it's a normal map
I differentiated the heightmap to get that
Or rather calculated the normal on it
Because it wasn't a very subdivided sphere it was rather coarse actually
no tesellation
ah
it looks just amazing though
the moon is pretty
Rosy wants me to pay attention to her instead of the moon though
Looks more like volumetrics to me
It's literally just a sprite on the screen lol
looks super
simple and effective
(Godrays are technically volumetrics)
opened gimp > 2048x2048 black image, filters > supernova and then played with it and added a bit of dithering until it looked good
The magic part was using a GPU query of the number of passed samples of the sun disk to decide whether or not to draw the sprite
that's why it hides when the sun is occluded
One of those outrageously simple and effective smoke and mirror hacks that can make some sweet looking graphics
it works really well here
alright back to moon stuff
