#Foundations - Learning Graphics Programming with the Zig Programming language

8815 messages Ā· Page 9 of 9 (latest)

ivory verge
#

one of them had hardware keys

#

its sad, but also weird that no real scandals took place yet

delicate delta
#

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

ivory verge
#

you need some underwater trees too

delicate delta
#

it's a pool

#

maintained by a highly paid pool professional

#

if I find a tree they are getting fired

ivory verge
#

šŸ˜„

#

calling the A-Team

delicate delta
#

does this look bad

#

I can't tell

#

I know it's WIP though

ivory verge
#

i like it

#

it doesnt look bad at all

delicate delta
#

the fresnel will help a lot I think

#

and the caustics

ivory verge
#

yeah

merry surge
#

the cloud reflections look weird imo

delicate delta
#

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

merry surge
#

ah no worries

#

loved doing that show

delicate delta
#

sorry about how it ended though

merry surge
#

oh well he deserved that punch

delicate delta
#

we all do

merry surge
#

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

delicate delta
#

nice, it such a comfort show, just turn off my worries and watch something about cars

merry surge
#

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

delicate delta
#

nice

magic talon
#

subscribing here too

#

your water looks cool X_X

delicate delta
#

Going for a walk again

delicate delta
#

ok let's fix these textures

delicate delta
#

some artifacts along the edges hrm

elder kettle
#

I would tone down that specular pattern personally

#

It seems like your reflections are already sort of handling that through more physical means

delicate delta
#

the book adds even more of that with caustics

#

maybe I just add those on the floor

elder kettle
#

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

delicate delta
#

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

delicate delta
#

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

delicate delta
#

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

elder kettle
#

Something's fucky

#

Why are most of the edges still straight

delicate delta
#

yeah

#

I noticed that too, I'll look at it after caustics, the little bit darker underwater light looks nice

delicate delta
#

discord probably hates how much I upload

delicate delta
#

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

delicate delta
#

hrm

#

I think I would need to generate a different noise texture

#

whatever

#

I learned a bunch, I got value out of this, I'm done with it.

queen hinge
delicate delta
#

it makes for a nice new screenshot on my repo if nothing else

#

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

delicate delta
#

For after switching to vulkan ^^

#

Current plan:

  1. Two Ray Tracing/Compute Shader chapters
  2. Move to vulkan
  3. gltf parser to custom format
  4. Deccer cubes
  5. GEA animation chapter
  6. 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

delicate delta
#

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

merry surge
delicate delta
#

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

mellow flicker
#

most window libraries interface really simply

#

because there's no weird window context to bother with

mellow flicker
delicate delta
#

Ah nice

harsh elbow
#

I use glfw with vulkan, it's easy as fuck, definitely less library involvement than GL (literally 1 function)

ivory verge
#

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

delicate delta
#

yeah I mean I want SDL for audio too I think

ivory verge
#

yeah

delicate delta
#

In SDL3, SDL_AudioStream is the backbone of the entire audio subsystem.

#

looks good

#

idk if it sucks I'll use something else

ivory verge
#

you mean - sounds good - šŸ˜„

delicate delta
#

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

delicate delta
#

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

elder kettle
#

oh boy

#

classic

delicate delta
#

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

delicate delta
#

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

late jackal
#

whats that

delicate delta
#

Zulip is a chat app like discord

late jackal
#

oh

delicate delta
#

The core zig devs left discord

#

A few months ago or so

late jackal
#

rip

delicate delta
#

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

late jackal
#

mailing lists bleaker_kekw

delicate delta
#

Zulip is basically if every discord chat room was thread mode

wise imp
#

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

delicate delta
#

Yeah it makes sense for a dev chat

delicate delta
#

I will be there

delicate delta
#

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

delicate delta
#

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

queen hinge
#

nbd?

delicate delta
#

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

delicate delta
#

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

late jackal
#

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

delicate delta
#

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

late jackal
#

you can invoke glslangValidator yourself

delicate delta
#

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.

šŸŽ‰

late jackal
#

what's on line 24

delicate delta
#

an intentional error

#

just to test it

#

just asdf

#

I'm going to use the .comp.glsl for autodetection I guess

delicate delta
#

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

maiden gazelle
#

Nice progress!

delicate delta
#

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

late jackal
#

it would be funny if I added that testimonial to the blog post

