ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Thu Dec 14, 2017 4:09 am

All times are UTC




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
 Post subject: UV map question
PostPosted: Tue Dec 05, 2017 2:22 pm 

Joined: Thu May 18, 2017 10:35 am
Posts: 6
how many ways are there for storing UV coordinates (both x and y) in only 4 bytes (or even 2 bytes) instead of the usual way of using two floats (8 bytes) ?


Top
   
 Post subject: Re: UV map question
PostPosted: Tue Dec 05, 2017 5:37 pm 

Joined: Thu May 18, 2017 10:35 am
Posts: 6
[this is for people who might come here from google]
My problem got solved. it turns out there were two bytes giving the x and y coords.
so I just did this >

int bytex= reader.ReadByte();
float x = (float)bytex / 255;
int bytey= reader.ReadByte();
float y = (float)bytey / 255;

so basically for any type of uv coords value other than float:

int value= reader.<read the byte(bytes)>
float actualValueInFloat = (float)value/type.Maxvalue) //where type.Maxvalue gives the maximum number allowed in the value type)

Im not saying this would work for every scenario. but you should give it a try


Top
   
 Post subject: Re: UV map question
PostPosted: Thu Dec 07, 2017 3:01 pm 

Joined: Sun Mar 27, 2016 7:20 pm
Posts: 3
Another option is 16 bit floats.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited