Jump to content
Sign in to follow this  
rhumbaflappy

ReWorking Coasts with LWMs

Recommended Posts

Hi all.I've had some success understanding the reworking of coastal areas using LWMs ( Land Water Masks ).Here's my steps: 1) Define a new water mask ( flattened to 0 meters ). 2) Define the land mask with a height of -9999 ( no flattening... mesh-clinging ). 3) Add a series of 2-point LWM land polys at elevation. The points are neighboring points. 1-point doesn't work, or I'd have used that. I just picked a few areas to raise, to make the mesh look OK. There's more art than science here now, but that may change. Quite a difference for adding only 8 2-Point polys and the 2 larger masks. ( 10 masks total ). The terrain engine fills interpolates the terrain between the mesh, masks, and the points. Here's the code:

 ; -------------------------------------------------------------------- include TDFMacros.incinclude TDFHeaders.inc ; ReWorked Coast N35* 13.62'   E24* 0.13' ; --------------------------------------------------------------------BGLHeader 37, 28, 30, 22, LWMHeader, TerrainHeaderStart  	    LWMHeader label word	  LWMFileHeader 513, LWMIndexStart, LWMStart, LWMEnd ; --------------------------------------------------------------------LWMStart label word  datamark_0 label word   LWMDataAreaDrawPolygonsEx 7, 3, 1, 6, 25, 3    LWMPoly2  14, 0, 0, 0, 0 	LWMPoint 73, 96	LWMPoint 0, 50	LWMPoint 0, 255	LWMPoint 243, 255	LWMPoint 233, 232	LWMPoint 204, 224	LWMPoint 198, 224	LWMPoint 189, 240	LWMPoint 169, 240	LWMPoint 114,224	LWMPoint 55, 236	LWMPoint 41, 205	LWMPoint 41, 190	LWMPoint 64, 139    LWMPoly2  16, 0, 1, -9999, 0 	LWMPoint 73, 96	LWMPoint 0, 50	LWMPoint 0, 0	LWMPoint 255, 0	LWMPoint 255, 255	LWMPoint 243, 255	LWMPoint 233, 232	LWMPoint 204, 224	LWMPoint 198, 224	LWMPoint 189, 240	LWMPoint 169, 240	LWMPoint 114,224	LWMPoint 55, 236	LWMPoint 41, 205	LWMPoint 41, 190	LWMPoint 64, 139    LWMPoly2  2, 0, 1, 480, 0 	LWMPoint 254, 0	LWMPoint 255, 1      LWMPoly2  2, 0, 1, 210, 0 	LWMPoint 160, 60	LWMPoint 161, 61    LWMPoly2  2, 0, 1, 180, 0 	LWMPoint 95, 0	LWMPoint 96, 1    LWMPoly2  2, 0, 1, 70, 0 	LWMPoint 140, 140	LWMPoint 141, 141    LWMPoly2  2, 0, 1, 65, 0 	LWMPoint 114, 155	LWMPoint 115, 156      LWMPoly2  2, 0, 1, 55, 0 	LWMPoint 99, 182	LWMPoint 100, 183      LWMPoly2  2, 0, 1, 50, 0 	LWMPoint 83, 200	LWMPoint 84, 201    LWMPoly2  2, 0, 1, 35, 0 	LWMPoint 169, 205	LWMPoint 170, 206   datamark_1 label word  ; -------------------------------------------------------------------- Cell_435_155 EQU LWMCellID 0, 0, 3, 435, 155  LWMIndexStart label word   LWMIndexHeader  1, LWMIndexData  LWMIndexData label word   LWMIndexEntry		 Cell_435_155, LWMStart, datamark_0, datamark_1 ; -------------------------------------------------------------------- LWMEnd label word ; --------------------------------------------------------------------

Many thanks to Chris Wilkes for his help.With this part of the puzzle working, my example sets for LWMs are complete. I need to write a short section on this re-meshing of coastal areas, then the tutorial will be done... I'll post it today or tomorrow.Dick

Share this post


Link to post
Share on other sites
Guest GerrishGray

Great work Dick! You're really pushing back the frontiers of our knowledge of how these things work. This time, we know that there is going to be NO SDK from Microsoft to pretend that they were going to tell us anyway, just after you have completed your work !!!!!Gerrish

Share this post


Link to post
Share on other sites
Guest Claviateur

Interesting but is there a way to make the sandy shores follow your new bay?CheersMichel

Share this post


Link to post
Share on other sites