delicate delta
#

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

delicate delta
#

literally zero shader linking errors

#

zero

#

that's never happened to me before

late jackal
#

that's the power of linting

delicate delta
#

it's crazy though I have 3D in a 3D

late jackal
#

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

delicate delta
#

the factorio devs are on a whole other level

late jackal
#

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

delicate delta
#

maybe they have integration tests that run the game within the game

late jackal
delicate delta
#

well there you go

late jackal
#

I think this is just 16 instances of the game running on different threads, with each one running a portion of the tests

delicate delta
#

I think after the ray tracing, the Vulkan switch will just be a new project

delicate delta
#

I am considering doing it in C++

#

idk

#

Just thinking about it

crystal mountain
#

specially when you got the incredible vulkan-zig library

delicate delta
#

Yeah I just like writing zig tbh

#

The c++ ecosystem is just really nice

magic talon
#

Yesss join the c++ side froge_evil

delicate delta
#

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

delicate delta
#

I am just keep going with this project I put a lot into it

crystal mountain
#

i can give you access to my top-secret vulkan game if you're interested frognant

#

importing vma and meshoptimizer has never been easier froge_love

    // 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

delicate delta
#

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

crystal mountain
#

ah i didn't mean that lol

delicate delta
#

I know I am joking forgelove

crystal mountain
#

it's just that zig gave me such a good taste that nothing can replace it for me

delicate delta
#

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

delicate delta
crystal mountain
#

it's super early rn

delicate delta
#

Nice

crystal mountain
#

currently just a gltf viewer with shadow maps + shitty bloom

delicate delta
#

What do you use mesh optimizer for?

#

Is that valuable

crystal mountain
#

idk, i haven't compared it

#

but it seems like a nice optimization for large meshes

#

i use it for every mesh import

queen hinge
#

I’ve been meaning to try out mesh optimizer but I’ve never gotten around to figuring out how to use it

delicate delta
#

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

crystal mountain
#

i would store them in a single lose-less format stored in a separate repo or somewhere else

delicate delta
#

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

crystal mountain
delicate delta
#

Houdini license will stay cheap if you never make any money with your game smart

crystal mountain
#

use blender smh

delicate delta
#

Yeah I will use blender also

#

Not sure how blender fits in yet

queen hinge
delicate delta
#

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

delicate delta
#

making a gallery man

#

a gallery

#

need bigger

#

and better

late jackal
#

you could make a path tracer

delicate delta
#

what's that

late jackal
#

it's a light transport algorithm. It's one way to render global illumination

delicate delta
#

oh I see

#

hrm

#

I was about to add some light to one of these

late jackal
#

you can make a simple path tracer in like 20 loc if you have the ray trace function

delicate delta
#

oh nice

late jackal
#

I'll post the pseudocode later as I'm about to be at the gym

delicate delta
#

I am going to exercise myself in about an hour

#

been doing that at 8pm

#

I'm just fucking around tbh

delicate delta
#

going to add some shadows next

#

after exercising

delicate delta
ivory verge
#

you need the path tracer for your museum

#

it will trace a path through the galleries

delicate delta
#

lol

delicate delta
#

🤩🌟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. froge_love froge_love

merry surge
#

and four years later having achieved nothing you're just sitting depressed in front of your overpriced mac

delicate delta
#

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

queen hinge
delicate delta
#

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

delicate delta
#

it was indeed a typo

#

jfc

delicate delta
#

textures

elder kettle
#

It feels less feature complete now than it did 4 months in lol

#

I had AI and multiple weapons and stuff

delicate delta
#

wel I was more specifically referring to someone one using opengl on macos for four years :P

#

that whole paragraph was a bit

delicate delta
#

I mean you had to drop features I guess

#

to get that terrain

#

but it's progress still

elder kettle
#

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

delicate delta
#

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

elder kettle
#

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

delicate delta
#

well the small goals make progress on the bigger goals

#

it's like a tree structure of goals

elder kettle
#

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"

delicate delta
late jackal
#

I still need to send the path tracer pseudocode

delicate delta
#

not a very good ray tracing camera lol

#

3D in a 3D though

delicate delta
late jackal
#

If you think about it, mirrors are 3d in 3d

delicate delta
#

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?

late jackal
#

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)

delicate delta
#

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

late jackal
#

