https://linen.dev logo
Join Discord
Powered by
# lime
  • t

    tall-teacher-57409

    05/07/2023, 1:25 PM
    according to these coordinates
  • h

    hallowed-ocean-84954

    05/07/2023, 1:31 PM
    ok - so the rect coordinates are the position of a vertex in 3D space. The texture coordinate is a 2D coordinate addressing a texel (pixel in the texture basically) in a texture.
  • h

    hallowed-ocean-84954

    05/07/2023, 1:32 PM
    by associating a particular texture coordinate with a vertex you are saying lookup the texel at say (1, 1) and put that at the vertex at (0.5, 0.5, 0.0)
  • t

    tall-teacher-57409

    05/07/2023, 1:32 PM
    oh!!
  • t

    tall-teacher-57409

    05/07/2023, 1:33 PM
    that's much clearer, thank you for explanation 👍
  • h

    hallowed-ocean-84954

    05/07/2023, 1:35 PM
    sure - no worries
  • t

    tall-solstice-92437

    05/07/2023, 4:58 PM
    Texcoords/UVs/Whatever else you can call them, are pretty simple. Say you store your texture as a 2D array of pixels. Next lets say you want to display this texture on a surface. How would you do that?
  • t

    tall-solstice-92437

    05/07/2023, 5:01 PM
    Well, think of the texture coordinates as an index into the pixel array... sort of. You see, these texture coordinates are "normalized" to a range of 0.0 to 1.0, anything above or below that range and the texture will repeat (or nothing will display, this depends on how you have the texture set up to deal with "wrapping" in your particular graphics API)
  • t

    tall-solstice-92437

    05/07/2023, 5:03 PM
    Also good things to note: How you have your texture "interpolated" between these coordinates matters. That is what bilinear filtering does, it interpolates between each pixel color linearly depending on how close the texture coordinate is to a give pixel
  • t

    tall-solstice-92437

    05/07/2023, 5:04 PM
    You can actually interpolate manually in the shader as well
  • t

    tall-solstice-92437

    05/07/2023, 5:06 PM
    another thing one can do with shaders is restrict these uv values per-fragment to get an emulated point-filter. This can be handy when you are messing with a low res artstyle and are doing some sort of warping on your texture, but want to preserve the look of it being perfectly pixelated.
  • t

    tall-solstice-92437

    05/07/2023, 5:07 PM
    Also, keep in mind that you aren't storing texcoords per-fragment, but per vertex. This means the GPU will interpolate between connected vertices' uv values in a triangle
  • t

    tall-solstice-92437

    05/07/2023, 5:08 PM
    I hope all of this is helpful and makes sense
  • h

    hallowed-ocean-84954

    05/07/2023, 5:21 PM
    What is a point-filter ?
  • t

    tall-teacher-57409

    05/07/2023, 5:24 PM
    thanks for the effort you put in your answer, extremely helpful 😄
  • t

    tall-teacher-57409

    05/07/2023, 5:25 PM
    I was also confused with the term "uv" since many people use it, turns out its the same as texture coordinates
  • t

    tall-teacher-57409

    05/07/2023, 5:33 PM
    by the way
  • t

    tall-teacher-57409

    05/07/2023, 5:33 PM
    how can I test the canvas context
  • t

    tall-teacher-57409

    05/07/2023, 5:33 PM
    I want this to run instead of the webgl

    https://cdn.discordapp.com/attachments/769686258049351722/1104823454567510157/image.png▾

  • t

    tall-solstice-92437

    05/07/2023, 5:40 PM
    Also can be called "nearest" or "nearest point", it's the filtering type you use when you use usually when you want to make a game with pixel art or a "retro" look. It makes the pixels (or really texels) of a texture look blocky
  • h

    hallowed-ocean-84954

    05/07/2023, 5:41 PM
    Ah ok. Yeah I did that recently I think in a frag shaderto create larger "pixels"
  • h

    hallowed-ocean-84954

    05/07/2023, 5:41 PM
    Thanx
  • t

    tall-solstice-92437

    05/07/2023, 5:43 PM
    BTW, I've been trying to look into starting with lime. Any good resources on how lime works, or is it basically just "read the source"?
  • h

    hallowed-ocean-84954

    05/07/2023, 5:53 PM
    Yeah I don't know of any except the api doc and the source and the api doc is thin
  • t

    tall-solstice-92437

    05/07/2023, 5:53 PM
    Ok
  • t

    tall-solstice-92437

    05/07/2023, 5:54 PM
    Thanks for the help
  • h

    hallowed-ocean-84954

    05/07/2023, 5:59 PM
    There are lime- samples also though they are in general very simple
  • t

    tall-teacher-57409

    05/08/2023, 5:31 PM
    how do you initialize an identity matrix with
    lime.Math.Matrix4
    , I'm confused about how to use it tbh
  • t

    tall-teacher-57409

    05/08/2023, 5:47 PM
    Copy code
    hx
    var transMat = [
                1, 0, 0, 0,
                0, 1, 0, 0,
                0, 0, 1, 0,
                0, 0, 0, 1,
            ];
    
            var trans:Matrix4 = new Matrix4(new Float32Array(transMat));
    I think that's how?
  • h

    hallowed-ocean-84954

    05/08/2023, 5:58 PM
    I actually bind a Float32Array to a gl.uniformMatrix4fv. I haven't tried binding a matrix type directly but the API looks like it takes a Dynamic so it might work. But I also don't use a lime.Math.Matrix. I use an openfl.goem.Matrix because my test app also uses openfl for other reasons.
1...109110111...138Latest