#Foundations - Learning Graphics Programming with the Zig Programming language
8815 messages Ā· Page 9 of 9 (latest)
current progress
idk
I'm going to work on the fresnel thing next
then add caustics and then I think I need to fix the noise a bit maybe
you need some underwater trees too
it's a pool
maintained by a highly paid pool professional
if I find a tree they are getting fired
yeah
the cloud reflections look weird imo
ohhh
that's right
I forgot to make the waves affect the reflection and refraction textures
yeah
let me do that first
thanks!
I should have made a todo list
thank you uh Jeremy Clarkson, and big fan of Top Gear btw
sorry about how it ended though
oh well he deserved that punch
we all do
hahaha no but I am a big fan of the show, too
just recently got a VPN so I can watch it properly over the bbc streaming site
from season 1 to season 22
nice, it such a comfort show, just turn off my worries and watch something about cars
ye make some food and just watch one episode
season 2 is a little boring still and there's a few things why I wouldn't have watched the show back then
but the more unhinged news and specials later on should be much more interesting
nice
Going for a walk again
ok let's fix these textures
I would tone down that specular pattern personally
It seems like your reflections are already sort of handling that through more physical means
the book adds even more of that with caustics
maybe I just add those on the floor
caustics are different
The white specular stuff on the surface is basically mean to just mimic sunlight or the sky reflecting off the water but you already have that
I was thinking it does make sense to have a different light all together for under water
right now I am using the same light and I don't think it looks accurate
I will try that after I add fresnel
I think I will have to make changes once I see the fresnel effect
like a bunch of changes
I think I'm close though
maybe even done tonight? that would be cool
been working on this for three days now
my scene doesn't look anywhere near as good as the screenshots in the book unfortunately
fresnel, I also made a change the book doesn't have that reduces the tile distortion the closer you get to the surface
idk I'm going to add caustics and call it, if those look good
I do actually want to add a second light
I think the fresnel effect is pretty cool though
pretty cheap and easy to do too
yeah
I noticed that too, I'll look at it after caustics, the little bit darker underwater light looks nice
it looks way better without specular on the surface good call btw
haven't fixed tiling nor added caustics just messed with the lights
discord probably hates how much I upload
oh one of the edges not being distorted was a bug
I wasn't applying the the distortion to one of the conditions
so worried it was a problem with the noise texture but that didn't make sense
the caustic in the book does not work for me
hrm
I think I would need to generate a different noise texture
that's with the tile distortion fix
whatever
I learned a bunch, I got value out of this, I'm done with it.
Donāt worry, Iām probably worse when I upload stuff
it makes for a nice new screenshot on my repo if nothing else
I got a nice collection of screenshots now https://github.com/btipling/foundations
I alright I'm going to finish writing my chapter notes and then it's just like ray tracing for the rest of the book whatever that means
I never ray traced before
oh and it uses compute shaders which I never used before either
hrm
For after switching to vulkan ^^
Current plan:
- Two Ray Tracing/Compute Shader chapters
- Move to vulkan
- gltf parser to custom format
- Deccer cubes
- GEA animation chapter
- Add animation support to engine
I think ray tracing could take +1 week
Vulkan probably at least a month, probably two
Moving to vulkan also means moving to SDL3
I hope not more than two months
I think inverse depth as part of move too because normal depth is terrible
Itās gonna be gigabarrier shader object vulkan too so should not be too hard tbh
I will just add the layer fallback for shader objects
And it will just be slow for linux
Just moving all the scenes will be a lot of work
y tho
Why SDL or why SDL3?
I just read that SDL works better with vulkan idk
SDL 3 because why not itās just a hobby
I only plan to use SDL for window and maybe audio
I am currently using gltf
I guess I worded that in a way that implied SDL v3 was necessary I didnāt mean to say that
vulkan is windowing system agnostic
most window libraries interface really simply
because there's no weird window context to bother with
and using direct platform windows is simpler than gl because all you need to do is create a surface with the window handle (plus display/connection depending on which windowing system (win32, xlib, xcb, ...)) as an arg
Ah nice
I use glfw with vulkan, it's easy as fuck, definitely less library involvement than GL (literally 1 function)
same with gl, but with gl you have 3 or 4 glfwInit calls to do hehe
i wouldnt bother with manual window system surface bs ala xcb/win32 et al, just use glfw or sdl
yeah
In SDL3, SDL_AudioStream is the backbone of the entire audio subsystem.
looks good
idk if it sucks I'll use something else
you mean - sounds good - š
hah
maybe I can just steamroll this ray tracing stuff in one day
jk
but maybe
I tried using zed for like 5 minutes yesterday and it was not very good
so sticking to visual studio code
hey I did a compute shader thing
I wanted to get more done today but had an unexpected work event due to a daylight savings bug in code I wrote years ago causing a massive incident
I scheduled jobs to run in at specific time of the day via some golang time API calls with some logic to set it in PST because one of the jobs sends a daily email to our customers, the job scheduler takes time in UTC and what it should have done is set itself to run in 24 hours after it last ran but because of some go implementation details the time math ignores time zone and it set the job run for the current hour of the current day, repeatedly, for hundreds of thousands of runs
thankfully we don't send that email on sundays
but the amount of work it did broke everything
it apparently did this last year too but we didn't notice it then
So trying a change
Timebox my graphics programming on weekdays to like 8pm
So I can like do other things, like exercise and read a war hammer 40k book and get sleep so I can be good at my job
Anyway read a section on ray tracing today, tomorrow I will write my notes on the section and then start doing the scenes for it
I also left a bunch of discord servers. Probably going to be mostly not active on the main zig discord anymore. Hasnāt really been interesting since the zulip split
whats that
Zulip is a chat app like discord
oh
rip
The zulip is more like a dev mailing list than a chat
I lurk but since I donāt work on zig I donāt have anything to add
mailing lists 
Zulip is basically if every discord chat room was thread mode
im with a team who uses it for development and its pretty great
you can actually split stuff into the threads when it goes offtopic so its far better than something like slack
Yeah it makes sense for a dev chat
Looks like Freya HolmƩr and Andrew Kelley will have a talk at handmade seattle in november https://handmadecities.com/seattle/
I will be there
finished writing down notes for the ray casting section but only got so far as setting up the basic scene, not a lot of time available when I'm calling it at ~8pm every day
will probably have something on there tomorrow
it was magenta, but now it's red
why is it red?
because I wrote to it in the compute shader to be red
nbd nbd, but new for me
nbd?
no big deal
I don't like writing GLSL and having to wait for the shader to fail to link a bunch of times because of all my typos
looking forward to using a spirv compile target
I read that before and forgot about it thanks
ok I have the vulkan sdk so hrm
I actually think this won't work for me
because I am concatenating my files with my own deal atm
although not the compute shader so nm
the most useful linter
yeah I wish it printed the actual error somewhere
or maybe it does and idk where
it took me a while of messing with the arguments to understand how to make glsl lint work
I installed the wrong extension
I disabled it's not useful right now
although this really sucks right now
writing this much GLSL really sucks
maybe I can just do this on the command line instead of this terrible vs code extension
you can invoke glslangValidator yourself
yeah
$ glslangValidator -S comp -C .\src\foundations\scenes\cgpoc\chapter16\ray_casting\img_1_compute.glsl
.\src\foundations\scenes\cgpoc\chapter16\ray_casting\img_1_compute.glsl
ERROR: 0:24: '' : syntax error, unexpected IDENTIFIER
ERROR: 1 compilation errors. No code generated.
š
what's on line 24
an intentional error
just to test it
just asdf
I'm going to use the .comp.glsl for autodetection I guess
I learned a really hard lesson today about zig structs and GLSL struct binary compatibility
I traced a circle lol
I did get the extension working ok though
well it should be fast moving going forward jfc
I would have figured it out sooner had I just checked renderdoc right away
Nice progress!
alright let's see how far I get
this going to take me a month at this pace
holy shit this linter is saving my life right now
it would be funny if I added that testimonial to the blog post
I think it just would be a complete non-starter to do any kind of ray tracing without a linter, it would just be me crashing the app for a long time fixing all these errors
and now I have red squigglies
it's like I went from a plain text editor for glsl to an actual editor
man I couldn't imagine writing this much WGSL
that's the power of linting
it's crazy though I have 3D in a 3D
reminds me of how factorio casually flexes its clean architecture by rendering an instance of the game inside itself for tutorials
instead of just playing a video
the factorio devs are on a whole other level
yeah it's really incredible how stable that game is
I guess the game design kinda lends itself to that
like the devs are able to thoroughly unit test the mechanics
maybe they have integration tests that run the game within the game
A capture of our test process running with Graphics enabled over 16 threads.
well there you go
I think this is just 16 instances of the game running on different threads, with each one running a portion of the tests
I think after the ray tracing, the Vulkan switch will just be a new project
zig -> c++ experience is horrible lol
specially when you got the incredible vulkan-zig library
Yesss join the c++ side 
Idk I would miss zig a lot.
Still thinking about it. I have a few weeks to go at my current pace
Maybe Andrewās talk at Handmade Seattle will set me straight. Really looking forward to it
Would be nice to see a bunch of the zig people I met in Milano
The zig developers are great people and really smart
I am just keep going with this project I put a lot into it
i can give you access to my top-secret vulkan game if you're interested 
importing vma and meshoptimizer has never been easier 
// VMA
const vma_lib = b.addStaticLibrary(.{
.name = "vma",
.target = target,
.optimize = .ReleaseFast,
});
vma_lib.linkLibC();
vma_lib.linkLibCpp();
vma_lib.addIncludePath(vulkan_headers.path("include"));
vma_lib.addIncludePath(vma_dep.path("include"));
vma_lib.addCSourceFile(.{ .file = b.path("src/c/vk_mem_alloc.cpp") });
// VMA translate-c
const vma_translate_c = b.addTranslateC(.{
.root_source_file = vma_dep.path("include/vk_mem_alloc.h"),
.target = target,
.optimize = optimize,
});
vma_translate_c.addIncludeDir(vulkan_headers.path("include").getPath(b));
// MeshOptimizer
const meshoptimizer_lib = b.addStaticLibrary(.{
.name = "meshoptimizer",
.target = target,
.optimize = .ReleaseFast,
});
meshoptimizer_lib.linkLibC();
meshoptimizer_lib.linkLibCpp();
meshoptimizer_lib.addCSourceFiles(.{
.root = meshoptimizer_dep.path("src"),
.files = &.{
"clusterizer.cpp",
"indexgenerator.cpp",
"vcacheoptimizer.cpp",
"vcacheanalyzer.cpp",
"vfetchoptimizer.cpp",
"vfetchanalyzer.cpp",
"overdrawoptimizer.cpp",
"overdrawanalyzer.cpp",
"simplifier.cpp",
"allocator.cpp",
},
});
// MeshOptimizer translate-c
const meshoptimizer_translate_c = b.addTranslateC(.{
.root_source_file = meshoptimizer_dep.path("src/meshoptimizer.h"),
.target = target,
.optimize = optimize,
});
...
exe.root_module.addImport("meshoptimizer", meshoptimizer_translate_c.createModule());
exe.root_module.addImport("vma", vma_translate_c.createModule());
exe.linkLibrary(vma_lib);
exe.linkLibrary(meshoptimizer_lib);
directly from the source repo
.meshoptimizer = .{
.url = "https://github.com/zeux/meshoptimizer/archive/77aaa4a03cd27a6164ccc8e490ab41a11f9427a3.tar.gz",
.hash = "12201e8f93fa2a54ef7d10becb8b3003e94f18426ff2a79eb2bedd96c182d677960a",
},
.vma = .{
.url = "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/archive/e1bdbca9baf4d682fb6066b380f4aa4a7bdbb58a.tar.gz",
.hash = "1220e856fea9dfab826220a1155dd267a621dfa5fea0f9766f9f7a61802bd5ad477c",
},
you should use c++ tho. because the grass is always greener on the other side
I am not a member of the orthodoxy. I am always trying to make choices based on evidence and goals
I think keeping going is best for now
ah i didn't mean that lol
I know I am joking 
it's just that zig gave me such a good taste that nothing can replace it for me
I have never been as productive as I have in the last year with zig tbh
My GitHub history has never been so green
I was looking back at my GitHub projects and this is like my third or fourth attempt at game dev in the last 15 years and itās the first time it has stuck
What kind of game are you making? You will put it on steam?
top-down medieval likely. hopefully lmao
it's super early rn
Nice
currently just a gltf viewer with shadow maps + shitty bloom
idk, i haven't compared it
but it seems like a nice optimization for large meshes
i use it for every mesh import
Iāve been meaning to try out mesh optimizer but Iāve never gotten around to figuring out how to use it
I am hoping to get good at houdini and have it solve mesh issues
I donāt know where I can store and share assets though. Like not a lot of open source games out there to show how to do this well. Hosting GiBs of art and objects
i would store them in a single lose-less format stored in a separate repo or somewhere else
Yeah, would be nice if it was a pretty seamless experience to git clone and build and run the thing
Maybe a zig buildup step or pull files via zon or something
yeah you can totally achieve that with .zon and b.dependency
Houdini license will stay cheap if you never make any money with your game 
use blender smh
personally, Iāve found gzip each individual file, archive with cpio, and then compress with lzma twice to be a good solution to compression
Or at least I think gzip individual entries was a step, was a long while ago
I am going to give alienbrain and helix core a try
helix core is $40 a month though, alienbrain would be $250 a year
anyplace I put big files will cost money though
you could make a path tracer
what's that
it's a light transport algorithm. It's one way to render global illumination
you can make a simple path tracer in like 20 loc if you have the ray trace function
oh nice
I'll post the pseudocode later as I'm about to be at the gym
I am going to exercise myself in about an hour
been doing that at 8pm
I'm just fucking around tbh
shadows
you need the path tracer for your museum
it will trace a path through the galleries
lol
š¤©šImagine waking up one day with the idea of making a game stuck in your head. You are excited and eager, a fun new task! You jump out of bed and rush through your morning routine so you can get started! You get to your nice new and shiny computer you like programming on and google how to make a 3D game and find learnopengl.com. The tutorials there look like just what you were looking for. You also look for some helpful discords, like GP, and join in case you have questions or want to talk with others also making games. Having made a plan, you start up Xcode, your favorite macOS IDE filled with the anticipation of all the joy and fun youāre going to have today.

