Results 1 to 6 of 6

Thread: M15 texturing - UV Coordinates

  1. #1
    Member dcromley's Avatar
    Join Date
    Apr 2009
    Location
    Wyoming, USA
    Age
    86
    Posts
    80
    Rep Power
    24

    M15 texturing - UV Coordinates

    Hello,
    I am looking at the TBGL_0220_Samples/Bones/TBGL_0200_AnimatedCubes.tbasic.
    This, with the Cubes.M15 model and the kp4_..bmp texture make a great demo.

    I don't get the TextureUCoordinate (and V) POLY parameters at all.
    For example, the first POLY has "282.237196,1024.955354" for the U,V.
    The *.bmp is 256x256. Can you point me to somewhere? Thanks, Dave

  2. #2
    thinBasic MVPs Michael Hartlef's Avatar
    Join Date
    Sep 2006
    Location
    Germany
    Age
    58
    Posts
    3,299
    Rep Power
    348

    Re: M15 texturing - UV Coordinates

    Hi dcromley,

    welcome here on the forum. I can't answer the question 100% as I think the cube M15 model was made with thinEdge, Petr Schreibers model application.
    When you look into the help file of TBGL and there under TBGL_TexCoord2D you will see that a value bigger then 1 means texture repitition. But then again, I can't see that in the output so Petr can answer that better.

    Michael

  3. #3
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Re: M15 texturing - UV Coordinates

    Welcome!,

    Mike was correct of course.

    TBGL / OpenGL texture coordinates do not store pixel positions, but relative positions. This way the UV mapping doesn't become damaged when you change texture to 2x bigger resolution for example.

    I attach 2 pictures for you to explain.

    If you are confused by the big numbers representing UV coords in the model, it is because in ThinEdge you can stretch and shift the texture over the model, so I got little mad and shifted and stretched ... too much


    Petr
    Attached Images Attached Images
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  4. #4
    Member dcromley's Avatar
    Join Date
    Apr 2009
    Location
    Wyoming, USA
    Age
    86
    Posts
    80
    Rep Power
    24

    Re: M15 texturing - UV Coordinates

    Michael,
    >welcome to the forum
    Thanks! This thinBasic is awsome!

    >help file of TBGL .. TBGL_TexCoord2D
    I hadn't looked at TBGL texturing. Jumped ahead to M15 and missed it. Thanks.
    But it still doesn't answer everything. Especially the repetition.

    Petr,
    >Welcome!
    Thanks! This thinBasic/TBGL is awsome!

    I have everything I want now, just using simple 0-1U and 0-1V. Thanks.
    And I could repeat if I want (bigger than 1).
    But that UV = "530.194719,1922.791202" in the Cubes.M15 file really blew my mind
    and led me astray. The difference is 1392.596483. That's quite a bit bigger than 1.
    And why all the decimals?

    Don't go away guys -- I'll have more questions. As I learn this thinBasic, I have this
    great plan to write great learning examples/tutorials while it's still fresh in my mind.
    I wonder if I will follow up.

  5. #5
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Re: M15 texturing - UV Coordinates

    To not confuse you,

    I will prepair new version of the model, which will have "nice" UVs.
    The current ones were done in ThinEdge after many texture transformations as I said, so I admit it looks odd.

    I will update the help file with pictures in my last post as well.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  6. #6
    thinBasic MVPs Michael Hartlef's Avatar
    Join Date
    Sep 2006
    Location
    Germany
    Age
    58
    Posts
    3,299
    Rep Power
    348

    Re: M15 texturing - UV Coordinates

    That sounds like a nice plan. Franck aka Lionheart008 does a similar thing reagrding tutorials and samples.

    Why so many decimals? Well, simply you need them. Let's take a texture with 512x512 pixel. A polygon isn't allways texture with the full image, rather with just parts of it.

    So let's say that your polygon needs a texture going from 0,0 to 308,125. If you calculate with 5 digits the texture coords would be 0.60156 , 0.24414 (308/512 and 125/512) .

    If you would use only 1 digit, then the texture coordinates in pixel would be different. A texture coord of 0.6 , 0.2 would be 307,102 in pixel. Surely not something we want. You see, the more digits, the more precise the conversion from pixel to texture coords and vice versa will be.



Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •