TEXTURES | Game Engine series

Поделиться
HTML-код
  • Опубликовано: 25 ноя 2024

Комментарии • 100

  • @madeso
    @madeso 4 года назад +13

    30:16 "stb is a like a library of various c++ helper classes, well not classes but you know what I mean", so a collection of C libraries, got it.

    • @chiyungchu9463
      @chiyungchu9463 3 года назад +1

      oh, i didnt get it. Why he say in such implicit way =,= bruh

  • @oxeniasenpai8916
    @oxeniasenpai8916 9 месяцев назад +3

    I know that this video was uploaded like 4 years ago but I still want to say that is feels like you are progressively aging with every video just how much it is difficult to develope the engine en explaining how does it work to all of us! Thank you so much for this series, it's really interesting to learn how does a game engine work!
    😁

  • @semicolon4671
    @semicolon4671 5 лет назад +28

    The Hazel's Private Development Branch's Footage in 51:05 Looks Really Amazing, and it Really Motivates Me to Work on my Stupid Engine.

  • @KanriKaenan
    @KanriKaenan Год назад +2

    37:40 - In my version of glad GLsizei is actually a typedef over a regular signed integer.

  • @sumloser8650
    @sumloser8650 5 лет назад +7

    the dev build looking good its a lot further than i thought it was geez

  • @GamingMyWholeLife
    @GamingMyWholeLife 4 года назад +4

    I'm glad I've studied 3D and learned how to make assets from scratch because I would have never been able to understand this otherwise, lol. It's fun knowing these sort of things as it really helps you appreciate Video Games even more :)

  • @semicolon.d
    @semicolon.d 5 лет назад +60

    6 views, 10 likes, gotta be good

  • @jamesmnguyen
    @jamesmnguyen 5 лет назад +4

    It's nice to see sneak peeks at the future of the game engine since sometimes tutorials (I'm not trying to blame them), end abruptly. So seeing ahead shows us how much more work is ahead of us.

  • @jdev6402
    @jdev6402 5 лет назад +23

    Hey Cherno could you upload your newest changes to git?
    The last commit was 15 days ago, so it's a bit outdated.

  • @simonbaxter8001
    @simonbaxter8001 5 лет назад

    Tip: With your checker box, you can fill the 4 corner boxes with Black, Red, Green, Yellow to match the texture coords in the Vertex buffer that you used earlier to verify the order and position once its applied to the geometry!

  • @CharlesVanNoland
    @CharlesVanNoland 5 лет назад

    @3:20 You can access textures from any type of shader, not just fragment shaders. That means you can use textures as scalar-field input to vertex shaders, geometry shaders, tessellation shaders, etc... For instance, I have a parallax occlusion shader that I wrote from scratch that uses a simple regularly subdivided low-poly grid mesh from a VBO and a low-res downscaled version of the depthmap that will be raymarched - using a maximum downscaling filter (i.e. a normal minification will just average each group of 2x2 texels but my downscale actually outputs the largest of all values that overlap each output pixel as the output value, so if you downscaled a black-to-white gradient to a 1x1 pixel it would be white, instead of gray). This low-poly mesh is offset by this max-downscaled depthmap along its normal to serve as "proxy geometry" off which the actual final fragment shader rays originate and march into the full-resolution depthmap. The proxy geometry loosely approximates the underlying depthmap so as to eliminate a bunch of unnecessary raymarching steps that would've resulted from just using a large flat polygon, but instead of having to generate uniquely shaped proxy geometry for each surface I can just have one single VBO of a grid of triangles and offset it using the max-downscaled version of the depthmap. The reason for the maximum compare against all overlapped texels for each output texel in the final proxy offset depthmap is to guarantee that none of the proxy geometry ends up beneath any parts of the full resolution depthmap. The goal is a proxy geometry that loosely conforms to the outer side of the depthmap, where just a typical downscale would result in some of the proxy geometry initiating rays from underneath any sharp peaks in the full res depthmap - preventing those peaks from ever being rendered. Just one instance of using textures in shaders outside of fragment shaders. I really feel that the programmable render pipeline is a mechanism that has yet to be fully explored. Conventional PBR rendering barely scratches the surface of the tip of an iceberg of what amazing stuff can be done with programmable rendering pipelines.

  • @aarondraws7699
    @aarondraws7699 3 года назад +1

    if anyone is getting weird distortion on your image the pixel width and height have to be the same and be a power of 2. Or if you really want that image, make the image format GL_RGBA8 and GL_RGBA and make the actual format of you image rgba by resaving it in photoshop or something.

  • @FerrisMcLaren
    @FerrisMcLaren 5 лет назад +2

    So much fun watching your content over the years. Keep it up man!

  • @_Omni
    @_Omni 5 лет назад +4

    I love these long videos 🙌

  • @hokhyt
    @hokhyt 4 года назад +2

    For those whose computer doesn't support the latest OpenGL (4.5), you might get Access violation executing location 0x0000000000000000 error. To solve this, try changing from glCreateTexture to glGenTextures. Also change the rest of the OpenGL codes to lower version.

    • @BigHug_yt
      @BigHug_yt 2 года назад

      I know I'm late, but I'm having the same issue. I already replaced glCreateTextures to glGenTextures, but I can't seem to find good replacements for the other gl functions that are too modern. If anyone sees this and knows a solution, could you please tell me? I have been in this scenario before with glCreateBuffer but this time it has already taken me weeks and to no avail. I also tried other tutorials to render an image, but nothing seems to work.

    • @doctordeak
      @doctordeak 7 месяцев назад

      I know im very late but this is how you would set it up with old way: int width, height, channels;
      stbi_set_flip_vertically_on_load(true);
      stbi_uc* data = stbi_load(path.c_str(), &width, &height, &channels, 0);
      HZ_CORE_ASSERT(data, "Failed to load image!");
      m_Width = width;
      m_Height = height;
      glGenTextures(1, &m_RendererID);
      glBindTexture(GL_TEXTURE_2D, m_RendererID);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, m_Width, m_Height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
      glGenerateMipmap(GL_TEXTURE_2D);
      stbi_image_free(data);@@BigHug_yt

  • @touisbetterthanpi
    @touisbetterthanpi 5 лет назад

    Love how episodes thumbnails lately have looked like Yaan is ready to spill some hot tea

  • @victorsunlight325
    @victorsunlight325 5 лет назад +1

    btw, for texture ideas just watch some videos about substance designer/painter. great procedural stuff with nodes

  • @SaidMetiche-qy9hb
    @SaidMetiche-qy9hb 5 лет назад

    Very good video! If anyone looks on shadertoy for example they would see what kindof crazy shit people shove into the framebuffer texture. People store many things like voxels into textures, GUI state, triangle lists, particle positions, etc...

  • @MarcoGiordanoTD
    @MarcoGiordanoTD 5 лет назад +3

    When you talking about "debugging with colors", is super important and could not agree more! I am in the discord and often see people that are lost about debugging, why don't you make a video where you show renderDoc and or NSight to show how you can use those tool for debugging rendering issues?

  • @pooria_garrett3020
    @pooria_garrett3020 5 лет назад

    Please stay at full energy and keep at making the world a better place to live :)

  • @rayleighslivers2187
    @rayleighslivers2187 Год назад +5

    For people with old PC which doesn't support OpenGL 4.2+:
    glTexStorage2D() is only for 4.2+, glTextureStorage2D() is only for 4.5+
    this worked on my PC.
    ```
    glGenTextures(1, &m_RendererID);
    glBindTexture(GL_TEXTURE_2D, m_RendererID);
    glTexParameteri(m_RendererID, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(m_RendererID, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_Width, m_Height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
    glGenerateMipmap(GL_TEXTURE_2D);
    ```

    • @rayleighslivers2187
      @rayleighslivers2187 Год назад +1

      glTexParameteri(GL_TEXTURE_2D,... *

    • @Terrensino
      @Terrensino Год назад +1

      Thanks a lot!

    • @zeozeozevo
      @zeozeozevo Год назад +1

      Much appreciated!

    • @Brad_Script
      @Brad_Script 9 месяцев назад +1

      your GPU must be really old if it doesn't support 4.2 lol, a reminder opengl hasn't been updated since 2017

    • @rayleighslivers2187
      @rayleighslivers2187 9 месяцев назад

      @@Brad_Script it only supports 4.0 :(

  • @0pranav380
    @0pranav380 4 года назад

    If someone else gets an error saying base class is missing, be sure you're including OpenGLTexture.h in your Texture.cpp file **after** you include your Texture.h file. I was stupid enough that I included it in my Texture.h file iteself.

  • @Puddlestomps
    @Puddlestomps 5 лет назад +6

    So did 2D or 3D win the poll? It's really close, but 2D is slightly ahead and I doubt many people still need to vote. You did 2DTextures today so I suppose we are getting 2D done first? I voted 3D, but I actually think it is better if we can get "blazing fast" 2D done first so that the community can start creating proper games and content with the engine.

    • @thijsjansen2052
      @thijsjansen2052 5 лет назад +1

      using 2D textures has nothing to do with wether we're going 2D or 3D, 2D textures are just the normal textures you'd use when texturing something, 3D textures are a way more advanced topic which we now especially do not need yet

    • @thijsjansen2052
      @thijsjansen2052 5 лет назад

      The Cherno is doing 2D first btw

    • @solaris5303
      @solaris5303 3 года назад

      3D textures have a _very_ niche use case - typically for things like unusually complex environment maps. All textures used in modern games are 2D images wrapped around a 3D mesh.

  • @TheRealMangoDev
    @TheRealMangoDev Год назад

    i think this issue is macos-specific or something but if someone experiences a segfault in the glTextureSubImage2D call, just make sure the level argument there is the same as specified in the glTextureStorage2D a few lines prior.

  • @dkthehunter596
    @dkthehunter596 4 года назад +1

    At 45:45, he talks about texture slots. He says that the uniform is bound based on the texture slot, and he gives an example of a shader with 4 textures (slots 0, 1, 2, and 3). Is it fair to assume that there will never be a Shader that uses a [Number Of Textures] greater than the [Number Of Texture Slots]?

  • @advikkabra8039
    @advikkabra8039 4 года назад +2

    If someone gets an error in stbi_image_free because there was an access violation reading location, try using a different picture, maybe the one Cherno uses. I spent way too much time debugging this :(

    • @Brad_Script
      @Brad_Script 9 месяцев назад

      if you're getting an access violation by using a freeing function you are probably freeing memory that cannot be freed

  • @JoseChavez-rg5bk
    @JoseChavez-rg5bk 5 лет назад +1

    Wow great!

  • @denisbalcom1429
    @denisbalcom1429 5 лет назад

    another great video cherno! I was curious would you be able to make a video on synchronization mechanisms such as mutex/semaphore using modern c++ ( c++17 or later). It would be awesome.

  • @jdev6402
    @jdev6402 5 лет назад +4

    At the start of the video I paused to get a coffee :)

  • @sam_is_people1170
    @sam_is_people1170 2 года назад

    thanks!

  • @OmegaF77
    @OmegaF77 5 лет назад

    Lookin fabulous in dat thumbnail tho

  • @magictrickdev
    @magictrickdev 4 года назад

    I actually *did* switch to Mac (for work) because of the constant forced Windows restarts. Most of my system administration tools are through remote software away, lol.

  • @cgmaxman
    @cgmaxman 5 лет назад

    I wondered how things are related to compressed vs uncompressed textures in a game engine ! Does this API supports this and does the graphics API cares actually about if a texture is compressed? If there are some interesting things to say about texture compression i would love to see a video on the topic !

  • @frostace2456
    @frostace2456 4 года назад

    Came from the OpenGL series, amazing video to watch! BTW, may I ask what's the brand of your watch?

  • @ismailAx2011
    @ismailAx2011 4 года назад

    What about using the rendering abstraction to create a GUI library that doesn't rely on deprecated OpenGL functions?

  • @Marsman512
    @Marsman512 5 лет назад +21

    Dude, don't switch to Mac, you'll regret it! If you're gonna switch anywhere, please be some Linux distro. You can customize it to your liking, and it doesn't force you to do anything! Got an update? It can wait until you want it. Got a new printer? 9 times out of 10 it works out of the box. If you must switch from Windows, go to Linux! Maybe not Arch or Gentoo (coming from an Arch user), but maybe something based on Debian or Ubuntu. I recommend Pop!_OS. Yes, it literally is spelled Pop!_OS.

  • @popplestones886
    @popplestones886 2 года назад

    Ughh, i'm struggling after this episode. I understood everything, and meticulously checked the diffs, and can't see i've done anything wrong, but now i am getting tonnes of warnings and compiler errors. Might have to revert and compile regularly to see what introduced the errors:
    It doesn't like my constructor in OpenGLTexture.h "OpenGLTexture2D(const std::string& path);"
    it's saying
    missing type specifier - int assumed. C++ does not support default-int

  • @prashanthkumar0
    @prashanthkumar0 5 лет назад

    great 👌👍well explained :)

  • @old_cd_rom9518
    @old_cd_rom9518 3 года назад +1

    hey guys, here we are about 3000 lines of code! xd

  • @evolucaohunz
    @evolucaohunz 5 лет назад

    what do you think about ECS?

  • @Destroyer19941995
    @Destroyer19941995 4 года назад +1

    My Texture is full white color I have exactly the same code.
    EDIT: FIXED IT
    my make_shared in Texture2D.cpp was make_shared(OpenGLTexture2D(path))
    CHANGED TO : make_shared(path) .
    Reason: make_shared performs one heap allocation

  • @theo-dr2dz
    @theo-dr2dz Год назад

    Weird. I get a strange rainbow effect of vertical coloured bars in the dark squares of the texture. In the code of the opengl series it doesn't do that (plugged in the same texture there). It doesn't seem to be caused by the shader. Maybe those new-fangled opengl functions behave strange on intel iris xe graphics.

    • @theo-dr2dz
      @theo-dr2dz Год назад

      Yes, if I plug the code of the opengl series into the constructor instead of the code he uses here, it looks good. Must be iris xe doing strange things. I keep it on the code of the opengl series.

    • @theo-dr2dz
      @theo-dr2dz Год назад

      that is
      glGenTextures(1, &m_renderer_id);
      glBindTexture(GL_TEXTURE_2D, m_renderer_id);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
      glBindTexture(GL_TEXTURE_2D, 0);

  • @siminho6929
    @siminho6929 3 года назад

    Really nice video :) Can someone explain me why we are using GL_RGB8 in glTextureStorage2D and GL_RGB in glTextureSubImage2D? Why we do not use the same layout for storing and specifying the same texture? And how do I find out what format should i have to use for different pictures?

    • @siminho6929
      @siminho6929 3 года назад

      Nevermind, in the next episode, it is explained :)

  • @nerijusvilcinskas7851
    @nerijusvilcinskas7851 Год назад

    Why does he use glTextureStorage2D instead of glTexImage2D? Is there a big difference?

  • @lwavery769
    @lwavery769 2 года назад

    His stb loader from the Opengl series works on version 4.5. This code does not.

  • @pulkitkhagta4218
    @pulkitkhagta4218 5 лет назад

    Is the Texture that can be rendered after this video be only a grayscale Black&White Image Or can we also load an RGB colored Image ?
    Cause if we can load Colored image then my image is coming good as an texture on Square.
    Btw , Thank You!! for the nice long informative video

  • @furball_vixie
    @furball_vixie 5 лет назад

    could you share your code highlighing config? because i realized you use different code highlight colors, would like to set that like that myself too..

    • @Puddlestomps
      @Puddlestomps 5 лет назад +1

      I think that is part of Visual Assist, which is a non-free extension for Visual Studio. I am not sure though. I think he talks about it in one of his early C++ videos? Maybe in the "BEST Visual Studio Setup for C++ Projects!" video?

  • @arlandria6036
    @arlandria6036 5 лет назад +1

    I'm getting "Hazel::Texture::Bind is inaccessible" error on the line m_Texture->Bind();.
    If i use dynamic casting to Hazel::OpenGLTexture2D it works but in the chernos case it works without casting. Anyone knowing what this is about? I checked the code with the with github code but couldnt find anything.

    • @arlandria6036
      @arlandria6036 5 лет назад

      turns out i forgot to put "public" keyword in the Texture2D class when i specify the base class "Texture" like this,
      class Texture2D : public Texture {
      ...
      }

    • @goldenlava1019
      @goldenlava1019 4 года назад

      @@arlandria6036 thank you, I had the same problem too. Yo saved me a lot of time

    • @goldenlava1019
      @goldenlava1019 4 года назад

      You

  • @shaiavraham2910
    @shaiavraham2910 5 лет назад

    Can you provide a link to your visual studio theme?
    The one in your discord FAQ seems to be outdated.

    • @RandomGuyyy
      @RandomGuyyy 5 лет назад

      I think it's the default Visual Assist theme

    • @semicolon4671
      @semicolon4671 5 лет назад

      Yes, it's the default Visual Assist Theme

  • @mario7501
    @mario7501 4 года назад

    Really don't switch to mac. All of the new openGL cause programs to crash. I can only get my code to run if I use glGenTextures etc.

  • @graph2001
    @graph2001 Год назад

    ChatGPT3.5 generated:
    - The transcript is from an episode in the "TEXTURES | Game Engine series."
    - The speaker discusses various topics related to game development, including smart pointers, assets, and OpenGL code.
    - They mention the flexibility of textures in game engines and how textures can contain different types of data.
    - The speaker emphasizes the importance of visualizing and validating data in shaders.
    - They discuss the process of loading and manipulating textures in the game engine and mention the need for an asset manager in the future.

  • @Matt23488
    @Matt23488 5 лет назад

    So I'm just getting a black empty texture rendering. I have double and triple-checked that I didn't make any mistakes with the added code, and I can see that the OpenGLTexture2D object seems to have been created properly. I assume it's an issue with Open GL on my computer, which just has Intel integrated graphics. Anybody have any ideas?

    • @jonphillips4082
      @jonphillips4082 5 лет назад

      i have same problem, double and triple checked too! don't think it's OpenGL. I've done many shader app's and they all worked in OGL, though i'm in "Windows 10" now the rest of my system is still the same. I'm still testing a few things, let you know if i find something.

    • @Puddlestomps
      @Puddlestomps 5 лет назад +1

      You could clone and compile the Hazel Github repository and see if the issue happens there too? This should be a definite indication whether the issue is with your code or with your pc.

    • @arlandria6036
      @arlandria6036 5 лет назад

      glTextureStorage2D(m_RendererID, 1, GL_RGB8, m_Width, m_Height);
      you could be using GL_RGB instead of GL_RGB8.

    • @deadyanothaikiropool1chait713
      @deadyanothaikiropool1chait713 5 лет назад

      meee too
      And I remember that Cherno talked about this in one of OpenGL videos but then I forget which videos

    • @jonphillips4082
      @jonphillips4082 5 лет назад

      Well I found if you bind the texture "after glTextureStorage2D" and unbind after glTextureSubImage2D, everything works!
      The OpenGL Series shows this, but Cherno didn't have to bind here! My problem is why???
      Is it the texture (absolute, relative) path at runtime?
      there's no error's at runtime so idk?
      why doesn't he need to do this!?

  • @MyChannelZs
    @MyChannelZs 5 лет назад +2

    Woaw first !

  • @slaygony2029
    @slaygony2029 5 лет назад

    So the Ref keyword doesn't exist for me, anyone else experience this?

    • @rynho7255
      @rynho7255 5 лет назад

      Check the previous episode

    • @Brad_Script
      @Brad_Script 9 месяцев назад

      it's a typedef for shared_ptr

  • @Grynjolf
    @Grynjolf 5 лет назад

    Wait you don't work for EA anymore?

    • @pooria_garrett3020
      @pooria_garrett3020 5 лет назад +1

      No

    • @Grynjolf
      @Grynjolf 5 лет назад

      @@pooria_garrett3020 do you know why?

    • @pooria_garrett3020
      @pooria_garrett3020 5 лет назад

      @@Grynjolf He explicitly mentioned he prefers working independently

    • @Grynjolf
      @Grynjolf 5 лет назад

      @@pooria_garrett3020 oh so you suspect that it was a voluntary decision? That makes sense. Would be scared to do it myself 😅

    • @pooria_garrett3020
      @pooria_garrett3020 5 лет назад +1

      @@Grynjolf Well I think it doesn't even matter, what does thou is that he's dedicated to the community now, and Cherno+community = great things to happen ...

  • @not_halls
    @not_halls Год назад

    no mac!

  • @austindrane3162
    @austindrane3162 5 лет назад

    I thought the best game engines used jpegs xD

    • @RamiAwar
      @RamiAwar 4 года назад

      Seriously I didn't get that JPEG shade throw xD What's wrong with compressed images! Maybe the texture is some weird rasterized image, why would I use anything uncompressed for that, genuinely interested in understanding that joke ;d

    • @solaris5303
      @solaris5303 3 года назад +1

      JPEG is overall a terrible format for storing game assets. It makes a huge sacrifice of quality for file size, doesn't support RGBA/baked mipmaps, and is overall just not worth using when you could go with .dds (most engines do this, but usually with a custom header) or even .png instead.

  • @monomere
    @monomere 5 лет назад

    uuuu early