When implementing light mapping for game engines, mesh instancing requires that each mesh node (instance) maintains its own UV island and light mapping data, rather than sharing data across all instances. This is because each instance may have different transforms and lighting conditions, requiring separate light map calculations. The developer encountered challenges when trying to share light mapping data across mesh nodes, discovering that each instance needs its own UV mapping and light map data to correctly render lighting on multiple instances of the same mesh.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
[Untitled 3D C Project] Some Collision and Mesh System Work
Added:Alrighty.
All righty. Moving on with our lives here. Um, so something that I um that I've noticed now with the lay map is that we are suddenly very blocky. And so I want to figure out why that is.
I think that it's my absolute goal to figure out why that is right now.
Um this is with just direct lighting. So no indirect or anything.
Um, and so let's try and figure out why that is. Something that I noticed earlier that was happening.
Um, I'm not sure why, but it was it was strange. the the tixels are like super um Okay, I just fixed it. Digit argument two too. I just fixed it. It's the blur. It's the blur.
Okay, so it is the blur that's the problem. So that's what I wanted to to figure out before I got into it today.
Uh okay, so that's that's going to be a part of what I have to do today is the blur. Uh what I'm going to do is I'm going to figure out a way to basically uh during light map generation for each face I'm going to cache um lists of indices that are the tixels that are within the face. And so we'll just walk the adjacent triangle uh adjacency map to figure out during runtime what the what we need to uh what we need to uh smooth over. But you do see that the that there are those harsh edges. And the reason why is probably this albido thing. uh we're sampling just um at each texole rather than uh bilinearly sampling. So that's probably what we should do um to remove those. Um so I should make a function that does that. Before I do so though, I want to I copied from the Ericson book this closest point on triangle implementation and then that's what I'm going to port over because apparently that is going to help fix the collision issues that I've been having with kind of porting the old engines um collision logic to this. And so this is apparently the [ __ ] So we're just going to try and port this over and see if this works.
Um so so I mean let's let's give it a shot, right?
Let's just take it one step at a at a time and not not get overwhelmed, right?
Because we have to we have to have our own conventions for everything. And so I I just want to make sure that we don't [ __ ] anything up.
I wonder if everybody just copies this what word for word or or what the deal is. But let's just give it a shot. Give it a shot. Give it a shot.
It does seem pretty expensive, but if this is this is what what helps it. I did I did read, you know, the basics of what it does with the Voronoi regions or whatever, but V at this point is is a float.
I don't know why I wrote it that way.
I kind of wonder maybe I should make macros that are kind of like operator overloading because that would help with the verbosity of the code for sure to some degree in in the engine stuff that I do.
I don't really know what it would entail though.
But it it maybe is useful possibly.
If this doesn't work then then I don't know what will.
But apparently it's a thing.
That was a right. Yeah.
This is why I hate comments on the end of lines because then you do capital A in Helix and then it just ruins your whole day.
I wonder why there isn't a C.
Uh, why there isn't stuff with C.
Unless I [ __ ] up.
I don't think I did.
We can, of course, just undo and make sure.
No, I didn't [ __ ] up.
It's just all the projections happen from C on the inside. I guess that's fine.
And then here's the denominator at the end. And then he wrote this one this way.
You silly silly silly silly goose.
This is the thing that I do hate about C that you do end up with a lot of things like this and it's like you know the but the alternative to that is operator overloading which is also dog [ __ ] So there's really no happy happy zone for me.
This is similar to what I had before. By the way, it's just it just deals with a lot of edge cases. I think basically what I was doing was I was doing distance to the edges and then distance to the points and then projecting the point onto the plane and then returning the distance that was the closest.
Um, and just for the for the sake of testing this out, we will be doing that.
And you know, hopefully that that handles it.
I have no clue.
Okay. Well, we aren't falling through the ground.
Yeah. I mean, I think it's working. I think it's just my uh my resolution code is the problem now.
If I just do one iteration, then it'll probably be be permanently fine. I think the problem is that it hits infinity.
Yeah.
It also is sort of bumpy.
Let's try that.
Or if it's greater than 0.4.
Wait, I'm being [ __ ] stupid. Oh, no.
Yeah. Yeah. Greater than. Yeah. Let's try just doing this is greater than because this is technically it should be that that's our radius. though.
Okay. Well, that's Well, that's that's obviously not [ __ ] correct.
I wonder why it's so bumpy.
Maybe I did transcribe it wrong. I'm not sure.
It goes bumpy when it when it hits one.
Why? Why would the distance be one ever?
Huh?
I need to do more testing with it.
Maybe I just need like an epsilon because everything is like really close to 0.0.4.
No. Yeah. No.
Yeah. Yeah. Yeah. Of course, this is not going to work. Yeah.
Because then it's just going to wait till the point where it's at 3.8 and then push you up like here and then it pushes you up.
What the hell?
My terminal just stopped scrolling.
Windows terminal. Windows terminal. I saw a 3.1 somewhere.
Yeah, right here.
You're learning Rust. All right.
0.31.
Yeah, it goes 0.35 and then 031.
Yeah, maybe I transcribed it wrong.
Or maybe I'm supposed to be using Maybe I'm supposed to be using 0.4 squared.
Let's try that.
Trying to learn Rust. Yeah, Rust is cool.
Yeah. No, this this is this is completely [ __ ] Definitely not.
Definitely wrong.
I could square both.
Yeah, it is.
If I had to guess, it's when you go down to 3.5ish.
Huh.
ISF code term stop using Steelix. Cool. Yeah, ISFA is really good.
ISFA is really good.
You should you should stick to to learning learning a language though for sure. I think um at the end of the day I don't I don't really think the language you use matters that much.
[ __ ] Yeah. Yeah. I I used it. It's a bit It's a bit too orange for me though.
But I mean that might just be a skill issue to be honest.
It is a bit orange.
Singing mansion. Yeah, soding is awesome.
I wonder what part is exactly giving me troubles.
It's kind of hard to know.
ACW A+. Yeah, just making sure that I did everything correctly. I think I think I did.
ABV plus.
Yeah.
Yeah. I don't know.
It's It's pretty much working. It's just um Let let me try something. Let me try the point and triangle test on top of this. Actually, that might actually be the reason why we may be getting stuff that we're not on.
No.
Yeah, it's in between the edges of triangles.
Yeah, I may have to do a bit more research. I was just doing this. I I just kind of like sat down at the computer and I just like did some quick Google searching and then I found this formula and people on some forum saying, "Hey, just use this formula, bro."
And so I was like, "Okay, I may just like try and implement that real quick."
But it looks like not the case.
Maybe I I'm stupid for thinking that just the formula is going to fix all my problems. Let's try it without the BVH.
Right now, the BVH is obviously dictating what triangles we test. Now, we're going to be a lot slower doing this, testing every goddamn triangle. But and it's completely smooth. Okay. So, it's not the formula.
It's not the formula.
It is 100% our uh our BVH.
Let's try with the just the point test and not the ray.
Holy [ __ ] Okay. Okay. Okay.
So, you know what I what I um what I realized that you can actually I was thinking about this last night. What you can do is you can take a bounding box and then just um just stretch it out by the player radius afterwards.
Um which is something that I didn't consider. You could technically also do the same thing though on the initialization of the bounding boxes which happens down here.
You could just add 0.4 4 to them.
I'm just going to do 0.41 just to be safe because 0.4 is player radius. So player radius is now always going to be in a bounding box. Well, that's it's it still is [ __ ] awful though.
Okay. Well, maybe that idea doesn't work.
[ __ ] This file is already too big for me.
Really?
It's like exactly the same.
Okay, let's see if both uh start and end points are in the are in the bounding box.
See how we we are getting like so close to the ground every time.
That's how that's because the bounding boxes are so constricted to the triangles.
Oh, you know what I just realized? Just because we we artificially uh make them larger at the end doesn't actually mean we artificially make them all the interior uh bounding boxes. we we aren't actually changing the interior bounding boxes, which is what we want to actually do because we're testing all the interior ones as well. So really what we have to do is is do that here.
We have to do this here and then artificially stretch it out later. We can also just premputee that. But just just for my proof of concept here, I need to I need to give this a shot.
All right. Now, now this should work theoretically.
Yeah. So, it does. It does.
The reason why it's so slow is because of the us printing out everything all the time.
But yeah, this this seems completely completely completely working. Okay, so it wasn't Ericson that that had a problem. It was my BBH traversal that had a problem. Also very sad to to know that my uh my space bar on this keyboard is going after many many years.
So it broke earlier and it just hasn't felt the same since I had to kind of try and fix it. But yeah, it's kind of sticky. Um all right. So cool. We got the we got the collision fixed after yesterday having a whole thing about it. I think that this problem was definitely a part of it.
Um just before we move on though what I want to try is we already are being doing it uh we already are uh doing it continuous. So that's uh that's that's that's all of that. So that's that's cool to get that figured out. Um I guess next we can do a like uh some other stuff. Um part of it uh of what I wanted to do next was getting by linear filtering for when we sample the albido from the texture in the light mapping.
And I'm just going to copy the exact same formula that I use uh down here to do it. Um I'm probably going to put it in its own function, but it's not going to be simple since we're sampling from a texture.
Um, so it's not going to be simple at all because we're going to have to do some uh some interpolation.
So, let's figure out how to do it. It's not going to be easy, though.
Yeah. So, we're going to do the typical um the typical stuff here where we we floor it and then take the plus one and then we clamp.
wants me to make my computer in Polish so she can read your messages on Discord. That's funny. What does she think you're saying on Discord?
Okay.
So, we don't want to do this o yet over there. We want to do this down here.
And then we just need a sample at each of those instead of hold on.
No. Yeah. So this needs to be multiplied before it gets okay. So vect cord equals um UVs.x.
It's just going to be this actually.
This. See this? I'm not even clicking right now. My mouse is going, my keyboard's going, and I have no money to replace them.
[ __ ] off.
I forgot what I said about the soding theme. It's just too orange for me. But I I mean, that's just just a personal thing. I thought that his was more green, more uh more white and green from what I remembered it as. But maybe I just remembered it wrong. But I think I think if I make one again, it's just going to be plain plain white and green.
I think um so it's just not going to be not going to be casted to int right that's the only difference.
Did I say gween?
Sorry.
Okay. And then you just do this to to do the interpolation.
Except here you have to do the funny the funny thing.
Oh my gosh. See, I'm not even clicking when it does that.
I'm just going to do it this way. It's going to be really really shitty and slow, but then we can put it in a I didn't even click there and and I went down there.
It's kind of Yeah, this computer is falling apart at the seems lately.
Yeah. So, let's just get do do this and then we'll just do What do you mean? No.
What do you mean no?
Okay, now we just need to do that three times.
I didn't say queen. Oh, thanks. Thank you for uh for having my back.
See one and then X zero and then uh almost done and just one more.
This is one and one. Okay.
And now our albido equals that. And that should be filtered.
Okay. I think I did everything correctly. This is supposed to be uh diff diff height and diff width, which is the just the width and the height of the diffuse texture. That's what we're sampling.
And yeah, looks a lot. There are no more uh weird um there are some drifting with the movement.
might be one at at the point where you should probably like project against the the surface again.
Whatever. I'm not going to worry about it. I'm going to reddo all of the the movement stuff at some point. Anyway, but yeah, to give a side by side with what it was before, we can just um we just get rid of this. Oh, wait.
This didn't actually do this. Oh.
Oh, my bad. We That wasn't it at all.
Okay, so this is actually still kind of shitty because you can still see the uh Those black lines are where the black lines.
They're black lines.
What black lines?
Oh. Oh, in the Yeah, I can get rid of that. That's just the That's just the player hitbox.
That's just the player hitbox getting rendered.
I should probably get rid of that. I'm just so used to it and not and I don't don't even think about it anymore.
Yeah, it's kind of it's it's interesting because it kind of like swirls around because it's a convex hole.
Yeah, even with bilinear filtering, you're kind of I mean, we do have like a really low tixel size, so that's also a part of it. But yeah, it's it's not great. We can kind of like check how bad it is if we just use the light map. And that should show that it's pretty bad. See, that's pretty bad.
But I mean the tactile size is so low that I can't really I can't really do much much about it. But I believe that that does that that does match up with what we're what we're seeing, right? That isn't like it isn't off, right, with the with how the texture is, right?
like the light stuff was over here.
Yeah. Yeah, it does it does match up.
It's just um it's really that you can see the they can see the edges that's the problem.
That's really the problem.
Yeah, I don't think any amount of filtering is going to solve that though.
With a larger tixel size, it's fine. But yeah, what are you talking about? What is What was that? What is that?
ASMR.
What?
Yeah, I don't know. I think I'm just going to move on.
And yeah, I will get rid of the black lines. Sure.
Let us see where that is. That's right here. Okay.
I mean, we do have a really small texel size, but should be able to get away with it.
Maybe maybe it'll get better when we have blur. Maybe it'll get better once we have the blur. I should focus on getting the blur down and then we can worry about it. Okay, so the blur is actually really tricky to do because we have to go across triangles. Um, so we have to figure out how to do that.
There's so much water. Why is there so much water from my ice cup?
What are you smoking?
Okay, so each triangle will have the indices of all of the tixels that it has. I think what we're just going to do what what is on the UVI?
What is on the UVI again? It has the UVs, the rect, and then a vector for the triangles, which is size T.
We can just during light map baking, what we can do is Allocate a buffer to the size of tries.
A buffer of a buffer of buffers of of indices. So it's going to be Each triangle allocates a buffer, pushes on its indices, its texels.
This is going to be confusing.
It's this.
So for each UVI during light map baking, we will allocate on UVI uh texels.
We will calic um to to tries count.
We will cal that many vectors and then per triangle we will a knit vector for whichever one it is Amber alert. Okay. So per triangle we will initialize a vector of new tixels and then per tixel we will push them on here and we will push them on at the end once we're done with it.
We will pointer vector expand uh tixels by one and we will set idx equal to index.
Okay.
This means that at the end we have to free all of these, by the way, which is what I'm going to do now.
Um, at the end we have to free all of them. We can free them in here actually, which is fine.
Uh, let me just grab the the tixels thing here.
And from here, we just if tixels if texels buffer free tixels buffer, that's absolutely fine.
And then we want to um Okay. Well, there's just a problem that I just figured out in my head, right? You of course need to make sure here if uvi tries count is greater than zero.
I didn't really assert that before.
Because now we're going to free it. If UVI, you have to do it at the end, of course.
Texels.
And no memory leaks because we're smart programmers and we freed everything.
Okay. Now, now that we have our tixels per triangle, now we need to blur across every triangle, every every tel across every triangle.
So, we can build on this blur, but it's going to be different.
It is going to be different.
Instead of going by rect and padding and all of that, what we're going to do is go per texel and surrounding texoles on the adjacency map. It's going to be different than this.
Now when I did this in my last game engine, if anybody is here from that period, what I did was I created what what I called blur voxels, which were um literal voxels in in space that were the connective tissue of each of each light map texel to other light map tixels.
What I have now is something way better, which is an adjacency map. Each triangle knows what triangle it's adjacent to.
And so if tixels, if each triangle knows which tixels it owns, then we can simply step through the adjacency map recursively until we are out of range from our center in in a radius. So that's what I'm going to attempt to do.
It's not going to be easy but uh let's figure out where my triangle adjacency is. It's on the mesh itself. So that's something right is we are going to go um how does our blur happen? That's that's something.
We go the blur radius and then we add into act and then we divide by the count at the end. Okay.
So we can do something. This is just a box blur. We can do something similar to this. But yes, so we can just go by islands. This is what I was wondering.
We can just literally go by islands.
It's completely fine to do so.
Completely fine to do so. Okay. So, we can go by islands and then per triangle in the island, which is like the typical way of going about it. And then the good thing about this is that from here we can get the mesh to get the triangle adjacency. And you see where what I'm getting at here. Now, what this won't be able to do, right, is it won't be able to blur across different meshes, which is a legitimate um is a legitimate concern for sure.
There's not much I can do about it, though.
Not much I can do about it at all.
I I really like this this file is is getting to a point, right?
So, I'm just going to get the initialization stuff here so that I don't have to [ __ ] write it again.
Something else that's annoying, right, is that this also some things that I haven't really confronted yet is that our mesh nodes are supposed to refer to our meshes and our meshes are not supposed to refer to our mesh nodes. Our mesh nodes are supposed to be the duplicated data for instancing meshes, right? Um, and instead right now I have meshes that reference mesh nodes just for the simplicity of things. But eventually we want the mesh nodes. The mesh node is what has all the transforms, all that stuff. So, we're going to have quite a refactor to do once I once I decide to do that. So, unfortunately, that is what's happening.
Okay, we don't need this. We don't want to do this. I just want the the boiler plate. Okay, so we're going to loop through all of the triangles here.
But we want to get our triangle adjacency from the mesh for each triangle. So triangle adjacency try actually let's just get it from the mesh up here.
Equals m try adjacency.
And we don't only want to go on triangles that are adjacent to this because once again triangle adjacency is an edge that is shared, not just a point, right? So, so we want to recursively walk it until we get a triangle that has no um no tixels in it that we blur, right?
We want to walk it in in a for loop, right?
So we'll have a function that processes the blur and adds on to a vec 3 and then also has an int pointer that it's adding on two for the current dexel.
So let's do this. Right. So we'll have a um process um triangle blur.
And this will take in obviously the triangle adjacency.
Um triage uh the mesh Well, the mesh gives you the triage, so we don't really need to do that.
I already have something that walks it and does the walk coer adjacency. So, I could just look at my implementation here and see what I did.
So I do pass in triage.
So that is that is important.
FS and points are the mesh. Okay. So, let's just do that.
And we will need a ve 3 pointer. Uh, what do I want to call this? Let's just call it act.
and an int pointer count that we're that we're just going to increase right every time we we hit a textole that falls within the range.
Okay. So this is how we get the ad. We get it from the the tri edge by doing this.
And we want to go through tries J, but we also want to process this triangle. So, do I need the Yeah. Edge I. So I need the I need the face face index here.
So this is going to be face index.
First of all, we have to process everything that's within this triangle.
So that's the first thing.
Um, right.
We need to also pass in we can pass in the islands and then from there we can get the Let's just pass in the vector pointer uh taxels and then we'll get the T local equals equals uh texoles by the face idx.
And then we want to go through everything that's in T local count all the tixels that are within this triangle and then we will process them there using this this formula here.
We also need to get though. We need to get light map tixel pointer.
Uh let's call it tixel list just so that you know this is readable, right? And then our actual texels are going to be in here. So, we're going to get our current texle at text index by we have to cast it. So um uh this is going to be size t pointer tl equals cast vec t local dreference t local size t and then we will do tl index by I Okay, we're getting there. We're getting there. This is very complicated, right?
Okay.
So now that we have our texel, we will find the length between this tixel position and our original position which we will also have to pass into this.
It's a lot of arguments to this function. I know. Trust me.
I know. I know it's it's a recursion thing. You wouldn't understand. Um, so we're going to use the length of sub uh the t pause and our original pause and then also be taking in a radius.
If this is le is greater than radius and then I copied I copied this earlier.
Yeah. So this is just going to be this.
Um this is not a fast way of doing this but just for now we're we're just going to we're just going to do that.
Is this squared? No, we square root it.
I definitely have this.
There we go.
Okay.
So now what we do is act x plus equal um t I need UV buffer in here.
Oh my gosh. This is crazy. This is crazy. This is crazy.
Hey, if the code works, you know what I mean?
It's so nice that Clang tells me that this is a this is a thing because I remember distinctly being a young programmer fellow and making that mistake.
So, it's nice that Clang tells me that now after I've learned my lesson, you know what I mean?
Okay. So, after that, we'll have a local count.
If local count then we want to propagate.
If there is no local texels that we processed then we just want to cut it off. Right?
We will take this edge and then we will for loop through it similar to I do to what I do here.
and then we'll just call process triangle blur on all of these.
Right.
And then you just have to write out the function call and just pretend pretend like everything is fine.
The texel list is the tixel list of the the master txle list. So that's fine. This is the master one. That's fine. That's fine.
The phase index is going to change. It's going to be the triad. It's going to be a i.
Then the triad is fine.
The act, the count, the pause, and the r all stay the same.
That's quite a function call. That's quite a function call.
Okay, we're making it happen. We're making it happen.
And we're just going to parallelize this and call it from here. And I think that that then we're good.
The only problem the only problem is that now we have to bring everything into this which you you hate to have to do.
Also, this we shouldn't call this tixels. We should call this UV buffer.
Okay. I think that actually you just do that like that. But okay, so we're gonna have a vec 3 act equals zero and ve three at a int count equals zero.
I'm just realizing something now is that I have to find a way to avoid the texel adding into the texel that we are currently in.
Don't know how to do that. That's I don't want to put another argument into this function if I can avoid it.
Also, I'm realizing that I need to iterate the tixels out here as well, which is pretty cursed to be completely honest.
I wish I could just call process triangle blur on it. I think I can.
Let's just pass in a skip.
a skip idx. Just pass in a skip idx.
If TL I skip idx continue just so that we don't add ourself into our our blur.
Light map text pixel pointer text. Okay.
V buffer face idx tries a try.
pause.
Okay, I have to I have to figure that out on a sec.
Okay.
If count is greater than zero, then we equal act divided by count.
Maybe we do want to have hold on. I think we actually don't want to have a skip idx.
Yeah.
If count is greater than zero, then you just want to add into this.
Oh, we need a temp. We do need a temp.
You're so right. You're so right.
Actually, you are so right.
I don't know why I used to mem copy things like that. Why are you mem copying, dude? Just literally swap the pointers and then free the free the other one. Am I stupid?
I think I'm I was just stupid back then.
Okay, we I mean we have our function. We have our function.
LD text LD atlas UV buffer and an R. This is in a radius in world space. We're going to try one first.
And we're going to see if we s fault or I mean the now that this is doing so much there's just a possibility that this takes forever.
Is there a bug in here?
The window open.
Okay, we seg faulted. So let's see.
TLI.
Okay.
I don't want to talk about it.
Okay.
I knit it to size T.
I cast it to size T. Expand it.
Texels one.
Okay. I may be indexing it by tries J and not uh Texels J.
Let's see.
I index it by J out here.
Maybe I go by face idx.
instead of the idx instead inside of the island.
Oh [ __ ] Oh [ __ ] Oh [ __ ] All right. This idea isn't going to work with the with the tixel list on the UV islands. I don't know why I thought it was going to work, but yeah, it's definitely not going to work.
It needs to be per triangle per mesh. We can't go because the the adjacency map only goes triangle to triangle on the mesh, not actually on the on the tixels. Um, where am I going to put it is the question.
Where am I going to put it?
I need to store it on the mesh itself.
That's the only That's the only answer actually.
Yeah, it needs to be on the mesh itself.
We can free it after, but it needs to be on the mesh itself.
And since this isn't this is going to be instance data Since it's instant data, it should technically go on the mesh node instead of the mesh. We can get a little bit of headway on that refactor by doing that.
God, this is such a pain in the ass.
Well, it's not going to code itself.
It is not going to code itself.
Can I run my code? Uh, not right now.
I'm kind of in the middle of something.
I mean, sure if you want me to comment this out and run it and see. Um, yeah, per node. We're going to need it there.
It has no um it has no indirect lighting turned on right now. So it's just kind of boring, but that that's it.
So per whenever we get a new mesh node during light map generation, we need to allocate it onto this onto there.
In fact, let's go to UV island and then take this off of it so that we can remove all the references to it.
All right, let's do this. So, we will have a vector out here, unique mesh nodes.
And this is just going to take uh tell us which mesh nodes have been emitted yet. We're going to knit this um we're going to knit this like that.
And then I [ __ ] hate how this doesn't Clank doesn't like my macros for whatever reason. Um if uh it equals the current mesh node then unique equals false.
If unique, we will uh vector expand by one.
Okay.
And if it's unique, we also need to uh allocate onto the mesh node um the the buffer And it's going to go to the meshtries.comount.
And then we want to get that vector. Um, incal pointer types. Okay, so Oh, that's a bird. I thought there was a really big bug outside my window. Um, we're going to go tries J. That was the whole point of this, so that we can go tries J now. Um, okay.
So, that works. The problem is that now freeing them becomes a [ __ ] pain in the ass.
freeing them becomes an absolute pain in the ass.
It's actually not that bad. It's just not code that I want to write right now, if you get what I mean.
All right, let's cast this back.
Uh, so that I don't have to write that [ __ ] line again.
Wait, hold on a second. That's not actually There we go.
I I always have to check here if m tries count is greater than zero, you know, just for whatever [ __ ] reason. If you have a mesh with zero, else m texal list needs to equal null.
Okay, that's handled.
Then you don't go through the count. You go you need to get the mesh.
You need to get the mesh from MN mesh and then you go through the mesh tries.
And then you have to get the the MFS from here.
And then you go if MN txal list J dot buffer free MN talist J buffer We have to make sure that they're initialized per triangle or else we're going to seg fault. I think that we do that for sure.
We know we don't.
It's cal. It's cal. It's cal. It's cal.
It's fine.
And I don't want to talk about it.
You broke my heart.
Okay.
All right. We've freed them. We've successfully freed them. I feel free. Do you feel free? Do you feel free?
All right. Sorry. I'm a bit unhinged right now. This is like really, really crazy code. Okay. So this is going to be mn text list now.
Um and do we just pass it along and it's fine and now we can just index it by face idx. Is it really fine? We go tries Jay.
Is that fine?
Okay. Apparently we're not fun.
Let's see.
Caspect T local size T 1070 [ __ ] The [ __ ] are we talking about?
Do I not allocate this properly?
Let me see if I just allocate it cuz if I allocate it, it should be to the right size. I do allocate it. I allocate twice which is exactly the correct obviously we don't have any problem here.
It's the first time you know allocating an array of vectors, I guess, like this.
But Do I call blur after I free? No, I don't.
We don't.
I'm just going to print out the the indices.
set index zero. So the very first one text is null.
How is it null?
It gets allocated.
Oh. Oh, no. No, no, no.
Oh [ __ ] it size a vector pointer. Oh, or No, it isn't. No, it isn't. No, it isn't.
Let's Let's see if it gets set to null afterwards.
No.
I don't know. I don't know what the what the problem is. I I don't I don't get it.
I need to test something.
And how I'm going to test it is I'm just going to comment out the initialization stuff and just see if something I do at some point makes it null.
It's never not null.
What do I do that that makes it null?
Let's Let's get rid of all of this, I guess.
[ __ ] What in the middle makes it null?
I feel like I'm losing my mind.
Why is this null?
should not be should not be it's going to be something dumb once I figure this out.
It's going to be something so stupid. I feel like Oh my gosh.
See, that's why. Yeah, we're just going to pretend like that didn't happen.
We're just going to pretend like that didn't happen.
Oh my god, I'm so [ __ ] stupid. It's all right. It's all right. It's all right. It's fine.
Yeah, I casted it to the wrong thing.
I even I even thought, did I cast one of these vectors to the wrong type?
I thought that.
And Let's see where we break this two in math f process triangle blur.
This two sefold.
This smells like a recursion thing.
A B Seg fault.
Okay.
It's a Seg fault. And like why is it because of t pause?
All right, let's try with a lower radius, I guess.
Try with a really small radius and then see see again.
Yeah. Yeah. Yeah. Yeah.
Oh my god. Oh my god. I didn't press the [ __ ] I think that it is an infinite recursion issue somehow.
No, it's the same. It's the same seg fault, but there's no dividing by zero or anything.
The only thing I can think of is that like there's some overflow or something.
So I can just like print vec 3 with both of the positions and then see if we go out of bounds at the point of the seg fault.
That's what I am going to assume happens.
Nothing can ever be easy. Well, you know, sometimes it is, but I don't remember those times. I only remember when things are hard. See, this is the downside of this is that now we're going to print out everything instead of just the seg fault thing, which is Oh, you know what? I just realized we're just going to go back and forth in between the same the same triangles again and again.
Oh, we don't actually Oh, how do I do the co-planer adjacency stuff? Do Do I have a list that I'm checking every time so that we don't add the same triangles?
Build adjacency map or not in here. in here when I do this is similar plane.
Oh, I do have a trial list.
I do have a trial list.
Yeah. Yeah, that that one.
Yeah, you gota you got to do that. You got to have that. That one's absolutely necessary.
I'mma leave that there just in case just so that we we can come back to it.
But yeah, we probably do need a list of triangles that we've tried yet that we've tried so far or texels. I'm trying to figure out do I want to do the texels or do I want to do the triangles?
For now, we'll do triangles.
Actually, you know what? Yeah, let's just do do this up here.
And we'll just at the end of each one, we'll just set trilist count equals zero.
We just do it this way.
so that we don't have to keep resizing a vector. We just have a vector that just goes and deals with things for us.
That's what I'm going to call it. A vector that just goes and deals with things for us. Okay. So, we're just going to call it try list and just like pass it in there.
Does it have to be a vector pointer?
No. Yeah. Yeah, it does. It does.
Um, okay.
And then we're just going to go through it.
I knew that this wasn't going to be trivial, but I I didn't know it was going to be this hard.
Um something something of no one told me that it would be easy, but no one told me that it would be this hard. something. Cold play.
Okay.
All right, there we go. I implemented it.
Why are we mad? Are we Oh, because I didn't put it here.
Okay, I implemented it and now we will no longer loop infinitely. Right?
Correct.
Correct me if I'm wrong.
Okay. So everything is black. Um, just to make sure that we're that we're alive, I'm going to do I'm just going to do this and we can see if we're if we're alive or if it's just the light map is zero.
Okay, so that's what I was worried about. That's exactly what I was worried about. See, GDB isn't telling me anything.
GDB, if I run it with GDB, it says, "Yo, it's all good. It's all good." It's not all good. Trust me. You know, if it was all good, then we would be chilling. We're not chilling. We're not chilling.
We need to make sure that it's during blurring that the problem is and it's not like some freeing thing.
Okay. How about this? How about this?
Let's not actually change anything.
Let's just do the iteration.
Okay.
So it's this Oh, right. We don't We need a double pointer. We need a double pointer then.
Oh, we need a double pointer then.
Yeah, we do. You're so right. We do.
You're so so right. We do.
You're so right. We do.
You are so right. We do double pointer magic.
Damn. Why does it look like ass though?
Why does it look like complete [ __ ] trash, bro?
It looks absolutely ass.
Larger blur. Larger blur.
Oh [ __ ] With a large blur, it doesn't even look that bad.
I don't want to talk about it.
We do have some little ink, you know, little ink, little ink, you know, going on. I ink.
I wonder why that is.
H little ink.
See over there you get a little ink.
Overall, I'm surprised. This actually looks good. This actually looks not bad.
Yeah, I don't know what that is. That's only with the blur, right? Let's just make sure that that's only with the blur and that I didn't change something else somewhere.
That is indeed only with the blur.
Boot with the fur. With the fur. Yeah, sorry.
Oh, if count is greater than zero, else temp idx equals uh UV buffer tx.
No, stop.
I don't want to talk about it, bro. Now, how those have zero count?
What?
Why does that Why did it break?
Why did that break?
Oh, you have to do it like this.
Yeah, those are two different things.
And see, it's just a Z thing.
Wait, what the [ __ ] are we talking about? Why is that out of bounds?
Let's just prove my point here. Let's just prove my point here so that I I know that I'm that I'm a sane person.
Now, now the the corner should end up white.
Okay, now something is I broke something.
Wait, what?
What?
This is just working.
Or did I have blurring off? Maybe I turned it off and I didn't even realize.
No, I definitely had it on. I definitely had it on because it was blurred.
Because it was blurred.
Okay, so this works.
Except sometimes it doesn't.
Okay, this proves my point with the with the ones because that that gets a little bit and then that gets a little bit.
Yeah. Then over here we have that and that and that. Yeah. So, this proves my point.
But you're telling me that I can't go UV buffer TX.
You're telling me that I can't do this.
I think Okay. I think the the syntax is that.
There we go. Okay. It took me a while to figure it out, but that's that's it.
The real question is why is count zero there?
Also, that doesn't look it doesn't look right Really?
Is it even possible that that a given triangle would have a count of zero for it?
I don't think so.
Maybe we shouldn't be going on by local count and I don't know go based on triangle centrid position versus it But this obviously isn't working.
I don't know why it looks brighter.
Here's a test. Here's a test. Here's a test.
Let's just do this.
Let's try and see.
Yeah, it may just be that the albido at at some points is just brighter. So that's actually probably fine.
What is concerning is that the TLO count for the first one probably goes to zero for that.
Yeah, obviously the algorithm is working.
Maybe I should try a different heristic than local count greater than zero though.
Yeah, but you can't go based on centrid on a triangle centrid because a triangle could be very large, right?
Triangle could be very large.
I wish I could find a way to to figure out what's happening. if it's a not unique or if it's this. Those are the two options because a tixel should always have itself the first time. When I go to process triangle blur, it should always have itself.
should always have itself.
What I'm guessing is is happening is that there's a triangle with only one singular texel and it determines that itself is somehow out of range.
I could just bump the radius up, of course, but I I don't want to do that.
I want to figure out why this is happening.
I could move I could move this in. I could move this in for now just to make sure there is no What?
Wait, really?
Really?
Really? Wait, really?
Really?
Really?
Really?
Huh?
I guess setting the count to zero isn't enough.
Why?
We should only be iterating to trial count.
and vector expand.
Vector expand only goes based on count.
That's bizarre.
That is bizarre.
I don't want to be freeing a buffer every for every tuxle obviously. Like that's stupid.
Why is why is there like the is there something that I don't understand here?
if you have a a buffer and account.
Like what?
There's something that I'm not seeing here with this.
Like why why does it only work with a fresh buffer every time? Me setting the count to zero should absolutely work. Absolutely.
And it does like 99.99% of the time.
So why when does it break?
Maybe it overflows or something.
I don't cast it to the wrong type, right?
No, I do not.
I cast it to the right type.
Okay.
Yeah, it's weird.
If the count is at zero, then it should on a on a fresh one, it just shouldn't shouldn't iterate at all.
So, this is this is weird to me. We can in fact we can let's print let's print the the count just to prove that somehow this isn't at zero.
No it yeah it it is high.
Oh. Oh.
Oh. I'm parallelizing it. That's why.
That's why.
Oh, I'm parallelizing it.
That would be why.
That is why.
Okay. Yeah. I'm stupid. I'm sorry. I'm stupid. I'm sorry.
I'm officially very dumb.
Very, very, very dumb.
So, there are still lines and stuff.
It's not nearly as bad as it was before.
at a higher tixel size then it's going to be a lot better with with any more blur. I think that it's going to get washed out a bit. We can try it too. Two is pretty heavy and it's going to take a long time to blur.
I mean, and not that bad.
Yeah. Now the the alias aliasing goes away.
All right. Um, well, that took way longer than I expected it to, even though I knew it was going to be a pain in the ass.
At least I got it done, right?
At least I got it done.
Yeah, the collision stuff is kind of annoying.
Um, well, now that that's done, I think the light mapping is kind of, you know, at at a good stopping point right now.
I'm kind of happy with it. Um, we got a like a cheaper way to Now, of course, like we can't really So, if we're going to like do OM here and we want to do it fast, we can probably do this. This is probably like the fastest way of doing it is per actually yeah per per thread per triangle just have let's see how fast this goes in comparison.
Yeah, it's a bit faster, right?
Um so you can't do that. It's of course, you know, a lot of Malik and free, but, you know, at the end of the day, it's it's whatever. I mean, if you have like a P thread thing going on, then you could, you know, do it uh do it more more specific, I guess.
Anyway, um pretty cool. Um though, moving on with our lives.
Actually, you know what? Before we we move on, move on. I want to test it with the indirect light.
just to just to see what it looks like.
I just commented in like an insane amount of code that's not relevant anymore.
Um, so there's two things that I can work on next. I the whole point of this engine is I want it to have very realistic movement like insanely realistic. I kind of want to make like very trippy visuals but with like very realistic movement. Um and have that that kind of contrast. Um so I don't really know how to do that.
Um, I've done like a tiny bit of um of of research on it and gotten like really nothing back other than, oh, you can make the headbob with inverse kinematics, you know, like really I don't I don't think anybody's kind of doing what I want to do, which is literally have um a system for having limbs, right? That that each have their own response with footsteps and like key framing kind of like where their position is in real time, right?
Like so if you like start moving, right, your left foot goes, you know, and then it reaches and then goes down, right?
And then your right foot goes once once the left foot plants, you know, after a certain amount of time. Like that's kind of what I want to do, right? And then each have offsets so that, you know, the left foot would be higher on this than your right foot here and you would have like a little bit of a tilt or whatever, you know. Um, that's kind of what I plan on doing. though doing it seems pretty pretty complex. So, I don't know if I'm going to get into that right now, but that's the eventual goal.
A big refactor needs to happen though with um with obviously the mesh instancing and stuff. Um I don't really have a way of having multiple instances of the same mesh with different uh transform matrices which is pretty important actually um to have that.
And so we do need to figure that out. And that's not fun code to write, but it is necessary.
So really all of these take in mesh right now, but they should take in mesh node. Mesh node is the instanced mesh.
Mesh node should have everything also.
They should be closer to each other than they are right now. That was kind of bothering me earlier how mesh node is all the way up here should not reference the mesh node because the mesh node is the instance of the mesh. The mesh may have many mesh nodes, right?
Um, I just want to check inside of here.
All of this stuff is fine to be per mesh. Yeah, it's just mesh node that needs to go. Mesh node needs to go.
And then this will reference the mesh.
And that's that.
Just getting rid of that should give us a bunch of errors that we can resolve each. Right?
So right here where this MB goes to mesh node, our mesh nodes always have to go to the mesh, not not otherwise. So the first thing that needs to happen is that meshes don't make mesh nodes nodes meshes don't make mesh nodes.
So any reference of a mesh node inside of here needs to we need to get rid of it. Right?
When we create a new instance of a mesh, then we will do all of this code. But before then, we need to it's it's when we load in an object file, it will just put it as a mesh. We now have a mesh, right?
Um, but we need another file, another uh function that creates a new mesh node for a mesh that we have loaded in.
Let me see my asset strct. asset truck.
Can you [ __ ] Thank you.
Mesh indices, right? Yeah. Because an asset can have multiple meshes. I think on mesh how we want to reference them is by a name though.
and we'll just leave it 128.
And then when we load in a mesh, we just want to just want to load in to the mesh name.
Let's get rid of current mesh node. No more errors. Fantastic. Okay, we're going ASMR mode because no one's here.
Okay, so now we need to have another function that initializes a new mesh or initializes a new mesh node.
I'm realizing now that that the light mapping stuff is going to have to we're going to have to refactor a lot a lot a lot a lot a lot.
Let let's go into load and let's Should I put it in load or in knit? I'm just going to put it in a knit.
We're going to have the name that we're going to search for the mesh with with this name. Um, we're going to have uh the TRS for the transformation and it's really it.
Let's get the code that we had in load that was over here. Let's just copy and paste this over there so that we don't have to rewrite a bunch of boiler plate.
Um Okay.
We need mesh to have an asset ID.
I don't want to just take in a TRS. I want to take in each each vector.
This is how I did it in my other engine.
That way we have something to set it to.
Okay.
That's the function.
Update water fft. The [ __ ] is that doing here?
Okay, so that's the function that gives us a new mesh node.
I also kind of want to have on this a an active boolean.
Reason why is because we may need to have like a free list later and I think it's pretty it's pretty nifty to just have it for now.
All right.
So we will have now that we're going to knit a new mesh node for this Are both of these going to have the same [ __ ] name? I just realized that they're both going to have cube. [ __ ] [ __ ] Yeah. Yeah. Okay. So, fine. We'll make it more complicated. It has to be more complicated because why why wouldn't it be more complicated? This is going to be mesh name, but we're also going to have to search for the asset name. And then we're going to look through the assets meshes instead of the global meshes because it's complicated.
I just need to make sure if this need to make sure if our assets our assets do get pop get populated and we do init a vector with the mesh indices.
We need a this as measure indices mi there we go.
Okay. So that's what we care about now.
Now we have this. Okay.
So instead of going the doing this, what we're going to have to do instead is we want to go asset assets and instead we're going to iterate through that. And then once we find the asset, then we'll iterate through that assets meshes mesh indices because you can have different assets with the same mesh name like we just had with cube. So kind of a pain in the ass, not going to lie.
Oh, also I never got the got the current mesh.
I'm just going to reference it by path right now because I think that inside of at least for object files, it doesn't really give you a a thing other than the So, for now, we'll just go by path.
Uh okay. And now instead of casting the ve for this globals meshes, we want to get asset pointer asset equals at assets aid and we will get that assets uh mesh indices. This I'm is writing the same code that I just wrote. We're we're completely aware of that, but we're just going to ignore it.
Okay.
Okay. So if we want to get a new mesh node for this asset with the name of cube and we will pass in the normal vectors for a plate for a object at the origin.
Okay.
I almost set it to zero scale. That would have been bad. Then we can do this.
Okay. So, this is the just the basic cube, right? We're not going to do anything else. We're not going to do anything else here.
Okay.
What is the easiest way we can just draw something to the screen without just to test that we have this working? That's all we care about.
Okay. So there are a few steps. So a knit mesh this actually a knit mesh has to actually happen for the mesh itself.
I believe a knit mesh is how we get the holes how we get the collision uh data from the raw vertices. So this actually needs to happen per mesh um on initialization.
So this actually does need to happen for each loaded in mesh.
I just have it separate because because of reasons If this needs to happen per mesh on initialization, I wonder if I should just h should I do a similar searching pattern for for this or should I just have it implicit from when I load in the mesh on initialization.
I'm getting kind of overwhelmed. I'm not going to lie.
I think what I'm going to do the most the the least painful and the most kind of way that won't lock us into doing something that like immediately what I was thinking like per file that we get in is there a way for me to determine if this needs a try BVH or a GJK hole?
No. You know, like I could flag all of the meshes with the special flag, but that means that every, you know, then we need to like actually do that per file and that becomes a bit messy.
What I'm just going to do is I'm going to make this searching logic to get a certain mesh from a certain asset name and from a certain uh mesh name. I'm just going to make this a function and then we will that's what we'll use in a nit mesh. We'll just call a nit mesh for a certain asset with a certain mesh name and that's what it will be. So we'll do mesh pointer uh get mesh.
We're going to use retrieve mesh by name.
And this will take in the asset name and the mesh name.
And this will just literally do this.
Okay.
Mesh has an ID. Okay.
Okay. Okay. Okay. Okay. Okay.
Okay. So now that this is a function, we need to put this function in the header because we're about to refer to this from mesh. C. We will now be taking in instead of taking in a mesh, we're just going to take in the names, asset name, mesh name.
Very simple. and we will get our mesh retrieve mesh by name. So now everything becomes simpler and we can hash things or you know figure out some other way later with an ID system but for now this is just a way easier thing to deal with.
Okay. So, instead of MB0, we're going to refer to it the same way we refer to it up here.
Okay.
Add mesh to buffer. This is another one that has to be per mesh.
It does have to be per mesh, not per instance, because you're literally uploading the mesh data to the buffer.
The thing is this might be instanced.
No, no, don't don't think of it that way.
The problem with all of this, right, the problem with all of this is that for our light map, we have our light map that is done on a per mesh basis.
Meaning that we can't duplicate lightmapped things without duplicating the actual meshes.
which is pretty [ __ ] That's pretty [ __ ] Yeah, mesh should happen on a mesh basis. This this add mesh to buffer should happen on a mesh basis for sure.
So, let's do it the same way. I'm not really happy about what I'm what I'm experiencing right right now because yeah, I mean it's true like a a mesh if we generate a a light map on a mesh those vertices need to duplicated.
If we have another one, yeah, because it's pervertex data or Or I could duplicate the vertices later.
Yeah, there's no point.
It's so complicated if I do that. No.
Yeah, I'm just going to add a mesh. to the buffer. And for now, everything will be per mesh in terms of light mapping, not per mesh node, because the vertices themselves would have to be duplicated. And at that point, you might as well duplicate the entire mesh.
It's so complex. If I decide to do it any other way, and there's no guarantee there would be any point in doing it that another way.
So, I think I'm just going to do everything everything based on based on the mesh name based on this convention. I think that that's what I'm going to do.
Or I could just like get a handle and then just like pass in a handle here and here and here and just pass around handles instead of all of this is stupid because at the end of the day we're just going to put a UI over this anyway.
And so the whole concept of this is kind of kind of stupid.
We should just have an ability to duplicate a mesh and then the rest of it doesn't [ __ ] matter. I should not be worrying about it this much.
I shouldn't I shouldn't be worrying about it this much.
In fact, yeah, just literally So, I'm thinking way too hard about this.
The VL is a vertex layout. This is Yeah.
Okay, let's let's just see if this works. Just going to have to build the whole thing from scratch.
Camera. Oh, right.
I got rid of all of the mesh nodes.
Oh [ __ ] [ __ ] [ __ ] [ __ ] [ __ ] [ __ ] [ __ ] [ __ ] It's actually not that bad. All we have to do is instead iterate the mesh nodes and then just like it's actually not that bad.
I just I just was iterating everything backwards and so I just have to iterate it like that.
caught up in a bad romance.
Yeah, I've got [ __ ] just everywhere.
It's everywhere. It's everywhere. It's everywhere.
So, when we're traversing a mesh BVH for the lighting, don't we just want to pass in the mesh node?
I think so.
Yeah, we should just be passing that in.
Okay. So now instead of globals dot instead of uh dude this is such a [ __ ] big refactor. Holy [ __ ] Because we have to reference the mesh nodes instead of the [ __ ] Oh boy. Oh boy. Oh boy. Oh boy. This is so disgusting actually. Holy [ __ ] What the [ __ ] did I code?
I don't think it's necessarily my fault.
It's just engines are so [ __ ] complex, man.
It's just ridiculous.
So, this is going to have to change to MNS.
God, we're going to have so much [ __ ] so many big problems. So many big problems.
Not nm mn. Get rid of that.
Incompatible pointer type meshes.
We're going to have some definite bugs.
Definitely some bugs here.
Definitely. I have to remember that we have to actually go onto the BV the scene BVH builder and then make it run on mesh nodes rather than meshes.
Um the whole reason this is right is so let's say you have a crate a box and that box appears many times in the scene.
you don't want to duplicate the vertices that many times. And so you have what's just called a mesh node, right? That references that mesh and just draws it all over the place, right?
But the problem is that my dumbass made everything based on meshes for convenience early on and now we have to do it the opposite way, right?
I am my only my my worst enemy. You know what I mean? You feel me on that one?
I am my worst enemy.
The worst enemy is me.
The so the refactor isn't like that mentally taxing, right? Like it's not bad. It's just that I know that I'm going to miss something and the consequence of me missing that thing is going to be a whole [ __ ] [ __ ] ton of bugs. So that's that's what we have to suffer through now.
Right. Right. Right. Right. Right.
Right. Right.
Right. So UVI A mesh is guaranteed to have at least one mesh node. So each UVI actually needs to reference the mesh node instead of the mesh naturally.
All right. So let's go to the first problem. Right.
Right.
So we need to make this not based on mesh but mesh node. And so build UV islands.
Yeah, it has to be based on the mesh node. Um, Okay, so that's that's one issue resolved. We're going to need to do the same thing everywhere, though. So, we're going to first go to the mesh node.
Why am I making another engine.
Can someone answer that [ __ ] Oh my god.
I have so much regret.
I have so much regret. This is I regret everything.
Why are we doing this? Why? Why did I want to do this? This is so stupid.
It's okay. It's okay. It's okay. Just go just go uh MN mesh. But the thing is I don't know um where that internally is going to hook up anymore.
[ __ ] Oh no.
What the [ __ ] did I do? What did I do?
What did I do? What did I do? What did I do?
Oh no. The text goes to the mesh.
Is it okay for the text? No. The text needs to go to the mesh node. No. No. It needs to go to the mesh node. It needs to go to the mesh node.
Let's change the name of this too.
It needs to go to the mesh node because because it does. Okay. Because it does.
Because it [ __ ] does.
It's complicated. It's complicated.
Solve light source. Okay, that should be fine. That should be fine.
All right. Right. Right. So, we were here. So, this takes in the text mesh node.
Yeah. Text mesh node. And then we get from the MN the mesh. Okay, that's that's solved mesh node.
I have no clue how that's going to hook into that thing, you know, now that you mention it. The hit mesh index.
Huh. Okay.
Okay, that might be a problem.
That might be a problem. That might be a problem.
Okay. So, we need to go into this. We need to go where we hit mesh indices. Uh try uh me mid.
M ID for the mesh ID.
I need the mesh node. Um, can I just go MN ID?
MNS don't have an ID. What the [ __ ] am I doing?
All right. Mesh nodes need an ID.
Mesh nodes need an ID. Okay, mesh nodes will now have an ID.
When we make a new mesh node, we have to set the ID.
MN ID equals there we go. We have an ID now. Okay, fantastic.
So now what we're going to do is we will retrieve that ID.
Okay, retrieve that ID. And so now this hit this hit is going to be mesh mode idx. Okay, we want to be clear there.
We want to be clear there.
Okay.
Okay.
Okay. Okay.
And now it's just MN hit MN hit MN mesh.
Okay. Okay. Okay. Okay. We're doing it.
We're doing it. We're doing it. Okay. So now this is UVI mesh node. And then we will link in with the MN mesh. That one's an easy one. Okay.
We're just going to take a gander through all of the files. And so obviously on rendering we need to go through mesh nodes. That one's an easy one.
That one's an easy one.
Just swapping them around.
Okay.
Now, let's see where we where we're at with the compilation, huh?
The refactor is done. No, you're joking.
Really? for me. No, no, no, no, no, no, no. Of course not. Of course not. What is the problem?
Stren compare 81. Retrieve mesh by name.
Init new mesh node string compare.
Why? Why? Why are we having such a problem?
Can you not do Strillin on on that?
Maybe we just hard code it 127. Huh?
Let's just call a spade a spade just said Claude. What's up, Rob?
How are you doing, Rob? How's life treating you?
I have an I have an illness that makes me code uh engines all the time. That's that's my illness. That's my problem.
So, life's treated me. All right.
What the [ __ ] are we talking about?
What What are we What are we What are we talking like? Do I not know how string compare works or what is the problem?
Okay, here here's here's a question.
Here's a question. Here's a I have a question for you. What did I make this?
Our path is 128. Completely legal.
Completely legal. Okay. Now, let's see what our let's see. Okay. So, let's just let's just make this guy 128.
All right. No problem. I've got no problems. And the other one's 128. So, um, I'm legitimately about to about to take the N off.
I I give zero shits. I don't [ __ ] care. It's all right. I'm upset England lost in the World Cup. Yeah, I didn't watch it. I have no clue what they're talking about. My mom was telling me, "Oh, the World Cup's going on." It's like It's like What are we talking about?
I just realized something. Hold on. I just realized something. We may We may not have a path. Ahu.
Yeah. I I'm I'm completely lost when it comes to soccer.
Maybe it's just like I'm I'm stupid. But like the thing is the thing is with soccer, bro, is that it's like I would get it if it if there were like big score numbers. You know what I mean? It's like you're telling me that on average they score one time a game. Like come on.
Like I'm not going to watch that. Windows 10.
it is Windows 10 because I'm too poor to get a new computer and this computer sucks so bad that the Nvidia drivers on Linux don't work on it and it's even worse on Linux. So that's what I've decid that's what I've uh you know what I came to the realization and now we're back on on Windows. Um forcibly I'm forcibly back on Windows. Let's install Arch Linux.
I I have it Arch Linux on this very machine. Uh but the drivers are not great. So that's I don't want to talk about it.
How you broke my heart.
Okay, so that path does exist.
Okay. So, is it okay? So, we're we're going to do some detective work here.
Okay. So, it's this. It's this. It's this. Wait.
Yeah. Yeah. Yeah. Yeah. It's one It's 100% that. It's 100% that that has a nothing inside of it. Zero zero is inside of this this mesh. This mesh has no name where the streets have no name.
The streets have no name. I just went Oh, um, it's not in this file. It's in load.
What card? I run 30 and also older cards. It's a Windows laptop. That's the problem. I have a 1050 mobile in a laptop that was designed for Windows. A remote should get you 100K a year. It's time, lad. Um, a remote coding job. Well, I think that they stopped selling those once AI came around. At at least, you know, that's my uh you know, I have attempted and I have failed. So that's that's where I'm at.
It's possible.
I spent years trying to get this working on Arch. It doesn't work because Linux drivers don't have the exact version that works with the Surface Book 2, which is like um whatever it is 543.33 or whatever is the exact version that I need. Uh and they don't have that on Linux, so it's just it's just not possible. I know. I've done graphics programming for years on this thing.
It's in AUR builds. It's not the exact version. It's not the exact notebook version. Trust me, it's not.
It's not. It's not.
Okay. So my stretto talk is just is just ill. I think it's ill I think I need to do that. Is that what it is?
You're going to You're going to make me lose my [ __ ] mind. You're going to make me lose my [ __ ] mind. I'm going to go crazy. I'm You're Wait a second.
Wait a second. Wait a second. Wait a second. Wait a second. Wait a second. Is this supposed to be I'm like 90% sure that this this is going to give us the the correct string anyway.
I think it's just going into a bad index. Yeah, exactly. So, it finds the correct it finds the correct thing. It just goes into the incorrect index.
H [ __ ] Um, order matters.
Dude, you're going to you're going to make me crash the [ __ ] out. I'm sorry.
You're going to you're going to make me crash the [ __ ] out. I have Linux. Are you telling me that you just went to [ __ ] Claude and then and then asked it? That is so clawed coded, bro. That is so clawcoded.
That is so clawed. That's just Claude.
You You're You're rage baiting the [ __ ] out of me. You are so rage baiting. You get a Surface Book, too, and you do it, bro. You do a surf and then prove it to me. Prove it to me, bro. Prove it to me.
It overheats as [ __ ] with the proprietary drivers on Linux. It just does. It overheats. It's dog [ __ ] Oh, I cast it to size T.
Is that it? Oh, I cast it to size T like an idiot. Okay. Well, that's that bug.
That's not all of the bugs, though.
Okay. Initi type size equals type size.
The [ __ ] And build UV islands 511.
Oh, [ __ ] Christ. This refactor is going to make me [ __ ] lose my goddamn mind.
Okay. 511.
Nit vector island tries size T.
Okay.
Um, tell me that this isn't a real island.
Okay, listen to me. Listen to me. Listen to me. We're not going to do We're not going to do that for now.
Oh, because we don't we didn't we didn't have init UV islands. I didn't I didn't comment that back in. Okay, that's why.
Can't believe Rob came back to just rage bait me. That's just crazy, dude.
That is just crazy. Today is not my day.
No type size for vectors specified in build UV islands. Oh, it's in here.
I'm going to guess I I need to I need to just know if that's null before we move on.
Is that null?
It's not. No, it's not. No.
Oh boy, this looks a bit funny. Wait a second.
Wait a second.
MN mesh.
No, this that that works, I think. I probably [ __ ] this up somewhere else.
Oh, wait a second.
This retrieves a mesh, but we need to give that a mesh node.
Oh, right, right, right. Okay. So, we're just not going to worry about the UV light map right now.
We're not going to worry about the the light map right now because I just want to make sure that this [ __ ] works.
Um, the problem is that it's going to dreference a certain thing, fill buffer with mesh try. It's going to dreference that. And so we needed to not dreference that.
Okay, we're we're probably rendering.
It's just it's just not showing us anything because I don't have I just want to make sure that we're drawing to the screen and then we can reinstate the The light map stuff. The light map stuff has to it has to go based on mesh nodes instead of the [ __ ] are we talking about?
What?
Okay. It runs fine with GDB, but not in in not GDB.
Why? Why? Why? Why? Why? Why?
Oh, probably because of this stuff. Possibly.
No.
Oh my gosh. What is the problem?
All right, I'm going to just do this the oldfashioned way.
See if we stop stop crashing if I just take the draw out. No, it's not that.
I'm going to assume it's add mesh to buffer, but I don't It's not that either.
Is it a knit scene? BBH.
Really? Oh my [ __ ] god. That's terrifying. Why is it a niteen BBH?
That's the problem.
Really? Oh my [ __ ] god.
Disgusting. It's disgusting. I hate it.
I [ __ ] hate it. Okay.
Initi BVH.
Oh, mesh nodes count. Mesh nodes count. Mesh nodes count. I didn't I didn't change some of this stuff.
All of this needs to be based on mesh nodes because MN I Yeah, all of that is good.
mesh nodes.
Shouldn't matter because we should have the same amount of mesh nodes as meshes.
Oh, no. We don't. We don't. We only have one mesh node with two meshes.
Okay. Got it. Got it. Got it. Got it.
Okay. There we go. Fantastic.
Great.
All right, we can [ __ ] ship it now.
Um, so art, right? Yeah, the light map stuff is kind of [ __ ] not going to lie.
For example, this right this takes in a mesh node.
So we need to have mesh nodes.
We just simply to test it, we could pass it mn0.
Oh, it's it's the funny thing is that the the adjacy map actually needs a mesh.
So that that is true.
Um I need to go into uh here.
You want me to review your PR? I'm all good.
I don't make a lot of PRs myself. I probably should be making more PRs.
MN zero.
Okay, let's see if we can do this. Let's see if we can do this.
Remote coding job. Yeah, you know, if you've got a lead, you know, let me know.
I'm very amicable.
Like, hello. Oh, I I get along well, no type size for vectors specified again. Like seriously, I changed that to mesh node and we're still we're still having problems in build UV islands.
I need to know if MN0 is null. We're going to print [ __ ] out.
Okay. No. So MN0 isn't null.
Oh, hold on a second. This is supposed to be uh MN ID.
That shouldn't matter though.
Let's see this.
I want to see what the mesh try count is because I have a feeling like the only reason that would happen is if we like ran out of memory.
So that's obviously like not good.
But we have to we have to give this a shot.
Now 3776 is the correct amount.
No type type size for vector specified is weird because this is just size of size T.
If I just build the adjacency map, do we run into like memory issues or we stack?
Are we doing some Yeah, maybe this is the problem. Oh, no.
But now it's the No, no, no. Yeah, now it's just now it's just the fact I I don't have like a turn off light map thing, which I really I really should make that, but right now I'm just I just [ __ ] commented out.
Okay, so this this the adjacency map is apparently not corrupting any memory, at least as far as I can tell.
I mean, maybe that isn't true.
I don't see how it would, to be honest.
I do not see how it would.
Let's try getting rid of the other the other mesh that we have loaded in.
See if that changes anything.
For whatever reason, I definitely [ __ ] up the the refactor somewhere, but it's so weird that it's happening there.
I just really need what I need to do is I need to just like dump every [ __ ] value that that's here to see why.
How about this? How about this? Let's just see if we if we seg fault with with actually doing nothing. Okay, we still seg fault with actually doing nothing.
And so is it it's really a nit vector that's that's Does the light map data not get initialized now?
Because this is only going to work if it gets initialized.
Am I just Oh, I'm just stupid. Oh, I'm just stupid. Oh my gosh, I'm just [ __ ] stupid.
I just actually am really dumb.
Okay, on to the next one.
Add UV island to light map.
Add in UV islands 932.
Add UV island to light map where 55.
MN mesh.
Did I cast these correctly?
It looks like I did.
All right, let's print out Let's print this out, I guess.
Whoa, whoa, whoa, whoa, whoa.
All right, let's see what it says if they're out of bounds or what.
Yeah. So, MN mesh mesh node is five.
Okay. So somehow the UVI gets the wrong gets the wrong mesh node.
Oh, because I commented this [ __ ] out when I was [ __ ] doing the other [ __ ] Oh, okay. That's that's a lot of UV islands that are going to print out. So I need to get rid of that.
Okay, we are making the light map.
We are blurring it and we've finished it and it's dog [ __ ] because we didn't actually uh we didn't actually do times light here.
All right. Nice.
All right, the refactor is done. It was a pain in the ass and we made some issues, but whatever. It's finished.
It is finished.
All right, let's stress test it.
Let's make a new mesh node.
MN1.
gonna make a new instance of it at uh 20 20110.
Um we're not going to do rotation and scale because it's kind of a pain in the ass.
Uh a knitting the mesh only has to happen per mesh.
So all we should actually have to do is build UV islands for MN1.
Oh yeah yeah yeah yeah yeah.
Yeah, that's kind of a pain in the ass.
Yeah.
Yeah, we don't have the ability unfortunately to duplicate duplicate the the meshes. So, this is probably going to crash.
Yeah, let's see exactly where.
I don't I don't know how to mash build UV islands 491.
Now that doesn't make sense.
Why does M and one not work.
When does the MN1 not work?
Am I missing something?
If I get rid of this one, does it work?
Yeah, now it's fine.
Why?
They should have the same exact mesh ID.
They do.
They do.
So, what is the SEG fault for?
Oh, one of them has this What?
I'm corrupting some memory somewhere.
I just want to see if it's right after MN0 gets touched by MN1.
Let me try to pinpoint it.
Yeah, it gets touched when we do this.
When we expand mesh nodes by one. Do I not initialize this?
I do.
Unless I'm somehow not calling inate globals, which I definitely do.
Oh, I'm [ __ ] stupid. Oh my I'm really dumb.
I'm really stupid. I'm really stupid.
I'm really stupid.
Obviously, these pointers aren't going to work. Um because it's a vector. Duh.
Like, what the [ __ ] is wrong with me?
Um, obviously that's not going to work.
Um, yeah. So, the so the handles to them are are pointless. Uh, we could give an index instead.
Yeah, I'm trying to make figure out a way that I could have the same mesh have different vertices be displaced by a certain mesh node thing.
Basically, it would just be the light map UVs that differ Yeah, it's tough.
I would have to emit the vertices twice.
right now. The try itself points to the try itself points to actually a bunch of things. Well, not not a ton, but the tries themselves point to material UV island and UV idx.
Obviously, each mesh node has its own UV island and own UVX.
So, one triangle can't reference both.
So that would have to be per mesh node data Yeah, I think the easiest way of doing it instead does init mesh just create a new.
No, it doesn't.
The only way to enit a new mesh a mesh twice is to literally load it in multiple times and we can't load it in multiple times now because we have it keyed in by name.
So we we'd have to make a function that duplicates a mesh creates a new mesh node as well.
Yeah.
Yeah, I think that that's the only way to do it, unfortunately.
Even though it's kind of ugly.
Unless you mark a mesh for for it and then emit vertices for each one separately.
But how would you how do I have an idea. I have an idea. It's kind of a stupid idea, but I have an idea. I have an idea. I have an idea.
Per mesh. What if you had a flag?
The flag here light map instanced.
And then if the mesh is lightmapped instanced then you refer to the mesh nodes and the mesh nodes have have a map.
which is just as um And that's just allocated to the amount of tries.
And then it goes that that is what holds that data instead of being on the triangles itself.
And now we can get rid of that from the triangles.
And that's going to cause some errors.
It should. Okay. Exactly.
So fill buffer with mesh try.
Should it really be taking in a mesh node?
Or should we find all of the nodes with this mesh?
If I add mesh to buffer with a mesh node, does it make sense?
Probably not.
Probably not.
So, we need to find Okay. So, let's do it then.
So, let's get uh Okay. So, what it's going to be is if the mesh is light map instanced, then we're going to do this. Otherwise, we're just going to add it regularly.
Else we're just going to go through it and just add it with without this.
The LMUV will be We'll change the inner. I don't want to do that.
We're going to go through every mesh node.
If MN's I do mesh doesn't equal mesh id continue.
Otherwise we will emit vertices and we will use what we just did. this UV map.
We want to change this to J.
Okay.
Okay. Now to resolve all of the issues that are going to come because of this here we put it on on that we may have to pass in a new argument for this.
Yeah, we will. We have to pass in a UV mapping.
How do we get the I don't know.
We're building all of the UV islands here. So, this is going to be if MN uh UV map free MN UV map Female people's calic Okay, that's done.
Okay, next challenge is inside of here.
We need to get the MN. We do have the MN. So this is now going to be MN UV map index by tries I UV idx equals i.
And when we hit it, we need to go uh do we have a hit mf hit.try mn. Wait, hold on. We need a hit. MN hit MN UV map.
Hit try UV island.
This is not easy. Not easy.
Okay.
This is not easy.
So if I I'm going to add a flag to this to a nit mesh.
It's now going to take in uh later we can we can figure this out better.
Uh, is this in this isn't mesh.h.
And all we want to do is mesh light map instance equals light map instance.
Is that it?
Did I do it?
I think I need to get something to drink.
Build UV islands mesh tries 491.
Oh, it's the same thing.
Oh, right. It's this again. Oh, right.
Um, yeah, I have no way of getting there other than other than literally doing this and then iterating them. So, that's what I'm going to do.
Come on. Come on.
What is it now? Has to be something else.
Uh where 498 on free.
Oh yeah, I never I never set that up for it to I forgot to do that. Or I didn't forget it. It just it was in the back of my head and then I didn't ever set it to null.
This is why they say C is unsafe because if you forget to put null and then you free and then you get sad. That's that's why C is unsafe. Okay, let's see.
Um 777 77 lucky sevens.
MNUV map tries I How's this out of bounds?
When we're indexing MF, we calcate the mesh tries count.
So, how are we going out of bounds?
Let's try Z is bad.
Let's see.
I is zero and then we crash.
Okay.
How do we get MN here? UVI mesh node and we cast it incorrectly.
Keep going, bro. Thank you. Thank you.
Yeah, we were casting it incorrectly.
Thank god I figured that out before we went down the rabbit hole there.
Okay, I think we're solid. Okay, good. I think we're out of out of the out of the woods now.
Are we out of the woods? We We are. We are. Okay. So, now we have two individually light map meshes.
Although the light doesn't appear to be on them.
I think that's because I turned the light map off.
Unless I didn't. Then then that's bad.
Okay, that is bad. That is bad.
So why is that the case?
Huh?
I don't know.
Uh, I'm going to guess that the lighting calculation isn't per mesh node. And that's the problem.
I think that my lighting calculations themselves need to be need to be changed.
We solve life light source. I do pass the mesh node, but do I translate it by I do translate it by mn.
Everything does happen per mesh node.
Let's try let's try something here.
Let's try only doing one mesh node and then seeing.
Also, let's turn off indirect lighting because that takes forever to [ __ ] compute right now. That's just taking forever.
And turn off the blurring just so that we can quickly iterate and see what's going on.
Okay. So, this is just one. Okay. So, we have light. We have light. But with two, we don't have light anymore.
I wonder if the order matters.
Huh.
Okay. Let's try changing the order. I think it's processing the the second one over the first one instead of processing them separately.
Yeah.
So the second one always gets the lighting. Okay. So, we have some issues with they both are they both have separate uh vertices and stuff. It's just that they're the lighting isn't separate for them, which is annoying.
I think that there's probably something that I'm not thinking of to change in all of my logic because we're not running into any seg faults or bugs anymore. I think that there's a logical issue with it.
I'm pretty sure that the UV that the UV islands aren't the problem. That should be pretty simple.
might be when I knit them and add them to the to the thing.
My why, first of all, get rid of that.
Well, no. No, don't get rid of that.
Hold on.
No, it's on the UVI. It's on the UVI.
Yo, what's up, Luca? I'm doing all right.
Just uh grinding away.
I'm working on a new light mapper.
It's kind of cursed. What I'm working on right now is I basically have different meshes and I what I the way I'm doing it instead of duplicating the meshes themselves, I'm allowing them to be instanced, but the vertices themselves have to be separate because of the light map obvious the light map UVs. So, it's kind of a pain in the ass to put it lightly.
Uh, and somewhere there is an inconsistency.
Somewhere there is an inconsistency and I have to track it down. Cool stuff.
Thanks. Thank you. It is cool. I earlier I built this cool like uh I built this blurring that happens across the the triangles. So that was pretty cool to it. It it like recursively walks in an adjacency map. That that part is cool.
That part is is cool.
They should go into separate parts of the map.
I want to see if we actually have those.
Uh I want to get something to drink really quick.
So, I probably will do that in a sec.
Let's see.
One. Okay. So, we do have different mesh nodes happening in there.
Yeah, it's a million different things.
It could be to be honest.
All right, I'm going to get something to drink.
because I'm kind of thirsty.
All right, I'll be back in a second.
All right. I think I have I have kind of an idea of what's happening. I think what's happening is that well, one of two things is happening. We either are allocating in the light map the exact same space.
We're either writing to the exact same space as the other UV islands or our light calculation is off, which I kind of think that it can't be off.
I don't think it can be off.
Let's try a few things. Let's get rid of some extraneous stuff here that uh that may be affecting it.
I'm pretty sure that that it has to be the issue has to be when we build the UV islands or when we admit the UV islands. It's 100% has to be.
Hold on a second. Hold on a second. Hold on a second. Hold on a second.
in init UV islands. When I add island to light map and assign UVs MN UV map UVI.
Now it has to be separate ones.
And they are definitely separate. They are 100% separate because because one gets processed and the other one doesn't.
At this point I it's almost like I'd wonder if there isn't enough space on the light map though. I doubt that because because there there wouldn't be light at all. There wouldn't be light at all.
Only the most recent mesh node gets processed.
Only the most recent mesh node gets processed.
Do I set mesh node? Does mesh node have an ID?
It does.
All right. Peace out, Luka. Thanks.
Thanks for Thanks for Thanks for stopping by. I hope you have a have a nice night and mesh definitely has an ID.
Just wanted to make sure that mesh node has an ID and that we set that up.
No, I've got no clue. I've got no clue.
I'm lost.
Yeah. I don't know. I don't know why it would work for for one and not for the other.
Like if I just do this then it works, right?
What?
Oh, it it finished. I was just Let's make it close to the light so that I can see.
Okay. So, we can see the red and the and the blue at the bottom there.
But then when we add a second one, the light is only going to appear on one of them.
See, it's processed the same for both of them.
Hold on, hold on, hold on, hold on, hold on. We may just be emitting them improperly on the rendering side.
the rendering side.
I want to see what I is.
zero and one. So zero and one go through.
If J is less than 10, I want to print out I want to see if they're the same.
See if they're the same.
No, they're different. They have separate UV islands.
They just get processed the same.
Then it has to be in the light map in the actual light map generation. There's no other there's no other way.
Unless they both get the same the same texils, which I I doubt.
Let's do the same thing here. If J is less than 10, let's print the tixel idx.
somewhere. Something has to be going into the same spot twice.
Okay. Well, that's a lot of tles.
That's a lot of [ __ ] tixels, man.
Uh, well, [ __ ] I was just Yeah, then maybe we can't compare.
Really that many texels for just the first triangle.
Oh, it's the first triangle in each island. In each island. Okay. So, just do t J. Just do tries J.
My bad.
Nope. They have different texels.
See, these are in 500,000.
So, they have completely different texels.
That's what I wanted to see.
So yeah, I guess how they solve the lighting must get [ __ ] up then, huh?
Solve light source must be wrong.
But the very position has to be the very texel position would have to be different then would have to be the same. So, let's let's print out the let's print out the positions. That's that's what we should do.
So for the first triangle, let's just print let's just print PA.
Let's see if PA is translated differently in terms of model matrix.
It is. It [ __ ] is.
No. No. I think I realize what's happening. I'm being stupid. I'm being stupid. I'm being stupid.
No. But it is translated. It is. It is. It is.
We have to be reading from the wrong from the wrong thing. We have to be rendering it wrong.
Oh, okay.
Okay. Okay.
Wait. No, but M offset M count should go should include it.
It should include it. And that's why it's drawing is because is because it does include it.
[ __ ] God damn it.
Let's print out the literal UVs.
Let's print out the literal UVs.
That being translated means that I'm calculating it properly. We're calculating the light properly.
The UVs are not the same. They're not the same.
The UVs are not the same.
Maybe instead of pa I should be doing pause, huh? Let's do all of the texels.
the pause for all the first.
Hold on a second. Is that true or did I just like cut it off too early?
No, the texels have a different position.
[ __ ] The index has a different position.
Wait, hold on a second.
Oh, wait a second.
Okay. Okay. Okay. Okay. I think I think I I think I understand. I think I understand.
If I just render if I just hardcode a render pass for Just just one mesh node.
It has two of these on top of each other. It should have It's hard. It's impossible to tell.
But that's the problem. The problem is that we need we need both of them. We need to Oh, that's the problem. That's the problem.
is that the mesh nodes have to have a offset and account.
Yes. Yes. Yes. Yes. Yes.
The easy the simple way to do this is to just actually instead of fill buffer with mesh try to just use a mesh node instead.
And then the mesh node gets the It's the mesh offset and count because the offset is going to be different for both of these since it needs to go twice.
So, let's just make a let's just make a an override here because each mesh node If a mesh is light map instanced, then the mesh nodes and the corresponding mesh nodes need to each have an offset and which needs to get set here.
Well, we have a current offset. What is this offset?
Is do I do I use that directly? What is count? Count is the vertex count. Okay.
So that is the vertex count. So MN offset equals current offset.
Let's just have a current count to be simple.
We can make it not stupid later.
I don't want to talk about it.
You broke my heart.
Okay. So now we will use MN offset and MN count and we'll live a happy happy lovely life.
Did I get it right? Did I get it right this time?
Are we happy?
I don't see a second mesh.
I do not see a second mesh.
Did I get rid of the other one when I was debugging?
No.
Oh, why can't you just work? Uh uh current count has to equal zero each time. That's something the one under over it is invisible.
Why can't you just work?
Do I have to print out what the offset is? Like why is this Why?
Oh [ __ ] Oh [ __ ] Oh [ __ ] No, you [ __ ] prick.
Oh, because I need to allocate it. I need to allocate it more.
Uh, [ __ ] Okay, where do I allocate it?
Layout current offset plus V size. V size equals M tries count.
Right, right, right, right, right, right.
You piece of [ __ ] What?
Tell me. Tell me why.
Nothing but a What?
Bro, listen. Listen, listen to me. Listen to me.
I've already calculated the size. Okay.
Oh, I didn't calc mesh size. M here. I that that I didn't do. Okay.
That I didn't do that. I didn't do I didn't really expect to spend all of today designing doing this this refactor. I like seriously. Okay, it's finished.
Okay, so there was an incredible amount of time that we spent uh getting it so that we can now instance meshes pre- light map, meaning that we load in one mesh once and add it to the light map in multiple instances so that they can get different lighting. Um, now the amount of pain and suffering that was caused because of that I so yeah the the jumping is is pretty crazy.
We have to fix the jumping and [ __ ] Um, I'm I'm glad that we did it. I mean like you know I I think I'm a little bit unhinged because of it but you know all in all we did a good we did a good job like you and me we did a great job.
I think I think we should be proud to be honest of of what we accomplished here.
I I know I am.
Uh, bro is literally just talking to himself, bro.
Also, the light map is filling up already.
My cough is still on the screen.
Yeah, the light map is already filling up.
Um, Damn, that's pretty dark, bro.
Um yeah.
I have to do some some work with the collision stuff.
It is It is dark. I think it's the AO that makes it dark or it's the blur that makes it dark.
It's obviously not the indirect that makes it dark.
Ain't nothing but I need to clean up this code. That's what I need to do next. I need to just spend like, you know, a good like 30 minutes just just cleaning it up.
Just forking an old version and then cleaning it up.
We also got to get some better assets, I think, to test this stuff with. I kind of I had this dream and I want to make a make the model that was in the dream and then import it and then see if we can like make the lighting correct.
Yeah, there is some ugliness.
There's definitely some ugliness on the underside.
Don't know what that's from.
Like on the top side, it's fine. On the bottom, it's not.
I don't know.
I wonder why that is.
I guess I never looked on the model on the bottom.
I wonder if the blur is causing that.
or what?
Maybe the blur isn't isn't doesn't work with the mesh node.
The mesh nodes all have different text for the blur.
So technically shouldn't technally should be pretty pretty compatible.
All right.
You know what it actually might be? It might be the the texture albido sampling might might be throwing it off for whatever reason with the low texle size maybe I don't Wow, that is [ __ ] hor horrible.
Why is it so bad?
Why is it so [ __ ] ugly?
Let's try with just one one mesh again and then see if it's a problem with just two meshes.
It does seem to be a problem with the two meshes.
Let's just try this one.
Ain't nothing but See, it's fine.
But then both and it doesn't work.
It seems specifically like the like the indirect doesn't work. seems specifically like the indirect doesn't work because without indirect.
It seems fine.
Yeah. Without interact it's fine.
So it has to do probably with probably with with all of this nonsense.
Hit me node UV map. Hit that. Try UV island. Yeah, that sounds cursed as [ __ ] Who the [ __ ] designed this?
Huh? What type of idiot?
I wonder if hit.try is is coming back correct.
Let's get rid of this.
Uh oh. God is angry. God is angry at me.
God, why are you angry?
I guess it's the first time we actually use this SDBH indices on mesh nodes.
I guess that is the first time we use it.
Wait, hold on.
MN isn't the hit node, is it?
No, it is.
Let's not use the BBH.
Just bypass it.
Might take forever with it bypassed, but whatever. It's actually completely fine.
Okay. So, it's not that If I bypass this. Oh my god. Yeah, you can't bypass that. No, no, no, no, no.
That's That would literally be It would take forever.
If I had to guess, we're just getting the wrong ID back sometimes.
We can try to hardcode the this again.
Um, however, I haven't done this in a while and so we need mod.
I doubt that this even would work if we wanted to test this.
because of the internal stuff that has to get done.
The internal matrix translation that happened to the other function just isn't present here. Wait, what?
Uh um can I see what's happening here? Can I just like not normalize it just to see if we're hitting It looks like we're hitting.
So, I guess our scene BVH is broken somehow.
It's not really showing me any bounces.
I'd love to see a bounce or two.
We could also just do this.
Just hard code the bounce.
Yeah, there's zero bounces happening.
Because in this function you do this per node.
You give in this PM.
Yeah, you can't you can't skip it because of that.
We would have to do some crazy [ __ ] to to skip it.
Let's just check out.
We definitely are going to both of them.
Let's see.
Yeah, I didn't I didn't put a a new line at the end, but as you can see, we go to one and zero. We do go to both one and zero.
Yeah, I may have to leave this to another day. I don't really know. This may be like one of these things where I just need to take a a good portion of a day to to debug it because I mean this just made it really bright.
But I think it's probably bouncing way too much.
It's probably bouncing on itself.
This needs to be inverse pause for a good reason, you know, because you have to you have to mul it by the inverse.
to get it into the local space before you go into traverse the the BVH.
Honestly, it might be something where we should like bypass the BBH and then just do it with like a a lower poly mesh so that we can avoid all of this, all of the debugging. We can just make sure that the BB Oh my god, dude.
What? What now?
Oh, it doesn't have a [ __ ] diffuse texture.
And I don't have Where does diff buff come from?
It comes from the material and it doesn't have a material.
And that's like a whole thing that I have to do now. It's just it's just something that I need to wait another day for it. It's just literally that simple.
It's just literally that that simple.
Where even is it? Where's material on here?
Maybe it just it just is per triangle.
make that an integer. And then we'll just have to have it as a thing where just recompile the whole goddamn project because I changed a [ __ ] header.
Oh, it's just it's just [ __ ] so lost.
The fact that you have to put this everywhere now is just Crazy.
God [ __ ] damn it.
Oh my god. And it's going to It's not going to render anything because of the [ __ ] shader.
Now I'm not sure if it's just so low res that it's that it's [ __ ] or or what. Now I have I have no clue even what the issue could be now. So it's like what's the point of even just looks so bright.
I'm bypassing both of them.
I mean, this is so low poly that it's like that it's like I can't even tell if the problem is happening or not. You know what I mean?
So, this this was a this was a this was a bad idea because I I can't debug with that mesh.
So that was that was a bad bad idea.
Anyway, maybe it is a good idea to just just do the light map itself though.
But yeah, can't.
Yeah. I don't know.
Yeah. I don't know.
I think I'll just just have to fix fix this tomorrow. I'm kind of zoned out of it after all the [ __ ] that I went through today.
Yeah. So the full the full thing gets gets covered.
It's just the tixels themselves that you know.
So the full thing gets covered.
It's just the hit index that's wrong.
I'm pretty sure the UVs somewhere are wrong is wrong and I have no way of testing it. So yeah. Yeah. I don't know.
Here's something. Let's not uh parallelize it.
Ever thought about that?
What about that?
Oh, it's going to take forever.
Oh, it's going to take forever.
Technically shouldn't matter.
Yeah, it doesn't matter.
Yeah, we're reading from the wrong tixels somewhere.
Do you think that one just looks fine because we don't get bounces and it's just the bounces themselves that are the problem?
Maybe it's just bounces themselves that I mean it's just the low texle resolution that's the problem.
Yeah. Yeah. Yeah. Yeah. Yeah. Yeah.
Yeah. Yeah.
Yeah. Yeah. Yeah. Yeah. Yeah. Yeah.
map that's wrong at all.
I think it's just that our resolution is super low and that's just that's just the the cost of it.
Yeah, there seems to be a pattern in it which I I don't like.
Four is going to take forever to blur.
All right. Well, I guess I don't even think that this is a bug then. I don't even think this this is necessarily a bug.
Yellow blurring is going to take forever.
Yeah, there are some like grid aligned artifacts and stuff.
All right. Well, at least at least that's settled, but I have to I have to figure that out. All right, I'm going to peace out. Um, have a nice day. I think I'm going to do some more research on the on the collision and physics stuff.
Uh, I want to I want to figure that out, but I have no clue how to do it.
No clue how to do it.
And I got to figure out the this like grid aligned. I'm not even worried about the sides. Like the sides are like whatever. But the the grid aligned sort of artifacts. It's probably hard to see, but it's kind of kind of annoying.
But I'm probably doing something wrong either with the blur. Maybe I just have to turn up the the tixel resolution. But turning up the tixel resolution is is is pretty sucky.
Like making this any higher is like pretty pretty crazy because the map just ends up being so much memory. Just literally so much memory, you know.
All right, I will um see you guys soon. Yeah, the grid aligned kind of artifacts are interesting.
Yeah.
My blur might be might be strangely biased that we build that we built today.
Also, this should never be going through. It should never go into here.
Yeah, I think going based on this local count idea, technically you could have triangles that are Yeah, we should probably just like go out by some radius rather than rather than using this if local count is greater than zero because it might be exiting out too early.
Yeah.
Heat.
Yeah. All right. Peace out.
Related Videos

