Author Topic: vertex ranges.  (Read 2943 times)

0 Members and 1 Guest are viewing this topic.

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
vertex ranges.
« on: July 24, 2013 »
hey guys this maybe seems a little bit of a strange question.

ive been messing about quite a lot with model loading and one thing ive noticed is that everyone except me uses huge vertex values ranging in the 100's before any transforms or scaling just raw data, where as internally i use values in the 1.0 -1.0 (which makes my scenes roughly 20x2x20 in size) so these models when loaded are absolutely huge.

ive had too simply scale all these models based on the absolute value out of the xyz's of all the vertex's too pull everything down inside 1.0 too make them usable.

i got too thinking though maybe my shadow map glitches are coming from the fact my scenes are soooooo small when my maps are being calculated. so started having a deeper look at some of the code these big models came from and cant see any scaling down, done they dont scale inside the shaders or c code or anywhere i can see.

i dont really understand how there scenes look relatively the same scale as mine when rendered without scaling. if i were too load in these complete scenes as is it would feel a bit like the camera was attached too an ant  :)

am i missing a trick here or do you guys work with quite small values too?

-edit i should probably add that my transforms are pretty basic just like so...
Code: [Select]
       // init
        perspectivematrix(45.0f, (float)screen.right / (float)screen.bottom, 0.1f, 1000.0f);
        // setup camera identity
        // setup model identity
       
       // main
        // do look at stuff for camera
        // set model matrix
       // send them through too vertex shader and do a streight forward transform
« Last Edit: July 25, 2013 by ninogenio »
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: vertex ranges.
« Reply #1 on: July 26, 2013 »
Don't put too much thought into this.
When you import meshes which were created at different scales, you have to resize them to some common scale.
If you're working in the range +/-1 or +/-100000000 doesn't make much of a numerical difference, though.
In fact +/-1 doesn't use positive exponents, so you're "wasting" exactly one bit of precision (the sign bit of the floating point exponent).
However, if you're storing your values in integer texture formats you have to keep track of your ranges of course.
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: vertex ranges.
« Reply #2 on: July 27, 2013 »
cheers hellfire,

that makes perfect sense, so really just go with what ever works/suits the particular transforms in use. i just wanted too make sure i wasn't doing anything strange in initially scaling into 1.0/-1.0 ranges. im trying too code a system that lets me build one big offline map out of lots of different smaller meshes then upload all the components too vbo's and treat it as one scene its proving quite a bit tougher than i first thought but its getting there :)
Challenge Trophies Won: