Alexi wrote:Much easier is to convert the Svg to 3D with a CAD program. Here you can directly optimize everything and split up all Elements. Curves are also done with it.
If you send me the SVG i could try it for you. But it's easier if you remove the hachures if they aren't paths.
Thanks very much for the offer, Alexi, but I want to do this with PB. I've realised this is the only way I can get the sort of control and flexibility that I need.
I see some overlapping "Bridges" same colored as the Buildings. If the color specifies the height it would look a little strange.
This is an example of why I want to use PB. All I need to do with the bridges is specify that each one is a bridge (an XML attribute, something like "type=bridge") and I can write into the PB procedure that a bridge should be created a certain way.
Seymour Clufley wrote:distance blur
Samuel wrote:Do you mean Anisotropic Filtering or something like a compositor blurring effect. Both are possible with the OGRE engine.
I'm just not exactly sure if that's what you want.
I mean
this sort of thing, where the objects become blurry the further away they are from the camera. Is that sort of thing possible?
You'll have to create your own routine for creating complex shapes. Creating the shapes themselves is easy with PureBasic.
It just takes a little practice to learn how to create your own normals and UV coordinates.
Thanks for the encouragement (and to IdeasVacuum, for the same). I've been making some first steps to learn how to do this.
I've been trying to create a simple cube mesh. (I know there's the CreateCube command, but I need to do this the hard way first as a practice for more complex polygons.) The trouble I'm having is that the sides disappear and reappear as the cube is rotated. I think this might be because the texture is applied to only one side of each face... if so, is there any way to avoid this happening? Here's the code I've got, adapted from an example, and it should demonstrate the problem:
Code: Select all
InitEngine3D()
InitSprite()
win = OpenWindow(#PB_Any,0,0,800,600,"Cube",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(win),0,0,800,600)
cam = CreateCamera(#PB_Any,0,0,100,100)
CameraRange(cam,0,2000)
CameraProjectionMode(cam,#PB_Camera_Perspective)
tex = CreateTexture(#PB_Any,1024,1024)
If StartDrawing(TextureOutput(tex))
DrawingMode(#PB_2DDrawing_Gradient)
BackColor(#Red)
FrontColor(#Yellow)
CircularGradient(512,512,256)
Box(0,0,1024,1024)
StopDrawing()
EndIf
mat = CreateMaterial(#PB_Any,TextureID(tex))
DisableMaterialLighting(mat,#True)
Structure VectorF
x.f
y.f
z.f
EndStructure
Procedure.b MakeMeshRectangularSide(msh,Array corner.VectorF(1))
MeshVertexPosition(corner(1)\x,corner(1)\y,corner(1)\z)
MeshVertexTextureCoordinate(0,0)
MeshVertexPosition(corner(2)\x,corner(2)\y,corner(2)\z)
MeshVertexTextureCoordinate(1,0)
MeshVertexPosition(corner(3)\x,corner(3)\y,corner(3)\z)
MeshVertexTextureCoordinate(1,1)
MeshVertexPosition(corner(4)\x,corner(4)\y,corner(4)\z)
MeshVertexTextureCoordinate(0,1)
vertices = MeshVertexCount(msh)
MeshFace(vertices-3,vertices-1,vertices-2)
MeshFace(vertices-3,vertices,vertices-1)
EndProcedure
Procedure.i CuboidalMesh(xd.f,yd.f,zd.f)
msh = CreateMesh(#PB_Any,#PB_Mesh_TriangleList,#PB_Mesh_Dynamic)
Dim corner.VectorF(4)
; front
corner(1)\x = 0
corner(1)\y = 0
corner(1)\z = 0
corner(2)\x = xd
corner(2)\y = 0
corner(2)\z = 0
corner(3)\x = xd
corner(3)\y = yd
corner(3)\z = 0
corner(4)\x = 0
corner(4)\y = yd
corner(4)\z = 0
MakeMeshRectangularSide(msh,corner())
; back
corner(1)\x = 0
corner(1)\y = 0
corner(1)\z = zd
corner(2)\x = xd
corner(2)\y = 0
corner(2)\z = zd
corner(3)\x = xd
corner(3)\y = yd
corner(3)\z = zd
corner(4)\x = 0
corner(4)\y = yd
corner(4)\z = zd
MakeMeshRectangularSide(msh,corner())
; top
corner(1)\x = 0
corner(1)\y = yd
corner(1)\z = 0
corner(2)\x = xd
corner(2)\y = yd
corner(2)\z = 0
corner(3)\x = xd
corner(3)\y = yd
corner(3)\z = zd
corner(4)\x = 0
corner(4)\y = yd
corner(4)\z = zd
MakeMeshRectangularSide(msh,corner())
; bottom
corner(1)\x = 0
corner(1)\y = 0
corner(1)\z = 0
corner(2)\x = xd
corner(2)\y = 0
corner(2)\z = 0
corner(3)\x = xd
corner(3)\y = 0
corner(3)\z = zd
corner(4)\x = 0
corner(4)\y = 0
corner(4)\z = zd
MakeMeshRectangularSide(msh,corner())
; left side
corner(1)\x = 0
corner(1)\y = 0
corner(1)\z = 0
corner(2)\x = 0
corner(2)\y = 0
corner(2)\z = zd
corner(3)\x = 0
corner(3)\y = yd
corner(3)\z = zd
corner(4)\x = 0
corner(4)\y = yd
corner(4)\z = 0
MakeMeshRectangularSide(msh,corner())
; right side
corner(1)\x = xd
corner(1)\y = 0
corner(1)\z = 0
corner(2)\x = xd
corner(2)\y = 0
corner(2)\z = zd
corner(3)\x = xd
corner(3)\y = yd
corner(3)\z = zd
corner(4)\x = xd
corner(4)\y = yd
corner(4)\z = 0
MakeMeshRectangularSide(msh,corner())
FinishMesh(#True)
ProcedureReturn msh
EndProcedure
msh = CuboidalMesh(100,100,100)
ent = CreateEntity(#PB_Any,MeshID(msh),MaterialID(mat),-50,-50,-500)
xdeg.f = 0.25
ydeg.f = 2.5
zdeg.f = 1
Repeat
If GetAsyncKeyState_(#VK_ESCAPE) : Break : EndIf
If we = #PB_Event_CloseWindow : Break : EndIf
RotateEntity(ent,xdeg,ydeg,zdeg,#PB_Relative)
RenderWorld()
FlipBuffers()
Delay(10)
ForEver
If I'm right about why this is happening, then the problem would probably be in the last two lines of the MakeMeshRectangularSide() procedure. Thanks in advance to anyone who can help.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."