I've bodged several bits of example-code together, to try to get a orthogonal view of a triangle-tiled mesh.
This picture is the result so far:

Now I would expect just the "cone" to be lit from the one side and shaded on the other.
But the adjacent triangles (witch are flat, also show light and shadow.
Is there a way to have just the cone (hill) to be lit and not the surroundings? Or is this result to be expected?
A second question I have is; how much do I have to scale the mesh,
to get a "more or less" pixel-perfect representation of the brush?
Any help or pointers I would greatly appreciate.
This is the brush I used:
This picture is the result so far:
Now I would expect just the "cone" to be lit from the one side and shaded on the other.
But the adjacent triangles (witch are flat, also show light and shadow.
Is there a way to have just the cone (hill) to be lit and not the surroundings? Or is this result to be expected?
A second question I have is; how much do I have to scale the mesh,
to get a "more or less" pixel-perfect representation of the brush?
Const UI_distance=-10000 ; Camera distance for UI camera Global TG_camera.TG_cam Type TG_cam Field camera% ; Pointer to camera entity Field pos_x% Field pos_y% Field siz_x% Field siz_y% End Type TG_camera.TG_cam = New TG_cam ; UI constructors Function TG_Initialise() ; FUNCTION : initialise UI camera and mouse pointer ; loads rectangular mesh that's basis of all UI sprites HidePointer() TG_sprite = CreateMesh() surf = CreateSurface(TG_sprite) TG_camera\camera=CreateCamera() PositionEntity TG_camera\camera,0,0,UI_distance CameraProjMode(TG_camera\camera,0) ; 0 to hide, 2 to render CameraClsMode(TG_camera\camera,0,1) CameraRange TG_camera\camera,1,100 End Function ; UI control Function TG_Draw_UI() UpdateWorld RenderWorld CameraProjMode (TG_camera\camera,2) End Function ;Map values Const MINMapSize=5 Const MaxSlope=4 Const MinHeight=0 Const MaxHeight=31 ;Triangle values ;Const TriD=20,TriDMin =TriD-1 ;d=depth Const TriWidth=20,TriWidthMin=TriWidth-1 Const TriHeight=20,TriHeightMin=TriHeight-1 Const triviewwidth=11 Const triviewheight=11 Const upuv =0 Const downuv =1 Const leftuv =2 Const rightuv=3 Const miduv =4 ;Map Variables Global HeightMap,RSUSurfMap,USDSurfMap Global MapMaxSize=6 Global MapXPos=0,MapYPos=0 Global MapPos;position in bank Global MapMinPos,MapMaxPos Global TSP;totalscreenpoints Global MapSize=5;number of landsize Global MapWidth;width (and Depth) of land Global MapAnd;mapwidth-1 Global BnkSize;total bytes of positions in a map Global BankAnd;BnkSize-1 Global MapR,MapL Global MapLU Global MapRU Global MapLD Global MapRD ;Triangle values Global SurfaceMesh Global SurfaceBrush Global SurfaceSurface Dim vertexMap(triwidthmin,triheightmin,5);array with RUS and USD TRI Dim SurfaceDat#(15,4) SurfaceDat(0,upuv) = 0.01 SurfaceDat(0,downuv) = 0.24 SurfaceDat(0,leftuv) = 0.01 SurfaceDat(0,rightuv) = 0.24 SurfaceDat(0,miduv) = 0.125 SurfaceDat(1,upuv) = 0.01 SurfaceDat(1,downuv) = 0.24 SurfaceDat(1,leftuv) = 0.26 SurfaceDat(1,rightuv) = 0.49 SurfaceDat(1,miduv) = 0.375 SurfaceDat(2,upuv) = 0.01 SurfaceDat(2,downuv) = 0.24 SurfaceDat(2,leftuv) = 0.51 SurfaceDat(2,rightuv) = 0.74 SurfaceDat(2,miduv) = 0.625 SurfaceDat(3,upuv) = 0.01 SurfaceDat(3,downuv) = 0.24 SurfaceDat(3,leftuv) = 0.76 SurfaceDat(3,rightuv) = 0.99 SurfaceDat(3,miduv) = 0.875 ; Graphics3D 800,600,0,0 TG_Initialise() Init_Surface() Generate_Map() Create_Surface_Mesh() Orthogonal_light=CreateLight (2,SurfaceMesh);(1,TG_camera\camera) LightColor Orthogonal_light,255,255,255 PositionEntity Orthogonal_light,-1000,100,-1000 PointEntity Orthogonal_light,SurfaceMesh While Not KeyHit(1) TG_Draw_UI() Flip False Wend End Function Init_Surface() ; Doctored sprite code from Skidracer ; 'texture' is a pointer to a texture object, in sizes of squared powers of 2. eg. 128x128 or 256x256 ; this is because GPU's work fastest with power of 2 textures ; optional x_size and y_size values crop the sprite to fit ; eg. for a 27x18 button, create a 32x32 source image, load as texture, and call TG_Load_Sprite(texture,27,18) ; No x_size or y_size values uses texture proportions ; change these for viewports viewwidth=GraphicsWidth() viewheight=GraphicsHeight() ; find existing pixiespace parented to camera magic=0 n=CountChildren(TG_camera\camera) For i=1 To n If EntityName(GetChild(TG_camera\camera,i))="pixiespace" magic=GetChild(GetChild(TG_camera\camera,i),1) EndIf Next If magic=0 magic=CreatePivot(TG_camera\camera) NameEntity(magic,"pixiespace") aspect#=Float(viewheight)/viewwidth PositionEntity magic,-1,aspect,1 scale#=2.0/viewwidth ScaleEntity magic,scale,-scale,-scale magic=CreatePivot(magic) PositionEntity magic,-.5,-.5,0 EndIf ;gfxstuff SurfaceMesh = CreateMesh (Magic) scale#=0.2/viewwidth SurfaceBrush = LoadBrush ("gfx\MapTextures\surface.png") SurfaceSurface = CreateSurface (SurfaceMesh) PaintSurface SurfaceSurface, SurfaceBrush ;arraystuff ;fill the mesh with nonsence sh#=0 shz=0 For z = 0 To TriHeightMin For x= 0 To TriWidthMin posz=TriHeight- (z+1) posx#=x+sh rsuLeft = AddVertex (SurfaceSurface, posx - 0.5,0, posz - 1 ,1,0 ) rsuMid = AddVertex (SurfaceSurface, posx ,0, posz ,0,0.5) rsuRight = AddVertex (SurfaceSurface, posx + 0.5,0, posz - 1 ,1,0 ) AddTriangle (SurfaceSurface, rsumid,rsuright,rsuleft) VertexMap(x,z,0)=rsumid VertexMap(x,z,1)=rsuright VertexMap(x,z,2)=rsuleft usdleft = AddVertex (SurfaceSurface, posx ,0, posz ,0,1 ) usdMid = AddVertex (SurfaceSurface, posx + 0.5,0, posz - 1 ,1,0.5) usdright = AddVertex (SurfaceSurface, posx + 1.0,0, posz ,0,1 ) AddTriangle (SurfaceSurface, usdleft,usdright,usdmid) VertexMap(x,z,3)=usdleft VertexMap(x,z,4)=usdRight VertexMap(x,z,5)=usdmid Next sh = 0.5 - sh:If sh=0 Then shz=shz+1 Next ScaleEntity SurfaceMesh, 100, 100, 100 PositionEntity SurfaceMesh, 00, 400, UI_distance-200 RotateEntity SurfaceMesh,150,0,0 End Function Function Create_Surface_Mesh() sh#=0 shz=0 For z = 0 To TriHeightMin For x= 0 To TriWidthMin MP=(MapPos+MapWidth*z+x+2*sh+shz) And BankAnd rsuSurf =PeekByte(rsusurfMap,(MP)) And 3 usdSurf =PeekByte(usdsurfMap,(MP)) And 3 posz=TriHeight- (z+1) posx#=x+sh VertexCoords SurfaceSurface,vertexmap(x,z,2), posx - 0.5,0.1* PeekByte(heightmap,MP+MapLD), posz - 1 VertexCoords SurfaceSurface,vertexmap(x,z,0), posx ,0.1* PeekByte(heightmap,MP) , posz VertexCoords SurfaceSurface,vertexmap(x,z,1), posx + 0.5,0.1* PeekByte(heightmap,MP+MapRD), posz - 1 VertexCoords SurfaceSurface,vertexmap(x,z,3), posx ,0.1* PeekByte(heightmap,MP) , posz VertexCoords SurfaceSurface,vertexmap(x,z,5), posx + 0.5,0.1* PeekByte(heightmap,MP+MapRD), posz - 1 VertexCoords SurfaceSurface,vertexmap(x,z,4), posx + 1.0,0.1* PeekByte(heightmap,MP+MapR) , posz VertexTexCoords SurfaceSurface,vertexmap(x,z,2), SurfaceDat(rsuSurf,leftuv) , SurfaceDat(rsuSurf,downuv) VertexTexCoords SurfaceSurface,vertexmap(x,z,0), SurfaceDat(rsuSurf,miduv) , SurfaceDat(rsuSurf,upuv) VertexTexCoords SurfaceSurface,vertexmap(x,z,1), SurfaceDat(rsuSurf,rightuv), SurfaceDat(rsuSurf,downuv) VertexTexCoords SurfaceSurface,vertexmap(x,z,3), SurfaceDat(usdSurf,leftuv) , SurfaceDat(usdSurf,upuv) VertexTexCoords SurfaceSurface,vertexmap(x,z,5), SurfaceDat(usdSurf,miduv) , SurfaceDat(usdSurf,downuv) VertexTexCoords SurfaceSurface,vertexmap(x,z,4), SurfaceDat(usdSurf,rightuv), SurfaceDat(usdSurf,upuv) Next sh = 0.5 - sh:If sh=0 Then shz=shz+1 Next UpdateNormals SurfaceMesh End Function Function Generate_Map() MapSize=5 MapWidth=2^MapSize;width (and Depth) of land MapAnd=MapWidth-1;mapwidth-1 BnkSize=(MapWidth*MapWidth);total bytes of positions in a map BankAnd=BnkSize-1;BnkSize-1 MapMinPos=MapWidth+1 MapMaxPos=BnkSize-(MapWidth+1) MapR=1 MapL=-1 MapLU=-MapWidth-1 MapRU=-MapWidth MapLD=MapWidth MapRD=MapWidth+1 MapPos=MapMinPos HeightMap=CreateBank(BnkSize) z=0 Repeat For x=0 To MapAnd PokeByte HeightMap,z+x,0;Rand(0,19) Next z=z+MapWidth Until z=BnkSize PokeByte HeightMap,12+16*MapWidth,18;Rand(0,19) PokeByte HeightMap,15+18*MapWidth,1;Rand(0,19) rsusurfMap=CreateBank(BnkSize) z=0 Repeat For x=0 To MapAnd PokeByte rsusurfMap,z+x,Rand(1,1) Next z=z+MapWidth Until z=BnkSize usdsurfMap=CreateBank(BnkSize) z=0 Repeat For x=0 To MapAnd PokeByte usdsurfMap,z+x,Rand(1,1) Next z=z+MapWidth Until z=BnkSize End Function
Any help or pointers I would greatly appreciate.
This is the brush I used:
