/posts/

the voices in my mind

WARNING!!!

You might suffer from a stroke if you read this poor attempt at having a blog, it is also possible that you will waste precious time that you'll never get back. Also, don't expect consistency, I will write entries when I feel there is something important/interesting to be said.

- INDEX -

「ImGui」·2021年10月21日

After a two-day hiatus I decided to work on the engine again, didn't know what to do so it occurred to me that having to recompile the entire thing because I wanted to change the value of some variable was very time consuming, and using glfwGetTime() just wasn't going to cut it anymore.

So here's ImGui in action:

As this is my first time working with it, making it work was something of a hassle but in the end it turned out to be rather simple. Was it worth it? Definitely. This is a great library, it is really easy to use and the results are great.

Now I am a bit lost, I know that I have a lot to do, but I just don't know what, a TODO list might be nice. I'll make another post when I figure it out, til then, c ya.

「IsoMateric」·2021年10月15日

The title of this post is the name I decided to give to my first real project, an isometric 3D OpenGl graphics engine. It is a wordplay using isometric (we all know what that is) and "mate", one of my favorite beverages, as a suggestion of a fren.

There will be a github repo in the future, but that's not possible at the moment due to the fact that I am having difficulty in uploading files larger than 100MB.

Note: I just learnt how to .gitignore correctly, here is the github repository: mm4rk3t/IsoMateric

Now that I think about it, I might add a new section to the site called "projects" where I can talk about and link about my github repositories.

The reason why I am even mentioning it, is because I already have the foundations so as to keep working on it and scale it up. Next, I will attach a screenshot of my workspace, as proof that I am actually doing something. (colorscheme shamelessly copied from this reddit post)

I am having a lot of fun doing this, and I hope it'll help me land a job in a future :P

How it started

How it is going

This was a very colorful post.

「An interesting title」·2021年10月10日

What!? Two whole posts in a single day!? Yep. Why? Porque puedo. Actually, there are some other things I want to talk about that are quite unrelated to OpenGL so it would feel weird if I clamped them together.

I came across a (yet another) godlike community based on (of course) the Wayado, and I couldn't be happier. If you were ever part of such a group, you surely realized that these are overflowing with interesting people, and above all, the traits that I value the most are creativity and originality, although I am not particularly creative nor original myself. And I figured that I can learn from people like them (that is mainly why this website exists in a first place kek).

God I love the Wired. I love lain!.

On a side note, I have been reading a thing or two about stoicism, a school of thought that was deeply admired by Richard Harris, who later wrote some ideas on it. I think that reading the emperor's lessons is worth it because I might get something out of it.

Nostalgia sucks.

「At last」·2021年10月10日

