IdeasVacuum, when i have asked about thicker points in the mandelbrot 3D post ,Comtois answered to use point_size inside a material script, so point_sprite will be the same. and asking our uncle google he provide the answer
just copy the material in that page and change the texture to your prefered picture:
i can't provide a concise code now , but use the mandel 3D program to see the points sprites, use any texture, i want to use a texture like a star with alpha channel most likely will be very good display such as a stary points rotating around sun.
save the code to Examples\3D. and save the material script above to Data\Scripts
Code: Select all
Enumeration
#MESH
#LIGHT
#CAMERA_ONE
#BUTTON
#mainwin
EndEnumeration
;constants for the biomorph function
#constreal = 0.5
#constimag = 0
#screenheight = 500
#screenwidth = 500
Global.f dx, dy, x, y, z
Global wd, ht, i, count, n, iter
Global.f w, leng, tx, ty, tz, tem
Global.f cr, ci, cj, ck, wk, inc, distance
Global mand, zval
Global.f angle
Define.f red, green, blue
;zval = 1 shows entire set
;zval = 0 cuts set in half
;zval = 0 is an interesting effect
wd = 500
ht = 500
;defines the shape of the Julia Set
cr = -0.200
ci = 0.800
cj = 0.000
ck = 0.000
wk = 0.000
;mand = 0 is Julia Set
;mand = 1 is Mandelbrot 3D
mand = 1
;zval = 1 shows entire set
;zval = 0 cuts set in half
;zval = 0 is an interesting effect
zval = 1
iter = 5
inc = 5
;#quat = 1
zval = 1
iter = 5
inc = 5
Procedure.f RandF(Min.f, Max.f, Resolution.i = 10000)
ProcedureReturn (Min + (Max - Min) * Random(Resolution) / Resolution)
EndProcedure
Quit.b = #False
rot.l=1 :stopFlag = 1
xs.f = 0.3:ys.f = 0.3:zs.f = 0.3
x.f: y.f :z.f: x0.f: y0.f=1 :z0.f
rotx.f:roty.f=1:rotz.f :rotx0.f: roty0.f: rotz0.f
up.f = 2.2: depth.f=0
ExamineDesktops()
If OpenWindow(#mainwin, 0, 0, DesktopWidth(0), DesktopHeight(0), "PgUp PgD scale mesh..Arrows for rotation, space: stop/rotate, QA Up/Down, WS far/near", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(#BUTTON, 0, DesktopHeight(0)-60, 60, 30, "rotate/stop")
;Initialize environment
InitEngine3D()
InitSprite()
OpenWindowedScreen(WindowID(#mainwin), 0, 0, DesktopWidth(0), DesktopHeight(0)-70, 0, 0, 0)
WorldShadows(#PB_Shadow_Additive)
InitKeyboard()
SetFrameRate(60)
Add3DArchive("Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive("Data/Scripts", #PB_3DArchive_FileSystem)
Parse3DScripts()
CreateLight(0,RGB(255,255,255),-100,40,30)
AmbientColor(RGB(100,100,100))
;CreateCamera(#CAMERA_ONE, 0, 0, 300, 400)
CreateCamera(#CAMERA_ONE, 0, 0, 400, 400)
MoveCamera(#CAMERA_ONE, 0, 2, 9)
CameraLookAt(#CAMERA_ONE, 0, 1, 0)
RotateCamera(#CAMERA_ONE, -15, 0, 0)
EndIf
SetActiveGadget(#BUTTON)
;SkyDome("clouds.jpg", 100) ;for blue color background
;- Mesh Stars
;PointsSize = GetScriptMaterial(#PB_Any, "def_Points_04")
CreateMesh(1, #PB_Mesh_PointList, #PB_Mesh_Dynamic )
;CreateMesh(1, #PB_Mesh_PointList, #False)
GetScriptMaterial(0, "PointsSprites")
SetMeshMaterial(1, MaterialID(0))
DisableMaterialLighting(0, #True)
Global Stars = CreateNode(#PB_Any)
AttachNodeObject(Stars, MeshID(1))
Procedure.f calcleng( x.f, y.f, z.f)
w.f: kr.f: ki.f: kj.f: kk.f
w = wk
n = 0
If mand = 1 ;full Mandelbrot set
kr = x
ki = y
kj = z
kk = 0
Else ;else draw Julia Set
kr = cr
ki = ci
kj = cj
kk = ck
EndIf
While n < iter
tem = x+x
x = x*x-y*y-z*z-w*w+kr
y = tem*y + ki
z = tem*z + kj
w = tem*w + kk
n+1
distance = x*x+y*y+z*z+w*w
If distance > 4
n = iter
EndIf
Wend
;Return distance
ProcedureReturn distance
EndProcedure
Procedure calcit()
zz.f
foo.l
iterations = 10000
count = 0
If zval = 0
zz = 2.0
Else
zz = 4.0
EndIf
For foo = 0 To iterations
;x.f = RandF(0, 1)
;y.f = RandF(0, 1)
x.f = RandF(-2, 2)
y.f = RandF(-2, 2)
z.f = zz*RandF(0, 1) -2.0
;calls the quaternion calculation
leng.f = calcleng(x,y,z)
If leng < 4
;MeshVertexPosition(x, y, z)
red = (x+Cos(15*leng))*255
green = (y+Sin(1-leng)*Cos(5*leng))*255
blue = (z+Sin(0.75*leng))*255
If red < 0 : red = 0 : EndIf
If green < 0 : green = 0 : EndIf
If blue < 0 : blue = 0 : EndIf
;If red > 255 : red = red-255 : EndIf
;If green > 255 : green = green-255 : EndIf
;If blue > 255 : blue = blue-255 : EndIf
;MeshVertexColor(RGBA(red,green,blue,0))
MeshVertexPosition(x, y, z)
;;;;MeshVertexColor(RGB(red,green,blue))
;Debug x*2
;Debug y*2
;Debug z*2
EndIf
Next
FinishMesh(#False)
NormalizeMesh(1)
EndProcedure
calcit() ; calling the mandel 3D or julia generator function
;MeshVertexPosition(-0.67, -0.17, 0.1)
;MeshVertexColor(RGB(255,255,0))
;MeshVertexPosition(0.0, 0.0, 0.0)
;MeshVertexColor(RGB(255,0,0))
;;MeshVertexColor(RGB(0,255,0))
;FinishMesh(#False)
;NormalizeMesh(1)
;Main loop
Repeat
Event = WindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case #BUTTON
If rot = 0
rot = 1
rotx= rotx0:roty=roty0:rotz=rotz0 ; restore rotation status
stopFlag = 1
Else
rot = 0
rotx0= rotx:roty0=roty:rotz0=rotz ;back up rotation status
rotx=0:roty=0:rotz=0
stopFlag = 0
EndIf
EndSelect
EndIf
If stopFlag=1
x + rotx
y + roty
z + rotz
EndIf
RotateNode(Stars, x, y, z)
RenderWorld()
FlipBuffers()
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Up) ; rotate left
rotx=1:roty=0:rotz=0
rotx0 = rotx: roty0 = roty :rotz0 = rotz
x + rotx
y + roty
z + rotz
stopFlag=0
rot = 0
ElseIf KeyboardPushed(#PB_Key_Down) ; rotate right
rotx=-1:roty=0:rotz=0
rotx0 = rotx: roty0 = roty :rotz0 = rotz
x + rotx
y + roty
z + rotz
stopFlag=0
rot = 0
ElseIf KeyboardPushed(#PB_Key_Right) ; rotate up
rotx=0:roty=1:rotz=0
rotx0 = rotx: roty0 = roty :rotz0 = rotz
x + rotx
y + roty
z + rotz
stopFlag=0
rot = 0
ElseIf KeyboardPushed(#PB_Key_Left) ; rotate down
rotx=0:roty=-1:rotz=0
rotx0 = rotx: roty0 = roty :rotz0 = rotz
x + rotx
y + roty
z + rotz
stopFlag=0
rot = 0
EndIf
If KeyboardPushed(#PB_Key_PageUp) ; scale up model
xs.f = 1.1:ys.f = 1.1:zs.f = 1.1
ScaleNode(Stars,xs,ys,zs)
ElseIf KeyboardPushed(#PB_Key_PageDown) ; scale down model
xs = 0.9:ys = 0.9:zs= 0.9
ScaleNode(Stars,xs,ys,zs)
EndIf
If KeyboardPushed(#PB_Key_Q) ; up move
up + 0.1
MoveNode(Stars,0,up,depth,#PB_Absolute)
ElseIf KeyboardPushed(#PB_Key_A) ; down move
up - 0.1
MoveNode(Stars,0,up,depth,#PB_Absolute)
ElseIf KeyboardPushed(#PB_Key_W) ; forward move
depth - 0.1
MoveNode(Stars,0,up,depth,#PB_Absolute)
ElseIf KeyboardPushed(#PB_Key_S) ; inward move
depth + 0.1
MoveNode(Stars,0,up,depth,#PB_Absolute)
EndIf
If KeyboardPushed(#PB_Key_Escape)
Quit = #True
EndIf
Until Quit = #True Or Event = #PB_Event_CloseWindow