and four years later having achieved nothing you're just sitting depressed in front of your overpriced mac
Man if they keep at it for four years, without changing anything, that is some dogged determination to be proud of. They will likely have developed new character traits, some maybe not so pleasant
I discovered last night that when rotating in my ray tracer the normals are broken
So I must investigate that today
Itās interesting to go from thinking about rasterizing surfaces to rays
On the one hand rays seem like theyāre easier conceptually. You just follow the ray. On the other hand itās new and different and I donāt want new and different I want same

absolutely fucked normals
right at the axis boundaries hrm
on specific surfaces
normals should not be affected by the frag coordinate at all, I have a typo or something somewhere
textures
I am 3 into mine
It feels less feature complete now than it did 4 months in lol
I had AI and multiple weapons and stuff
wel I was more specifically referring to someone one using opengl on macos for four years :P
that whole paragraph was a bit
also, no way, your terrain looks amazing
I mean you had to drop features I guess
to get that terrain
but it's progress still
Oh lmao I get it now
I was relating to the disconnect of the day you start a cool ambitious OpenGL project to the years of slog to get hardly anywhere lol
well that's a thing too
one day at a time
short measurable goals
weekly progress on those goals
that mostly works for me
I mean what else would I do
At some point the goals can't be short anymore but yeah I do do that
The short goals are just less interesting as things progress
well the small goals make progress on the bigger goals
it's like a tree structure of goals
Yeah the small goals just become like "this week: rewrite a tiny part of the complex system that organizes some data into a buffer" rather than "add shadows to my scene"
Or "read the Jolt manual several times to try and figure out how to replicate my old raycasting solution using the engine"
lol
I still need to send the path tracer pseudocode
yes you have very large and ambitious goals! but you are also making something already impressive
Make it arbitrarily recursive
If you think about it, mirrors are 3d in 3d