Lately things have been going on great, so I am quite happy about that (pic related is my face as I'm writing this).

I finally finished the OpenGL tutorial I've been doing for soooooo long, so now I can actually focus on doing something on my own with all the knowledge I gathered. That's a lot of I's.

Some ideas came up, such as a bullet hell or some 2D platformer. I want to do something simple before moving onto a more complex 3D setting. I was thinking about doing something like Terraria or DST but that might be a little too ambitious (fucking Dunning-Kruger effect, I feel so overconfident right now).

This is the "final project" that I was made to do for the tutorial, there are some bugs (such as blending) but I will just leave it like that.

Pause state:

Win state:

I learnt so much while doing this, especially what I was aiming for (game architecture) that I almost filled a whole notebook with notes!

「Halloween」·2021年09月30日

When I was a child I used to love watching halloween specials. Mostly because I enjoy horror and spookiness, but I believe that also the fact that those specials were aired once a year made them even better. Scarcity increases demand...or something like that.

Now I can feel how the sweet halloween atmosphere is building up across whe whole internet, and I love that. Halloween loot on games, up until now unknown anime and movie recommendations, etc. The whole thing really.

That is why now I am writing this while having うずまき opened on a window next to the text editor, listening to horror bgm while it's raining outside. The fact that I have a test tomorrow doesn't bother me at all, this moment is perfect and I am going to savor every bit of it.

Focusing on the task at hand and enjoying the present is something that I have incorporated recently, and overall I am feeling less anxious, which is cool. I don't even have a timetable anymore, I just get over with my obligations and I do whatever I feel like. As a result, I don't think I am wasting time anymore, because don't worry about being productive all the time.

Moving on, I decided to finish the OpenGL tutorial by skipping PBR and Ambient Occlusion. I believe that these techniques are too complex for me right now and the roi is quite small in relation to the amount of time and effort it would take me to understand such topics.

Just look at my SSAO "implementation" lol (the effect is not that bad if I say so myself, but that's not the point, because this is not even SSAO, it's shit). I will definitely return to this in a future, but the sensible thing imho is to skip it for now.

From now on I will try to create a game following this guide. Fortunately it will be a nice introduction, especially to wrapping my head around structuring more complex classes and stuff like that to better organize my code.

Perhaps I will write everything from scratch again, to avoid having unnecessary annoyances.

「Still alive」·2021年09月24日

This was a triumph. I'm making a note here: HUGE SUCCESS. It's hard to overstate my satisfaction. Aperture Science We do what we must because we can. For the good of all of us. Except the ones who are dead. But there's no sense crying over every mistake. You just keep on trying till you run out of cake. And the Science gets done. And you make a neat gun. For the people who are still alive. I'm not even angry. I'm being so sincere right now. Even though you broke my heart. And killed me. And tore me to pieces. And threw every piece into a fire. As they burned it hurt because I was so happy for you! Now these points of data make a beautiful line. And we're out of beta. We're releasing on time. So I'm GLaD. I got burned. Think of all the things we learned for the people who are still alive. Go ahead and leave me. I think I prefer to stay inside. Maybe you'll find someone else to help you. Maybe Black Mesa THAT WAS A JOKE. HAHA. FAT CHANCE. Anyway, this cake is great. It's so delicious and moist. Look at me still talking when there's Science to do. When I look out there, it makes me GLaD I'm not you. I've experiments to run. There is research to be done. On the people who are still alive. And believe me I am still alive. I'm doing Science and I'm still alive. I feel FANTASTIC and I'm still alive. While you're dying I'll be still alive. And when you're dead I will be still alive. STILL ALIVE

「Consistency」·2021年09月17日

Consistency is key, if you keep doing something, given that the method is correct, you will get good better, there's no doubt about it.

And that stands valid for almost everything; in my case, programming, understanding math, doing excercise, socializing, etc.

However, this is as simple to understand as it is to forget, so I want to write this idea down to come back to it in case I feel like giving up on something that only takes time to accomplish.

For the record, today, in the morning I wasn't able to wrap my head around calculating a tangent and bitangent from some coordinates and then a normal vector to make a TBN matrix, as explained here. But, after a couple of hours I was able to understand what was (mostly) going on.

Of course, this would've been a hell of a lot easier had I known algebra in a first place, but the point still stands, because even though I didn't understand anything at first, in the end I got the hang of it. And this also applies to 日本語, there are tons of words that I just couldn't remember, but since I kept immersing and doing my Anki reps everyday, I don't forget them anymore.

Future me: you are capable of understanding anything, as long as you seriously make some effort to. Perhaps now it looks like you know nothing, but with time, you will be able to understand a lot more than you do know. That is, as stated earlier, as long as you KEEP GOING.

「School」·2021年09月06日

It's been a while since the last time I posted something or gave any signs that I was alive whatsoever, すみあせえぇぇぇ〜

I was too busy with school, and I still wanted to keep studying 日本語 and graphic engines, so sacrifices had to be made. I plan on posting new things about my progress with OpenGL soon.

Not a lot has happened lately, among other things, today was the first time I got insulted irl due to the simple fact of being an お宅, however, knowing who the insult was from, I can actually take it as a compliment. I got angry at first, but then I cooled down. In case you're curious, it was something along the lines of being dirty, which couldn't be further from the truth, since I shower at least twice a day, but oh well.

In other news I became really interested in the Chinese language, and I am sure that after being confident in 日本語, I will make myself time to learn it. Some friends of mine who know Chinese recommended me the "Spoonfed" anki deck. I think that the hardest part will be the tones, because afaik the sentence structure is quite similar to English and I am already familiar with some hanzi that are found as 漢字 in 日本語. Also, I read somewhere that verbs only have a single, unconjugated form that can be negated (or not).

The site hasn't changed much because I am kinda lacking in ideas, perhaps I should add (more) easter eggs, or an anime girl in the background (looking at you, Irisviel). What I should definitely do for sure is stop being a lazy fuck and add new sites to the webring. Also I should see if there are any dead links.

And...well, cryptocurrencies are increasing in value so that's cool, my third world portfolio is going up slowly but surely, although it might be because my local currency is losing its value :(

That's a summary of what has been going on lately, I feel that I am much more motivated to keep chasing my personal goals, but I also can't be bothered to fulfill my obligations, しょうがない, I guess.

「Simple MSAA」·2021年08月28日

Ok, so implementing a simple MSAA X4 anti-aliasing was much simpler than I thought, fortunately. In the following picture you can see the difference between having anti-aliasing (left) and not having anti-aliasing (right).

In order to achieve this, you have to retrieve the different values of each sampling point, add them, and then average them. In this case, there are just 4 (four) different sample points per texel.

You can see here that we're adding all the samples of a texel and then divide the result by the amount of samples to get the average. Very easy.

The following big section, which I am really looking forward to, is about lighting. I don't know whether I should do something with everything I've learnt so far, so as to solidify all the concepts. Perhaps I will take a break from OpenGL altogether, who knows. In any case, I am glad I pushed myself to get this far :)

「Advanced OpenGL」·2021年08月26日

I finished the Anti Aliasing part of the OpenGL tutorial I mencioned a couple of posts ago, and with this, the whole Advanced OpenGL section.

What you can see here is the combination of a couple of techniques I learnt in this section (I won't go in much detail):

  • Instancing: "explained" in previous posts
  • Framebuffer combination: in total, this scene required 3 (three) Framebuffers...
    1. Used for Off-screen MSAA
    2. Used to render the scene into a texture
    3. The default framebuffer, for rendering the quad with the screen texture
  • Post Processing: a simple b&w effect applied on the screen texture
  • Anti Aliasing: using OpenGL's implementation of MSAA to avoid jagged edges

Implementing my own Anti-Aliasing is something I've got yet to do, so you could say that I didn't actually finish the chapter, but this is my site so I will say whatever I want.

「A Mathematician's Lament」·2021年08月25日

A couple of days ago I stumbled upon 「A Mathematician's Lament」, by the mathematician Paul Lockhart, in this thread on lainchan.

I won't write a review on this short book due to sheer laziness, instead, I am just going to leave a quote:

「The difference between math and other arts, such as music and painting, is that our culture does not recognize it as such.」

- Paul Lockhart

I think that if you are at least a little bit interested in math, you should read it too.

「Instancing 2: Electric Boogaloo」·2021年08月24日

This is a follow up post regarding those doubts I had yesterday. I could only solve 2 (two) of them, but I just feel like writing what I found out down. Let's begin with the simplest doubt:

1. why do the textures act all weird

This was actually really simple to solve. The problem was that I hadn't binded the rock (asteroid) texture, so OpenGL was trying to use the texture that was already loaded at position 0, i.e. the planet texture. To solve this, I just had to bind the rock texture before drawing the asteroid.

2. the math that randomizes the position, size and rotation of the asteroids

The thing is, I am teaching programming myself, and since nobody told me how to get a random number that belongs to an interval, and I hadn't needed to use that before, it is only natural that the calculation to get a random displacement number for the asteroids (displacement = (rand() % (int)(2*offset*100)) / 100.0f - offset) would confuse me.

It turns out that if you want to get a random number which belongs to the interval (min_number; max_number), you can use r = (rand() % max_number) + min_number. In this case, we want to get a displacement value that belongs to (-offset; offset). Which would result in displacement = (rand() % offset) - offset. Since +(-offset) is the same as -offset, we can just skip that + sign.

The division and multiplications are necessary to prevent the asteroids from being so tightly packed together.

Now the only thing left is to understand glVertexAttribDivisor(), wish me luck :P

「Instancing」·2021年08月23日

"We're no longer using a model uniform variable, but instead declare a mat4 as a vertex attribute so we can store an instanced array of transformation matrices." I am amazed that I was able to understand this sentence.

Today I advanced on the Instancing part of THE OpenGL tutorial and you can see the results in pic related (open as img to see full size). You see, making a lot of draw calls clogs the CPU to GPU bus, and thus, slows down the rendering process because even if your GPU can execute each draw call easily, they will take a lot longer to actually get to the GPU. This means that you'll want to make (or do?) as few draw calls as possible.

"But mm4rk3t", you say, "what if I want to render ten thousand rocks?, wouldn't that be impossible? how do other people manage to do it?" Fear not, because I'll tell you.

In short, instead of doing ten thousand normal draw calls, you only make one instanced draw call that is going to take advantage of the data that is alreay in the GPU's memory, in order to draw the vertices. This way you only have to append model matrices as vertex attributes to the model's vertex array and modify the vertex shader so that it uses that to render the vertices.

However, in this chapter there are three things I still don't understand:

  • the math that randomizes the position, size and rotation of the asteroids
  • the "glVertexAttribDivisor()" function
  • why do the textures act all weird

I'll try to look more into that before advancing to the Anti Aliasing section, but I don't know whether I'll be able to hold off, kek.

「Sleep schedule」·2021年08月20日

>mfw when can't sleep at night

You see, my sleep schedule sucks, for instance, I've been spending these past couple of days going to sleep at 15:00 and waking up at 19:00, give or take. Somedays, it can also happen that I go to sleep at 18:00 and then wake up at 23:00, and so on. So, not only my sleep schedule is bad because I don't get enough sleep, but it is also inconsistent, which makes it worse.

I tried everything (but sleeping pills) and for some reason, I naturally tend to be more energetic at night, which completely messes up my alignment with the rest of the UTC-03:00 waking world.

Thankfully, this cycle is beginning to "normalize", but it doesn't matter because it is just a matter of time until it gets messed up again :(

「First post」·2021年08月19日

>mfw when don't have to study

The exam season has ended (kinda)! Now that I have more free time, I'll probably start posting for real and continue working on the site and programming in general. BUT, first I'll play some BF4.

top