TOP 15 Data compression Interview Questions and Answers 2019 Part-2 | Data compression | Wisdom jobs
wisdomjobs
281 views•2019-06-28

CTS 158: 802.11w Management Frame Protection
ClearToSend
4K views•2019-02-04

NDSS 2019 Send Hardest Problems My Way: Probabilistic Path Prioritization for Hybrid Fuzzing
NDSSSymposium
496 views•2019-04-02

How realistic is Cities: Skylines?
CityBeautiful
159K views•2019-02-14

GUIs & TUIs: Choosing a User Interface for Your Python Project | Real Python Podcast
realpython
2K views•2025-04-04

The OSI Model - Explained by Example
hnasr
225K views•2019-05-12

Cloud Computing - Introduction
elithecomputerguy
98K views•2019-10-07

From Traveler's Dilemma to Dynamic Routing | Demystifying Networking
IITBombayJuly
5K views•2019-08-04
Trending

WOW! Judge TURNS THE TABLES on Trump in His OWN $10B LAWSUIT!!!
MeidasTouch
197K views•2026-07-23

Playstation NO DISC/NO BUY Fight Is Over...
DavidJaffeGames
4K views•2026-07-23

Steam and Xbox Just Dropped The Hammer On PlayStation
OhNoItsAlexx
9K views•2026-07-23

Americans Confused in Australia for 17 Minutes Straight
IWrocker
17K views•2026-07-23