Ideally you'd have a TraceRay function and inside it, it would traverse a bounding volume hierarchy (bvh)

delicate delta
#

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

delicate delta
#

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

late jackal
#

Not if I send you on a side quest to add path tracing frogegreenexcited

delicate delta
#

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

late jackal
#

But it's more complicated than the simplest kind of path tracer

delicate delta
#

you're doing this in a fragment shader?

late jackal
#

Yeah hehe

delicate delta
#

so this is GI

#

brdf

late jackal
delicate delta
#

and shadingUniforms are all the objects that that may have light?

late jackal
#

Instead of a fancy brdf

delicate delta
#

vulkan ray query hrm

late jackal
#

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

delicate delta
#

so this is a combination of raster and ray tracing

late jackal
#

It do be

#

I mean, you're tracing rays in the fs

delicate delta
#

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

late jackal
#

Ah I think he's rendering voxel "chunks" as big cubes and then doing ray tracing to see which block inside it is hit

delicate delta
#

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

late jackal
#

The thing I currently have can work in any fragment shader

#

Idk if shader object supports ray tracing stages. I'd imagine not

delicate delta
#

hrm

#

I think I will start with those

late jackal
#

Shader object?

delicate delta
#

yes

#

they are easier

late jackal
#

I haven't used them myself

delicate delta
#

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

late jackal
#

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

delicate delta
#

yeah

late jackal
#

All Vulkan tuts use pipelines

delicate delta
#

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

late jackal
#

I need to show the pseudocode because it's way simpler

#

But I'm on mobile

queen hinge
#

I mean like
KEKW what even can do so

#

especially for simple UIs, where you don’t really want anything fancy

harsh elbow
#

hold on a sec rebuilding my UI BLAS

late jackal
# late jackal I need to show the pseudocode because it's way simpler
// 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;
  }
}
delicate delta
#

so brdf attenuates throughput over each bounce?

late jackal
#

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

delicate delta
#

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

late jackal
#

the emissive surfaces are implicitly handled by the indirectIllumination += throughput * surface.emission; line

delicate delta
#

oh ok

late jackal
#

the pseudocode I sent does not handle explicit light sources like point lights or the sun (unless the sun is part of the sky)

delicate delta
#

ah ok

#

I actually haven't gotten to this yet in the book

late jackal
#

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

delicate delta
#

oh right

delicate delta
late jackal
#

you send a ray towards it

delicate delta
#

but you can't hit it

late jackal
#

but you can see if the ray hits anything on its way to the location of the light

delicate delta
#

lighting is hard

#

it's fun though

delicate delta
#

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?

late jackal
#

wdym pipeline

delicate delta
#

like the vulkan pipeline

#

a vulkan pipeline

late jackal
#

no it would just be code in your fragment shader

delicate delta
#

how do you put the objects in your scene into the BVH?

#

in this book I have to create it manually

late jackal
#

you add blas instances to your tlas

delicate delta
#

that's really cool

#

so sounds doable with shader objects?

late jackal
#

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

delicate delta
#

oh but you need hardware support

#

and not everyone has the hardware

late jackal
#

only the tlas needs to be remade or refitted each frame, while the blases can stay the same

late jackal
#

and I think intel arc

delicate delta
#

is that any RTX

late jackal
#

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

delicate delta
#

let me look that up

late jackal
delicate delta
#

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

queen hinge
#

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

delicate delta
#

I want reflection and bouncing, refraction, global illumination. even just a few bounces would be pretty amazing

queen hinge
#

also holy heck thank you for recommending claude bleaker_kekw

delicate delta
#

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

queen hinge
#

it's so good
have not encountered another AI which has as much knowledge as it

late jackal
queen hinge
delicate delta
#

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

late jackal
#

ignoring the bsdf, if you hit a translucent surface, you just multiply the throughput by (1 - color * alpha) and continue the ray

delicate delta
#

maybe that's crazy

#

yes I am reading about IORs atm

late jackal
delicate delta
#

like some materials might have high index of refraction and the ray bends quite a bit

late jackal
#

or you get total internal reflection : D

delicate delta
#

pretty neat

#

feels like if I can get that working the switch to fancy vk would be worth it

late jackal
#

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

delicate delta
#

right I had to do that for my water simulation

late jackal
#

yeah you get a mix of reflection and refraction simultaneously

