VertexW

Blitz3D Forums/Blitz3D Programming/VertexW

mrtricks(Posted 2005) [#1]
In the docs, it states this is an optional redundant attribute that was intended for future use. Did it ever get used? For what was it intended? I've an idea to make use of it to store a certain type of data I need to access.

If it turns out I can, how much could I store in it? I want to be able to store a Surface handle and a Vertex number (so up to 40000). That's presumably 4 bytes for the surface handle and 2 for the vertex number. If VertexW is a float, could I theoretically 'convert' a long word or two short words to a float? (i.e. make a function that Pokes a Float into a bank, then Peeks a Long Word) And if so, how stable are floats if I copy VertexW from one vert to another? the long words and short words I read back have to be absolutely the same or the whole system falls apart.

Weird request I know, but if it's possible it saves having to create and maintain a huge databank.


RGR(Posted 2005) [#2]
If you want to save your meshes as b3d-File with the VertexWs you would have to check if Blitz loads it as its saved; what happens indeed if you get the values back after you loaded it and then use VertexW(surf,index).
Not tried but I guess it should work since you can declare how many parameters you want to save/load.


PowerPC603(Posted 2005) [#3]
The U and V coordinates are used for texturemapping.
Each vertex can have a set of UV-coordinates.
They specify the x and y coordinates on the texture where the vertex should be on the texture.

The W coordinate will be used in the future for 3D textures (today, only 2D textures in the form of bitmaps exist).

VertexW is a float indeed.


RGR(Posted 2005) [#4]
PowerPC603, everybody, as long as its not a beginner knows what the U V coordinates are for - its not the beginner forum here where you posted that.
I think what he meant was, is it possible to use the w coordinate to store some other stuff and recall it when its loaded back...
What you are doing is playing the teacher where its not needed at all - telling nothing new ...
BTW: Did you see what he programmed? I bet he used u v coordinates before...


mrtricks(Posted 2005) [#5]
That's okay RaGR, I still got my question answered. 3D textures? Whatever next? As for saving or loading B3d's, that won't be necessary as it's all custom meshes created during gameplay.

How about the convert float to longword thing? I can try it when I next get some time, but has anyone tried it? I don't mean the number itself, just using the bytespace of the float to store a longword.


RGR(Posted 2005) [#6]
The Float keeps the value you put in - it can be the "picture" of an integer in case you need integers. Whatever it is in Floats you do not have to care as long as you can place it in a bank and recall it as integer.
So the way would be: Poke an integer or short in a 4-byte-bank, peek it as float, assign it to the w-coord and do the reverse to get it back.
As you suggested already... you can use the bytespace even if its a weird float ;-)


Ross C(Posted 2005) [#7]
You can't store values in vertexW() unfortunatly.


RGR(Posted 2005) [#8]
As I mentioned above I have not tested VertexW - that's really bad news then concerning that plan...
Just made a test - right - whatever you put into the w-coord it is returned as 1.0


mrtricks(Posted 2005) [#9]
Bugger.

What about the normals? I might not need to use them as lighting normals, so I could possibly use them. Are they floats? And if I'm making the mesh fullbright, the normals are redundant, right?


RGR(Posted 2005) [#10]
Better News

You have won 12 Bytes each Vertex ... :-)
I just changed Normals and recalled them and they do not disturb the look of the fullbright mesh...

Needs a bit further testing I guess ... but works at first sight
How long shall I keep the testprogram open? Any more questions? - lol ;-)


mrtricks(Posted 2005) [#11]
Thanks for that! That's good news! Each 'chunk' of verts I have in my system is 12 verts, so I've 144 bytes to play around with... No need to sit waiting poised by your PC any longer ;)


Ice9(Posted 2005) [#12]
UVW = XYZ where W is the Z coordinates of the texture. It's used in bump mapping


Tom(Posted 2005) [#13]
If my memory servers me right, Mark mentioned one time that since the W element wasn't really being used (at least, no one seemed to be using it for anything), so he *borrowed* it to store bone IDs when he introduced skinned meshes/vertex weighting.