Sign in to follow this  
rhumbaflappy

VTP source code HELP

Recommended Posts

Hello friends,I'm trying to write VTP and LWM source data from 'first principles'. I am comfortable programming in C and other scripts so I thought why not use such knowledge to program terrain data automatically - the problem is that I have managed to understand how to code LWMs (the terrain SDK for fs02 didn't help much - what REALLY helped was Rhumbaflappy's tutorial!) but I am finding VTP hard mostly cause there are texture issues!Can anyone point me to some reference regarding VTP data. Obviously, i'm using rhumbaflappy's include files.CheersStorm

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

I just went through the same ordeal and implemented VTP and LWM in C++. Based on the FS 2002 Terrain SDK doc (Terrain Texture Names.doc) and rhumbaflappy's latest include files the structure becomes entirely transparent.I wish that could be said for the other non terrain fields and all the other BGL data.

Share this post


Link to post
Share on other sites

Hi Storm.The SDK was incorrect about how sesonal textures are packed. They show them separated by commas:

Share this post


Link to post
Share on other sites

Thanks Mat and Dick,The code example is extremely helpful - Dick, one question:- can I use my own textures for coast (I see you have 'Santa' textures so I guess that the question is redundant but anyway)? If yes, what's the recipe (in terms of image format, size etc) to get the texture on the VTP?CheersStorm

Share this post


Link to post
Share on other sites

Hi Storm.I usually use the extended 8-bit format ( 8-bit, mipped, with alpha as transparent ). I believe DXT1 with or without alpha can also be used, but the alpha will be transparent. Textures should be 256x256 pixels.As far as the VTPTextureType, the above example used 3, 0, 0, 4... but I'm not sure these values make any difference... play with it and see.Dick

Share this post


Link to post
Share on other sites

Hi Dick,Managed to code VTP (at last!) - thanks, once again for the invaluable support.One question regarding the position of VTP points:I'm using BMP maps (representing 4x4 LOD 13 areas = 1024x1024 points) to retrieve coastline data.I translate pixel position to LOD 8 location using the following formula:(StartX+(PixelPosition*NumOfSectorPnts)/Width)StartX = left most boundary position of 4x4 cell (I'm sure this value is correct)PixelPosition = pixel column valueNumOfSecPnts = 1024Width = Image WidthIn FS I'm getting the points at position 0 offset (from the LOD8 grid lines). Obviously this results in all the polygons being offset. I'm pretty sure I have to apply some offset after translating pixel values but I can't figure out the formula to use. Any idea?RgrdsStorm

Share this post


Link to post
Share on other sites

Hi Storm.I'm not sure this is what you need, but VTP2 has 255 x 255 points in an LOD13 area... not 256 x 256 like LWM polys. And we have no idea why MS coded it this way!Christian Stock is using a GIS program to create VTP and LWM data, and was frustrated to find they don't line up ( shorelines and water polys ), for just this reason. Dick

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this