this is how we break the simulation
prefectly aligned mirrors
it will run out of vram
is the future ray tracing
like will rasterization go away eventually
and it's just all going to be ray tracing?
Hmm not in the near future
Rasterization performs too well to give up on it completely
And it'll still perform better than RT 50 years from now
(for primary rays)
I don't like intersection detection in the shader, I like how with fragment shader it's already all determined in the graphics pipeline
this is all very manual though
there's an if statement for every possible object right now
Ideally you'd have a TraceRay function and inside it, it would traverse a bounding volume hierarchy (bvh)
yeah bvh is the next chapter
that's the last chapter I will do a scene for
the final chapter is VR/AR I will just read it
but I won't do any of it
idk
reflection and refraction left
and then the bvh chapter, maybe I can be done with this book by end of the holiday weekend
that would be nice
Not if I send you on a side quest to add path tracing 
I actually have a bunch of other books with ray tracing chapters
these last few months has just been this one book lol
this one has all these exercises in them
the other ones are just math and information
I think switching to vulkan will take me about 2 months
depends on work and how hard it is
I'm linking this before I forget. The path tracing code is the next ~100 lines until the #endif
https://github.com/JuanDiegoMontoya/Frogfood/blob/main/data/shaders/ShadeDeferredPbr.frag.glsl#L593
But it's more complicated than the simplest kind of path tracer
you're doing this in a fragment shader?
Yeah hehe
I'm using Vulkan ray query so I can just send a ray in any shader I want
https://github.com/JuanDiegoMontoya/Frogfood/blob/be82e484baab02b7ce3e80d36eb7c9291d97ebcb/data/shaders/ShadeDeferredPbr.frag.glsl#L381
and shadingUniforms are all the objects that that may have light?
You can use lambert so it turns into albedo/pi
Instead of a fancy brdf
there are two ways to do ray tracing in Vulkan. The first (and possibly most "optimal" is to use a dedicated ray tracing pipeline. The latter is to use ray queries
The latter is more flexible and easier to integrate
so this is a combination of raster and ray tracing
I think I remember maybe vblanco saying that he was ray tracing his voxels and I didn't understand what he meant
I guess he meant something like this
Ah I think he's rendering voxel "chunks" as big cubes and then doing ray tracing to see which block inside it is hit
that's really cool
this is vulkan stuff
I can do this with shader objects or it requires pipelines?
idk what I am talking about
The thing I currently have can work in any fragment shader
Idk if shader object supports ray tracing stages. I'd imagine not
Shader object?
I haven't used them myself
amd on windows has them now
and there's a fallback layer
I think linux will perform badly right now with shader objects
because the fallback just JIT makes the piplines on draw
The only problem will be the lack of tutorials, but if you're not afraid to dive into the spec then it's no issue
yeah
All Vulkan tuts use pipelines
I'm going to read about pipelines, but go straight for the shader objects when I do anything
I may do a triangle with pipelines
it has examples
I can probably search github too
lol
not a lot of usages on github yet
anyway
I'll give it a go
thank you for sharing the path tracing code
I also donāt think anything is going to replace rasterization for 2d
I mean like
what even can do so
especially for simple UIs, where you donāt really want anything fancy
hold on a sec rebuilding my UI BLAS
// Surface holds properties like the hit position, normal, and material.
Surface surface = TraceRayFromCamera(); // You can rasterize the first ray too.
// Amount of light that makes it to the camera from the light source we eventually hit.
vec3 throughput = {1, 1, 1};
vec3 indirectIlluminance = {0, 0, 0};
// Ray will bounce fixed number of times or hit a light before terminating.
for (uint bounce = 0; bounce < maxBounces; bounce++)
{
vec2 random = GetRandomNumbers();
vec3 rayDir = SampleUnitHemisphere(random, surface.normal);
// Rays project over a larger surface area when the angle of incidence from the normal increases.
float cosTheta = dot(surface.normal, rayDir);
// The PDF of the sampling function must integrate to 1.
float pdf = 1 / (2 * PI); // Uniform hemisphere PDF.
vec3 brdf = surface.albedo / PI; // Lambertian.
throughput *= brdf * cosTheta / pdf;
surface = TraceRay(surface.position, rayDir);
if (surface.hit)
{
indirectIlluminance += throughput * surface.emission;
}
else // Ray missed the scene
{
indirectIlluminance += throughput * SampleSkyColor(rayDir);
break;
}
}
that's awesome, thank you!
so brdf attenuates throughput over each bounce?
brdf * cosTheta / pdf
if the ray comes in at a steep angle, it "covers" more surface area which is why we have the cosTheta term
so one of things I have had to do is in addition to ray casting from the camera, each surface I land on I have to trace all the light rays to that surface
I guess all the emissive surfaces
that's what this is doing?
sorry no this is different
the emissive surfaces are implicitly handled by the indirectIllumination += throughput * surface.emission; line
oh ok
the pseudocode I sent does not handle explicit light sources like point lights or the sun (unless the sun is part of the sky)
in my real code I explicitly sample each point light source at every bounce
they are infinitely small so a ray would never hit them otherwise
oh right
how do you know if a point light is occluded?
you send a ray towards it
but you can't hit it
but you can see if the ray hits anything on its way to the location of the light
so if you can do intersection tests with hardware BVH in the fragment shader you can basically get reflective items for cheap
but this requires a raytracing step in the pipeline then hrm?
wdym pipeline
no it would just be code in your fragment shader
how do you put the objects in your scene into the BVH?
in this book I have to create it manually
you add blas instances to your tlas
yes
in vulkan rt, you have bottom-level acceleration structures, which represent individual meshes, and a top-level acceleration structure, which represents the whole scene
only the tlas needs to be remade or refitted each frame, while the blases can stay the same
yeah, only turing+ (nv) or rdna2+ (amd)
and I think intel arc
is that any RTX
technically some worse hardware (pascal, rdna 1 and I think gcn on linux) has driver support for rt but it's not accelerated so it's really slow
let me look that up
that's all rtx
ah
so even my laptop has it already
it's just a 3060 from like four years ago
I opened the wrong Dell app on my laptop and now I have a blue box that won't go away
lol what have I done
I'm scared to close it
I don't even see it in the task list
oh I do
I have been told by someone that my laptop's integrated gpu has rt acceleration cores when I showed them what my cpu is
... pretty sure my CPU might literally melt if I used those
this is the goal, I want this working in my scenes
I want reflection and bouncing, refraction, global illumination. even just a few bounces would be pretty amazing
also holy heck thank you for recommending claude 
I have been using claude exclusively for so long I don't know if it fell behind or what
or how it good it was
it's so good
have not encountered another AI which has as much knowledge as it
all of that is "automatically" handled by GI alone, though the pseudocode I sent does not do transmission (which is how you get refraction) or specular reflection (since the brdf is lambert)
(this is actually correct, other AIs I've tried would never generate this; claude only took 4 messages to do so)
so not your code, but with ray tracing even just a short number of rays it seems like you can get transparent windows without having to worry about blending? am I mistaken?
I mean
you have to blend yourself
I guess
I meant order dependent transparency stuff
my point is it seems easier/efficient? to do this RT than manage the order of transparent objects in a scene as you move the camera
ignoring the bsdf, if you hit a translucent surface, you just multiply the throughput by (1 - color * alpha) and continue the ray
I'm not 100% sure this is the correct blending math but it should be very simple either way
like some materials might have high index of refraction and the ray bends quite a bit
or you get total internal reflection : D
pretty neat
feels like if I can get that working the switch to fancy vk would be worth it
btw you have to use the fresnel equation(s?) to determine if a ray will be transmitted (refracted) or reflected
or rather, determine the probability
right I had to do that for my water simulation
yeah you get a mix of reflection and refraction simultaneously
I did a water renderer too, with a simple wave simulation
https://github.com/JuanDiegoMontoya/Shallow-Water/blob/master/Images/water2.png?raw=true
the one thing I have not read much about yet is volumetric lighting
how do you generate the water surface?
is that a physics simulation?
or noise?
looks like a simulation based on the words "simulation" which are in your screenshots and your description
it's a heightmap
does it get generated per frame?
I'm using CUDA to do a simple simulation to propagate waves
ah
why CUDA
I can't run the program anymore because I have an AMD GPU
ah
wow
the backgrounds are just envmaps that I stole from somewhere
they are good ones
I think volumetric lighting is the one big thing graphics I still don't understand, nothing I have read has covered it in detail, but I imagine it is probably similar to fog? I know what ambient occlusion is but I know very little about to do it actually, that's another thing I don't know. this is all post vulkan move when I get back to the books
the water shader is really simple, it's basically just sampling the skybox with fresnel to determine the mix of reflection and refraction
https://github.com/JuanDiegoMontoya/Shallow-Water/blob/master/Water/Source/resources/Shaders/heightWater.fs
fog rendering is volumetric rendering
Adding fresnel to my water scene was such a small change but had such a huge impact on how good it looked
yes
I guess the tricky part is that you have to integrate density and lighting along every point on a ray going through a volume
fog blocks some light from objects inside or behind it from reaching the viewer
but it also reflects some light into the viewer
hrm
the former, called transmittance, is pretty easy to calculate. just sum up the "amount" of fog along a ray and do exp(-amount) to get it
oh another thing I don't know how to do is actually directional shadowmaps. I know it sounds silly, but I haven't been able to figure it out on my own. I can use a perspective matrix to create point light shadow maps easily, but all my orthographic attempts have looked absolutely horrible.
I now these things are easy to find tutorials for. logl probably has them. I am just thinking about what I still don't know after reaching nearly the end of this book now.
fundamentally they are the same as perspective shadow maps
I tried to do it the same way and it just looks completely incorrect
I'm guessing the issue you have is in placing the light frustum or something
I actually added UI to control the frustum
I dunno, renderdoc
yeah I realize I can just look it up
it's just orthographic doesn't look right I think?
idk
display the shadow map in imgui
for example you expect with parallel directional light, for say five identical pillars aligned next to each other
to cast the exact same shadow in the same direction
no matter how far apart they are
but where do you put the camera for that?
it would have to be so far away that the shadows it generated would be terrible?
around the camera I guess
:P
yeah there's no satisfying answer
hrm
it's not like point shadows where it's obvious
it gets more obvious if you add cascades
one thing you can do is hardcode the frustum to fit the scene
yes that makes sense
I just want to get decently good at rendering and then make a game
once you make a bvh you can trace rays for your shadows š
ray tracing is the answer to everything :P
it's actually a lot simpler than shadow maps (once you have the rt framework)
I'm looking foward to it
my games will have small levels with static geometry, none of this giant open mutable world
so I can bake a lot in
that simplifies your life greatly
I frequently bring up the ascent as the kind of game visuals I would like to have https://www.google.com/search?sca_esv=fb1607ebde4714f4&sxsrf=ADLYWIIK0n5WCRea-n9ufnt0cZV8IUZHug:1731219885083&q=the+ascent+game&udm=2
er
that aesthetic is dope
yeah
bloom + volumetrics
everything else can be fairly basic and it'll still look good imo
if the camera angle is fixed, a lot of stuff can probably also be faked via sprites
a lot of the ideals depend on the situation
doesn't usually make sense to have the sun be a sphere when you're on a planet
right
it's just so nice looking
a lot of art content though
which is why I am taking houdini/marmoset toolbag lessons
my game will be much more basic though, solo project for a hobby
No I havenāt
Omg
Is it good?
probably the 2nd best GDC talk ever made
In this GDC 2022 session, Neon Giantās Tor Frick goes into detail on how the team approached and solved the challenges along the way, not only in 3D content creation and level building, but also stylistically.
Head to GDC Vault (http://www.gdcvault.com) for the latest video-on-demand sessions from GDC 2022āwith several GDC videos available to ...
The entire game uses one texture
the whole thing is a massive kitbash
it's insanely impressive
Oh they pack
It's a trim sheet
not just a pack
Watch that at the soonest available opportunity
It's extremely cool
The whole thing is about how they tooled up to enable their small art team to cobble together all that art content into the world
4 artists
Watching now
shit I watched half of it by accident
I can't peel my eyes away
I can't believe you haven't seen this if this game's art is an inspiration to you this must be like Christmas came early lol
Had no idea
Itās a great video I am learning so much
Thank you
I will probably watch it many times
Still watching
Yeah I've watched it several
I still don't quite understand what the exact modeling workflow is like to replicate it in my own stuff but it's still a great new perspective
I did learn about weighted normals from it though
Day and a half to make a mech 
These people are super talented
Houdini of course
Yeah no doubt they are insane
But even 4 talented artists could never have made a world like that without this special workflow
And the things in this can still be kept in mind for a single person just making small amounts of art on your own
True, great video thank you! Had no idea how it was built. Amazing what is achievable with few resources
just understanding the power of abusing your textures/UV spaces and stuff is good inspiration for workflow stuff in general
and the fact that weighted normals lets you get away with skipping a high-poly/bake process in many cases
That video really gets at the heart of the issue of small team projects and having enough high quality content to make a decent game. They knocked it out of the park with their process.
I donāt plan on building as ambitious world as what they achieved, but I am becoming more hopeful that I can build something halfway decent with a custom engine I built myself starting from not knowing anything .
Bookmarked the vid
The controlled camera distance letting you get away with lower quality content is good also
Video is Sponsored by PCBWay: www.pcbway.com
This is a guide on how to install Bjorn on a Raspberry Pi Zero V2 WH with a Waveshare v4
Software needed:
Raspberry Pi Imager
https://www.raspberrypi.com/software/
SSH Software:
https://termius.com/
or Putty
https://www.putty.org/
Hardware Needed:
Waveshare V4: https://amzn.to/40YT8t5
Raspberry P...
š
idk what it is, but it showed up in my feed

they can't say bjorn
Ba-jorn? wtf
it's a y sound like "yarn" but "yorn" "bjorn"
i hate my name I wish my name was like ben or john or something jfc
Bjorn is such a cool name
I try to do b-jorn but it probably ends up sounding like ba-jorn tbh
I left a comment on the video
Iām curious to hear an audio clip of how bjorn is meant to be said
I updated my comment
I also downvoted the video
I'm going to change my legal name to ted nobody gets ted wrong
jk
I get other people's names wrong
(Check my status)
theth
So
the name comes from one of my characters
said character has three names associated with them, each of which having its own meaning
All of the names would shorten to lyz, so their shortened names are not just lyz
it looks cool imo and hey, at least it's a single word. i hate how i should say my full name in legal places (Muhammad Ali)
I mean that's a cool name
Ali surely is, muhammad isn't
My actual name is a boring one 
just a basic jason
I'll trade
I gotta get this ray tracing stuff done so I can get to tearing out my opengl
the other thing I want to do is make every scene a linked library using extern C ABI
I am not open for trade 
I haven't done that in zig yet
that way I have hot reloading and I don't have hard coded scene lists and a bunch of unecessary comptime switch logic for all the possible scenes
I have at least 14 nicknames Iāll respond to
5 distinct nicknames&my actual name
the rest are nicknames of nicknames
O^n nicknames
holy shit this worked
const z_start: f32 = @as(f32, @floatFromInt(RayCastingUI.num_images)) * 4.0 * -1;
comptime var embeds: [RayCastingUI.num_images][]const u8 = undefined;
comptime {
for (0..RayCastingUI.num_images) |i| {
var file_name_buf: [500]u8 = undefined;
const file_name = std.fmt.bufPrint(&file_name_buf, "img_{d}.comp.glsl", .{i + 1}) catch @panic("bufsize too small");
embeds[i] = @embedFile(file_name);
}
}
inline for (0..RayCastingUI.num_images) |i| {
var label_buf: [10]u8 = undefined;
const label = std.fmt.bufPrintZ(&label_buf, "img_{d}", .{i}) catch @panic("bufsize too small");
rc.images[i] = rc.renderImg(label, embeds[i], math.matrix.translate(
3,
0,
z_start + @as(f32, @floatFromInt(i * 4)),
));
errdefer rc.deleteImg(rc.images[i]);
}
I love zig comptime
Wait are you rendering different stages of the render process?
I was manually adding couple of lines per new image
I am running a compute shader for each image
but I don't run it every frame
just whenever they're updated
the first frame runs them all, but I could have it sequence it over multiple frames
hm
whenever I have to debug in renderdoc I have to run that compute shader every frame
Btw, do you classify command line games as pixels?
well Iām gonna be doing a snake game soon
someone wrote a doom in zig that runs in the console
guess I could use colors tbh
it looks just like doom, it just paints the terminal via a popular zig TUI library
I would say that's pixels
if it's just characters getting spit out as new lines I would say no
the TUI libraries are basically hardware accelerated via the ptty, like with ghostty that's all GPU drawn
I mean your rendering will all be CPU though I imagine
just the actual drawing by the ptty will be GPU idk
who cares what I think anyway :P
have fun making a cool thing
not sure it was worth it š
Iām gonna use knowledge I gained from programming snake on a calculator to reduce my complexity 
nice
On the calculator, I was only able to store information about so many segments in the calculatorās RAM
So instead of doing that, I stored it on the calculatorās display 
here I can just make two copies of the board and store information about the segments in the offscreen copy and the graphics in the display copy
this is a TI-83?
I have one somewhere
maybe I can run your game idk how it works, it's like 20 years old maybe the batteries leaked and destroyed it
I love TI-83 calculators though
I should buy a new one
I'm adding refraction and then I'm done with this chapter then I'm doing the bvh thing and then just write notes on the last chapter omg I just want to get through it already. I think the manual bvh will be really valuable though
btw, this is was what I was able to do 4 days ago
so some progress :P
it's not hard though, it's just following a ray and finding a color to return it finds
at least at this level
alright refraction
TI-84CE
man
I love graphing calculators
that there is a beauty
I don't think it's legal for standarized tests however 
PSAT*, SAT*, and ACT* college entrance exams.
oh it is
I have never been allowed to use any kind of graphing calculator in a standardized exam
actually maybe one
are you in the US
prefer not to say 
np np
I'm fully doxxed
my github has my last name and link to my job lol
you can even find my home address via public real estate records, I can't make anyone mad at me on discord
I don't think you can be doxed from country alone unless you live on the pitcairn islands or something
probably good that I am less active on #opengl
I am going to get swatted for saying use renderdoc
why would that get you swatted?
you think they can figure out how to swat you
they can't even figure out how to link libraries
The TI84 is how I learned LUA
even though it does not use LUA
:\
you don't learn Lua until you know it's not an acronym
Itās close enough that the knowledge transferred š¤·
Lua Uppercase Accident
I just type it as uppercase 
when you know a couple you kind of know them all
it's like learning to drive
the hard part is learning how computers work
lua is strange until you learn it
yes the embedded nature of it is different
it has like a context and a table and stuff
but once you learn it
man it is a nice lang 
I forget actually I was using lua with blockens
and I had to learn about the state it maintains per instance
yeah the language is one thing, but the whole embedding part is another
I really liked it
When embedding it, I use it incorrectly and I know that
but thatās because I have sorta a specific way I want it to be used and it only takes⦠an additional line of LUA to use it that way and not too much work on the program side
people say it is fast, but it's actually really slow
Or at least Iām assuming itās the wrong way 
easily the slowest part of blockens is the lua stuff
probably I'm doing dumb things though
Meanwhile embedding python adds a full 20MB to your program that you probablyā¢ļø donāt want for sake of not making your program a security issue
Basically what I do is I have scripts return a table of functions that the program can then call
I also implement imports as just provide this table that the script returns
ok
I'm good on this I think
you know
I'm just going to read the BVH chapter, I'm not going to do it
I am going to read the BVH and AR chapters and take notes and I'm done with the book.
This ^^^ was the last OpenGL code I will ever write. I'm tearing it all out next
huh, why did this disappear from my channel list
discordā¢ļø moment
are you gonna make a new one in place of this one though, or no?
I hope so
ping me as well plz!
You could write the renderer in C++ and standardize on a C API that you call from zig
Let me know when you make a new thread so i dont miss it
I am currently learning CPP 
I watched the vid and it's really cool and impressive
But to me it felt like a very situational thing that only applies to particular types of games
Moreover, this is clearly something that was done and could be done only because the team was formed by AAA gamedev experts who knew exactly what they were doing
So I'm not super sure how applicable their approach is to gamedev in general, much less indie
But it's def a talk worth learning from
I am curious to play it now and see what I think about it live
It's a game that apparently skipped the concept/design phase, so wondering what the effects of that are in the final game
Pre-production right, that's what I meant
They made it seem like they skipped that entirely
I ordered the version with the artbook just now
How did they even produce an artbook, after the fact?
it probably depends but I think they just scrape together all the promotional and concept art then write some blurbs
what's the performance difference between zig and C++?
probably not a meaningful difference
Is this oblique projection or just a basic clipping plane
just a basic clipping plane, I have read about oblique projections in lengyel, but this was just following along in a different book, it was cool I hadn't used clipping planes before
Clipping planes are so helpful for things. They are cool
The performance difference between two langs is usually negligible
Unless one of the langs is interpreted and the other is not
Languages don't usually have inherent performance levels. (Unless interpreted) but some languages allow you to do things that can't be done in others