Hi Michel.Yes, you can rework the shorelines.The FS2002 Terrain SDK states you can exclude the default beaches by replacing Layer 8 ( that's done by setting the bReplace bit in the VTPLayer structure ). I have some experimenting to do with this, but it is possible... and redrawing the lines is not a problem.VTP Method 2 polygons/lines use an entire LOD8 Cell as an Area, while LWMs and VTP Method1 polys use just the LOD13 as an area. The problem here is simply setting the Replace for a shoreline will require you to redraw the entire Cell ( LOD8 ). That's a big area. So I need to make sure I can just replace an LOD13 Area by first forcing a Layer 8 relacement with VTP Method1... if that's possible.Shorelines are VTP Method2 lines, as described by the SDK.Dick

Share this post


Link to post
Share on other sites

Hi, again, Michel.Here's short VTP code that excludes the shorelines. It's a small line with a width of 1. You can't see it, but it replaces the Layer 8s in the LOD13 Area... that's really good news. The line will replace all of the specified Layer within the LOD13 Areas that it resides in, and leave the rest of the LOD8 Cell alone! So exclusion of shorelines, and their effects, becomes pretty easy.Here's the code:

include TDFMacros.incinclude TDFHeaders.inc; ReWorked Coast	N35* 13.62'   E24* 0.13'BGLHeader	37, 28, 30, 22, TerrainHeaderStart, VTPHeader							VTPHeader	label	word	VTPFileHeader	256, VTPIndexStart, TextureStart, VTPEndVTPStart		label	word	datamark_v0	label 	word		VTPDataArea		1, 1, 0, 0			VTPLayer			8, 1			VTPNumTexturesInLayer	1, 0			VTPTextureId		0, 0			VTPPolyCount		1, 0				VTPPolyMethod2		2, 1, 0					VTPWidePoint		5611, 1, 10506, 0						VTPWidePointWidth	1				VTPWidePoint		5619, 0, 10514, 0		datamark_v1	label	word; --------------------------------------------------------------------Cellv_435_155	EQU	VTPCellID 0, 435, 155	VTPIndexStart	label	word		VTPIndexHeader	1, VTPIndexData, VTPStart	VTPIndexData	label	word		VTPIndexEntry		 Cellv_435_155, VTPStart, datamark_v0, datamark_v1; --------------------------------------------------------------------TextureStart	label	word	VTPTextureListHeader	1, TextureIndexStart, TextureDataStart, TextureDataEndTextureIndexStart	label	word	VTPTextureListEntry	TextureDataStart, texturemark_0, texturemark_1TextureDataStart	label	word	texturemark_0	label	word		VTPTextureName 	"1045"		VTPTextureType	2, 0, 0, 4	texturemark_1	label	wordTextureDataEnd	label	word; --------------------------------------------------------------------VTPEnd		label	word

and a picture:

Share this post


Link to post
Share on other sites
Guest

Thank you thank you thank you. I was just going to try working this out myself. You saved me the time!!!Lee.

Share this post


Link to post
Share on other sites

Hi all.Here's the shorelines rebuilt and the automatic wave action works!

include TDFMacros.incinclude TDFHeaders.inc; ReWorked Coast	N35* 13.62'   E24* 0.13'BGLHeader	37, 28, 30, 22, TerrainHeaderStart, VTPHeader							VTPHeader	label	word	VTPFileHeader	256, VTPIndexStart, TextureStart, VTPEndVTPStart		label	word	datamark_v0	label 	word		VTPDataArea		1, 1, 0, 0			VTPLayer			8, 0			VTPNumTexturesInLayer	1, 0			VTPTextureId		0, 0			VTPPolyCount		1, 0				VTPPolyMethod2		14, 1, 0				VTPWidePoint		5564, 1, 10474, 0						VTPWidePointWidth	1					VTPWidePoint		5610, 1, 10505, 0						VTPWidePointWidth	63				VTPWidePoint		5683, 0, 10551, 0					VTPWidePoint		5674, 0, 10590, 0					VTPWidePoint		5651, 0, 10645, 0					VTPWidePoint		5651, 0, 10660, 0					VTPWidePoint		5665, 0, 10691, 0					VTPWidePoint		5724, 0, 10679, 0					VTPWidePoint		5779, 0, 10695, 0					VTPWidePoint		5799, 0, 10695, 0					VTPWidePoint		5808, 0, 10679, 0					VTPWidePoint		5843, 0, 10687, 0					VTPWidePoint		5855, 0, 10710, 0				VTPWidePoint		5875, 1, 10741, 0						VTPWidePointWidth	0	datamark_v1	label	word; ---------------------------------------------------------------------Cellv_435_155	EQU	VTPCellID 0, 435, 155	VTPIndexStart	label	word		VTPIndexHeader	1, VTPIndexData, VTPStart	VTPIndexData	label	word		VTPIndexEntry		 Cellv_435_155, VTPStart, datamark_v0, datamark_v1; --------------------------------------------------------------------TextureStart	label	word	VTPTextureListHeader	1, TextureIndexStart, TextureDataStart, TextureDataEndTextureIndexStart	label	word	VTPTextureListEntry	TextureDataStart, texturemark_0, texturemark_1TextureDataStart	label	word	texturemark_0	label	word		VTPTextureName 	"1045"		VTPTextureType	2, 0, 0, 4	texturemark_1	label	wordTextureDataEnd	label	word; --------------------------------------------------------------------VTPEnd		label	word

I think all this code... the LWMs and the VTPss can be included into one BGL. And that may be preferred, as there are datastream issues that need to be watched. For example, I named my 'shoreline exclusion' as "VTP2X.bgl" so I needed the shoreline rebuild named farther down the alphabet, or I'd mess up the datastream ( "X2.bgl" ). If you goof up the datastream, you'll exclude the pretty beaches you just built!Ahhh... the endless surf....

Share this post


Link to post
Share on other sites
Guest Claviateur

Wow thanks :) I just found the tutorial in the library so I download it and I will start reading and experiementing with itI will also learn from your code as well :)Cheers!Michel

