UV map question
-
- Posts: 9
- Joined: Thu May 18, 2017 10:35 am
UV map question
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) ?
-
- Posts: 9
- Joined: Thu May 18, 2017 10:35 am
Re: UV map question
[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
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
-
- Posts: 16
- Joined: Sun Mar 27, 2016 7:20 pm
Re: UV map question
Another option is 16 bit floats.