delicate delta
#

it's a really neat effect

#

very exciting

late jackal
delicate delta
#

the one thing I have not read much about yet is volumetric lighting

delicate delta
#

is that a physics simulation?

#

or noise?

#

looks like a simulation based on the words "simulation" which are in your screenshots and your description

late jackal
delicate delta
#

does it get generated per frame?

late jackal
#

I'm using CUDA to do a simple simulation to propagate waves

delicate delta
#

ah

late jackal
#

yeah it ticks every frame

#

I have a video of it somewhere

delicate delta
#

why CUDA

late jackal
#

I can't run the program anymore because I have an AMD GPU

delicate delta
#

ah

late jackal
#

meh I could only find images

delicate delta
#

wow

late jackal
#

the backgrounds are just envmaps that I stole from somewhere

delicate delta
#

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

late jackal
#

fog rendering is volumetric rendering

delicate delta
#

Adding fresnel to my water scene was such a small change but had such a huge impact on how good it looked

late jackal
#

yeah, small things can have a huge impact

#

I love those

delicate delta
#

yes

late jackal
#

fog blocks some light from objects inside or behind it from reaching the viewer

#

but it also reflects some light into the viewer

delicate delta
#

hrm

late jackal
#

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

delicate delta
#

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.

late jackal
#

fundamentally they are the same as perspective shadow maps

delicate delta
#

I tried to do it the same way and it just looks completely incorrect

late jackal
#

I'm guessing the issue you have is in placing the light frustum or something

delicate delta
#

I actually added UI to control the frustum

late jackal
#

I dunno, renderdoc

delicate delta
#

yeah I realize I can just look it up

#

it's just orthographic doesn't look right I think?

#

idk

late jackal
#

display the shadow map in imgui

delicate delta
#

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?

late jackal
delicate delta
#

:P

late jackal
#

yeah there's no satisfying answer

delicate delta
#

hrm

late jackal
#

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

delicate delta
#

yes that makes sense

#

I just want to get decently good at rendering and then make a game

late jackal
#

once you make a bvh you can trace rays for your shadows šŸ˜„

delicate delta
#

ray tracing is the answer to everything :P

late jackal
#

it's actually a lot simpler than shadow maps (once you have the rt framework)

delicate delta
#

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

queen hinge
#

frOK that simplifies your life greatly

delicate delta
#

er

queen hinge
late jackal
#

that aesthetic is dope

delicate delta
#

yeah

late jackal
#

bloom + volumetrics

#

everything else can be fairly basic and it'll still look good imo

queen hinge
#

if the camera angle is fixed, a lot of stuff can probably also be faked via sprites

delicate delta
#

I want real 3D stuff

#

but that could work for some games

queen hinge
#

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

delicate delta
#

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

elder kettle
#

Yo

#

@delicate delta you have seen the GDC talk by this game's studio right

delicate delta
#

No I haven’t

elder kettle
#

Omg

delicate delta
#

Is it good?

elder kettle
#

probably the 2nd best GDC talk ever made

#

The entire game uses one texture

#

the whole thing is a massive kitbash

#

it's insanely impressive

delicate delta
#

Oh they pack

elder kettle
#

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

delicate delta
#

Watching now

elder kettle
#

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

delicate delta
#

Had no idea

#

It’s a great video I am learning so much

#

Thank you

#

I will probably watch it many times

#

Still watching

elder kettle
#

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

delicate delta
#

Day and a half to make a mech kekkedsadge

#

These people are super talented

#

Houdini of course

elder kettle
#

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

delicate delta
#

True, great video thank you! Had no idea how it was built. Amazing what is achievable with few resources

elder kettle
#

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

delicate delta
#

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 .

magic talon
#

Bookmarked the vid

delicate delta
#

The controlled camera distance letting you get away with lower quality content is good also

ivory verge
#

šŸ˜„

#

idk what it is, but it showed up in my feed

queen hinge
delicate delta
#

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

queen hinge
#

Bjorn is such a cool name

#

I try to do b-jorn but it probably ends up sounding like ba-jorn tbh

delicate delta
#

I left a comment on the video

queen hinge
#

I’m curious to hear an audio clip of how bjorn is meant to be said

delicate delta
#

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

queen hinge
#

þëð

#

Everyone shortens my username wrong

delicate delta
#

lyz?

#

ly?

queen hinge
#

(Check my status)

delicate delta
#

oh laz

#

but why is there a y then

ivory verge
#

theth

queen hinge
#

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

crystal mountain
delicate delta
#

I mean that's a cool name

crystal mountain
#

Ali surely is, muhammad isn't

queen hinge
#

My actual name is a boring one KEKW
just a basic jason

delicate delta
#

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

queen hinge
delicate delta
#

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

queen hinge
#

KEKW I have at least 14 nicknames I’ll respond to

#

5 distinct nicknames&my actual name
the rest are nicknames of nicknames

delicate delta
#

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

queen hinge
#

Wait are you rendering different stages of the render process?

delicate delta
#

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

queen hinge
#

hm

delicate delta
#

whenever I have to debug in renderdoc I have to run that compute shader every frame

queen hinge
#

Btw, do you classify command line games as pixels?

delicate delta
#

depends on if you are painting the command line

#

as in the terminal

queen hinge
#

well I’m gonna be doing a snake game soon

delicate delta
#

someone wrote a doom in zig that runs in the console

queen hinge
#

guess I could use colors tbh

delicate delta
#

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 šŸ˜…

queen hinge
#

I’m gonna use knowledge I gained from programming snake on a calculator to reduce my complexity KEKW

delicate delta
#

nice

queen hinge
#

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 KEKW
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

delicate delta
#

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

queen hinge
delicate delta
#

man

#

I love graphing calculators

#

that there is a beauty

#

I don't think it's legal for standarized tests however froge_sad

#

PSAT*, SAT*, and ACT* college entrance exams.

#

oh it is

queen hinge
#

I have never been allowed to use any kind of graphing calculator in a standardized exam

#

actually maybe one

delicate delta
#

are you in the US

queen hinge
#

prefer not to say KEKW

delicate delta
#

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

harsh elbow
#

I don't think you can be doxed from country alone unless you live on the pitcairn islands or something

delicate delta
#

probably good that I am less active on #opengl

#

I am going to get swatted for saying use renderdoc

queen hinge
#

KEKW why would that get you swatted?

harsh elbow
#

you think they can figure out how to swat you

#

they can't even figure out how to link libraries

queen hinge
delicate delta
#

:\

harsh elbow
#

you don't learn Lua until you know it's not an acronym

queen hinge
#

It’s close enough that the knowledge transferred 🤷

harsh elbow
#

Lua Uppercase Accident

delicate delta
#

lol

#

I don't generally have problems learning new programming languages

queen hinge
#

I just type it as uppercase KEKW

delicate delta
#

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

queen hinge
#

lua is strange until you learn it

delicate delta
#

yes the embedded nature of it is different

#

it has like a context and a table and stuff

queen hinge
#

but once you learn it
man it is a nice lang KEKW

delicate delta
#

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

queen hinge
#

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

delicate delta
#

people say it is fast, but it's actually really slow

queen hinge
delicate delta
#

easily the slowest part of blockens is the lua stuff

#

probably I'm doing dumb things though

queen hinge
#

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

delicate delta
#

yeah I'll have to embed lua in foundation at some point

#

hrm

#

ok refractions

queen hinge
delicate delta
#

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

queen hinge
#

huh, why did this disappear from my channel list
discordā„¢ļø moment

delicate delta
#

This project is rip KEKW

#

#engine-dev message

queen hinge
delicate delta
#

I hope so

queen hinge
#

link me there when you do

#

hard to navigate forums channels on discord KEKW

crystal mountain
#

ping me as well plz!

elder kettle
#

You could write the renderer in C++ and standardize on a C API that you call from zig

magic talon
#

Let me know when you make a new thread so i dont miss it

delicate delta
#

I am currently learning CPP KEKW

magic talon
#

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

magic talon
#

They made it seem like they skipped that entirely

magic talon
#

I ordered the version with the artbook just now

#

How did they even produce an artbook, after the fact?

harsh elbow
#

it probably depends but I think they just scrape together all the promotional and concept art then write some blurbs

clear cairn
#

what's the performance difference between zig and C++?

delicate delta
zinc trail
#

Is this oblique projection or just a basic clipping plane

delicate delta
zinc trail
#

Clipping planes are so helpful for things. They are cool

queen hinge
wild ember
#

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