Share this post


Link to post
Share on other sites
Guest

I have tried to put more than one area in one bgl-file, but I think I'm doing something wrong :-(Area 15,25 and 16,25 in Cell 396,78.include TDFMacros.incinclude TDFHeaders.inc; ReWorked CoastBGLHeader 65, 60, 8, 4, LWMHeader, TerrainHeaderStart LWMHeader label word LWMFileHeader 513, LWMIndexStart, LWMStart, LWMEndLWMStart label word datamark_0 label word LWMDataAreaDrawPolygonsEx 7, 3, 1, 15, 25, 3 LWMPoly2 14, 0, 0, 0, 0 LWMPoint 73, 96 LWMPoint 0, 50 LWMPoint 0, 255 LWMPoint 243, 255 LWMPoint 233, 232 LWMPoint 204, 224 LWMPoint 198, 224 LWMPoint 189, 240 LWMPoint 169, 240 LWMPoint 114,224 LWMPoint 55, 236 LWMPoint 41, 205 LWMPoint 41, 190 LWMPoint 64, 139 LWMPoly2 16, 0, 1, -9999, 0 LWMPoint 73, 96 LWMPoint 0, 50 LWMPoint 0, 0 LWMPoint 255, 0 LWMPoint 255, 255 LWMPoint 243, 255 LWMPoint 233, 232 LWMPoint 204, 224 LWMPoint 198, 224 LWMPoint 189, 240 LWMPoint 169, 240 LWMPoint 114,224 LWMPoint 55, 236 LWMPoint 41, 205 LWMPoint 41, 190 LWMPoint 64, 139 LWMPoly2 4, 0, 1, 400, 0 LWMPoint 0, 0 LWMPoint 255, 0 LWMPoint 255, 255 LWMPoint 0, 255 datamark_1 label word;-------------------------------- LWMDataAreaDrawPolygonsEx 7, 3, 1, 16, 25, 3 LWMPoly2 14, 0, 0, 0, 0 LWMPoint 73, 96 LWMPoint 0, 50 LWMPoint 0, 255 LWMPoint 243, 255 LWMPoint 233, 232 LWMPoint 204, 224 LWMPoint 198, 224 LWMPoint 189, 240 LWMPoint 169, 240 LWMPoint 114,224 LWMPoint 55, 236 LWMPoint 41, 205 LWMPoint 41, 190 LWMPoint 64, 139 LWMPoly2 16, 0, 1, -9999, 0 LWMPoint 73, 96 LWMPoint 0, 50 LWMPoint 0, 0 LWMPoint 255, 0 LWMPoint 255, 255 LWMPoint 243, 255 LWMPoint 233, 232 LWMPoint 204, 224 LWMPoint 198, 224 LWMPoint 189, 240 LWMPoint 169, 240 LWMPoint 114,224 LWMPoint 55, 236 LWMPoint 41, 205 LWMPoint 41, 190 LWMPoint 64, 139 LWMPoly2 4, 0, 1, 600, 0 LWMPoint 0, 0 LWMPoint 255, 0 LWMPoint 255, 255 LWMPoint 0, 255 datamark_2 label word;--------------------------------Cell_396_78 EQU LWMCellID 0, 0, 3, 396, 78 LWMIndexStart label word LWMIndexHeader 1, LWMIndexData LWMIndexData label word LWMIndexEntry Cell_396_78, LWMStart, datamark_0, datamark_2LWMEnd label word

Share this post


Link to post
Share on other sites

Hi knnygar.You should useLWMDataAreaDrawPolygons 3, 3, 1, 15, 25 LWMDataAreaDrawPolygonsEx 3, 3, 1, 16, 25Each Area has only 3 polygons, so you do not need Extended.Also, I suspect the draw ordering may not be what you want. The datastream controls the order, so what comes first in the code, will be executed first in the draw order.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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...