Well the only reason I am thinking per poly is on the basis of how Lord Einstein is using the diffuse vertex method. This sphere is merely the weather sphere. It needs to be able to pull data from another land sphere and compute how clouds are to be drawn on the weather sphere. Because L.E. uses the diffuse method I was thinking that by being able to call and read the color of a vertex of index, we could specify the amount of reflection for each color... This could be done with the right "pairing equation." Because the data may be to great in value to be read in DBPro, we can use LUA to externally call variables and then delete them when they are not needed. This also makes saving games easier and loading the weather data that was last saved from each planet you visit... this is still in the works and I am digressing... so back on subject.
Well your image of mars- that's really what I'm going for. The effects need to somehow all be routed/connected together... when you alter one variable such as the water level by adding water... you up the amount of water in the air and atmosphere (via the water cycle.) But doing this is confusing to me and I need a little direction. Right now I have a dim (array) that looks like this for example. (Note the below is not the actual code)
Example:
Dim Wesim#(<<For Loop Max from Vertex Data Vertex Count>>, 5)
Lock Vertexdata for limb 1,0
Vcount=Get vertexdata vertex count()
unlock vertexdata
Do
Orbiting variable for planet to sun movement w/ moon included...
Distance variable from planet/sun/moon...
Sunsdistance= Sunsdistance+additional angle variable for elliptical orbit.
Sunsoutput=Sunsdistance*((1366*96)/The square root of Sunsdistance)
`vector3 and 4 commands before
For a = 0 to vertex count
`set vectors
`Weather code- need help here
Reflected Radiation = Sunouput/24 (24 is the average earth reflects)
Water % = ? need help making a water particle strip of code.
Temperature = Pressure * air mass (particles per square foot or inch depending on particle size) * something/ gas constant
Pressure= air mass/ temp* something * gas constant
` there's more but I cannot recall of my mind- see the code after this
Wesim#(A,0)=Reflected Radiation
Wesim#(A,1)= Water %
Wesim#(A,2)= Temperature
Wesim#(A,3)= Pressure
Wesim#(A,4)= Density of planet or @ vertex (another equation can dictate this)
Wesim#(A,5)= Gas Constant
` Now we need to uses the values we've entered in the array and update them.
That was just a confusing example. Run this code if you want to see for yourself. I need to be able to update the temp at each vertex. Because we can dictate when each vertex is recieving or not receiving light, we can tell the app/game when to let the temp start to cool or rise on this basis. This means pressure needs to also rise and fall on the basis of temp. Clouds need to form on the basis of water/precipitation in the air. Last but least, high pressure, lower water %, vice versa... have a go at altering the code before. The clouds do not display. I haven't altered the code correctly but can do so myself. (Thanks Math89! otherwise I would be so lost!)
Set display mode desktop width(), desktop height(),32
Autocam off
Sync on : Sync Rate 60
Color Backdrop RGB(5,2,10)
`planet
Make object sphere 1,120,30,30
//Set object normals 1
set object cull 1,0
convert object fvf 1,338
Set Object Light 1,0
`sun
make object sphere 2,500,30,30
Set effect on 2,"mediaGlow.fx",0
Position Object 2, 0,0,0
Set object ambient 2,0
Set object light 2,0
Make Light 1
Hide light 0
color light 1,255,255,255
Set light Range 1,150000
Set ambient light 1
Set camera range 1,200000
Hide light 1
m = Make Matrix4(1)
v = Make Vector4(2)
v = Make Vector4(3)
v = Make Vector3(4)
v = Make Vector3(5)
HWCom = Make Vector2(6)
TempPress = Make Vector2(7)
Dist#=200
CangA#=0
CangB#=0
CangC#=0
Pang#=0
Lock vertexdata for limb 1,0
Dcount=Get vertexdata vertex count()
Unlock Vertexdata
Set text opaque
Ghost object on 1,0
Make object sphere 3,110,30,30
Dim Wesim#(Dcount,5)
#Constant GasV 0.0006798
Temp#=32.0
Do
`planet distance and rotation updated before calculations
sdist#=(4500+(px#/3))
Object Matrix4 1, 1
`We now have to update the calculation of light and shadow, so the vectorIII "set commands" will be called each time.
Lock VertexData For Limb 1,0
Vcount = Get VertexData Vertex Count()
Piss#=PI()
For Rays=0 to Vcount
Sheat#=(1366*96/Sqrt(Sdist#))
`position
VX#=Get vertexdata position X(rays)
VY#=Get Vertexdata position Y(rays)
VZ#=Get vertexdata position Z(rays)
`normals
NX#=Get Vertexdata Normals X(Rays)
NY#=Get Vertexdata Normals Y(Rays)
NZ#=Get Vertexdata Normals Z(Rays)
// Find the World Space normal
Set Vector4 2,NX#,NY#,NZ#,0
Transform Vector4 2,2,1
// Find the World Space position
Set Vector4 3,vx#,vy#,vz#,1
Transform Vector4 3,3,1
// Turn the normal back to a vector3
Set Vector3 4, X Vector4(2), Y Vector4(2), Z Vector4(2)
// Calculate the vector sun-vertex in a vector3
Set Vector3 5, Object position X(2)-X Vector4(3), Object position Y(2)-Y Vector4(3), Object position Z(2)-Z Vector4(3)
// Normalize the vectors
NORMALIZE VECTOR3 4,4
NORMALIZE VECTOR3 5,5
// And dot product them
Heat#=Dot Product Vector3 (4,5)
Set vector2 6, RefP#,Sheat#
Set vector2 7,AirP,Sdist#
NORMALIZE VECTOR2 6,6
NORMALIZE VECTOR2 7,7
Water#=Dot Product Vector2 (6,7)
`This is the strip of code that needs to be first generated before hand and then inserted into the array at each vertex. There are about 941 vertexes in the planet sphere. that is the max number of temperatures w/ differentiation. HELP ME HERE!
RefP#=Sheat#/22.5
AirP=(RefP#*6^2)
AddTemp#=RefP#*0.0001
Pressure#=RefP#*GasV
If Heat#>0
Temp#=Temp#-Random(Addtemp#)
Wesim#(Rays,1)=Temp#
else
Temp#=Temp#+Random(addtemp#)
Wesim#(Rays,1)=Temp#
endif
`Reflecting Amount recieved by Planet
Wesim#(Rays,0)=RefP#
Wesim#(Rays,2)=AirP
Wesim#(Rays,3)=Water#*Pressure#
`Temperature gain and loss based on day and night
If Water#>0.7 and Water#<0.85
Heated=RGB(128,128*Water#,128*water#,128*water#)
else
Heated=Rgb(0,0,0,0)
endif
`Color of clouds
Set Cursor 10,10
Print "Average Solar Temp: ",Sheat#
Set Cursor 10,25
Print "Amount of sunlight getting through atmosphere: ",Wesim#(Rays,0)
Set Cursor 10,40
Print "Water % at Vertex: ",Wesim#(Rays,3)
Set Cursor 10,55
Print "Air Particles in atmospheres: ",WeSim#(Rays,2)
Set Cursor 10,70
Print "Temperature at Vertex: ",INT(Wesim#(Rays,1))," F°"
Set Cursor 10,85
Print "Pressure at Vertex: ",Pressure#, " PSi"
SET VERTEXDATA DIFFUSE Rays,Heated
Next Rays
UnLock VertexData
`Orbital Tilt
Tilt#=Pang#*24
Orb#=(0+(SIN(Tilt#)))
Axis#=(Orb#/2)/(SIN(TILT#)*360)
pitch object up 1,Axis#
Roll Object right 1,Axis#
Turn Object LEft 2,0.2
//turn object left 1,0.188
cx#=Newxvalue(object position x(1),CAngA#,dist#)
cy#=Newyvalue(object position Y(1),CAngB#,dist#)
cz#= Newzvalue (Object Position z(1),CangC#,Dist#)
PX#=Newxvalue(object position x(2), Pang#,sDIST#)
PZ#=NewZvalue (Object position Z(2), Pang#, sDIST#)
SET LIGHT TO OBJECT ORIENTATION 1,2
position light 1,object position x(2),Object position Y(2),object position z(2)
Point Light 1,Object position X(1),Object position Y(1)+60, Object position Z(1)
Position camera cX#,cy#,cZ#
Position Object 1,px#,0,Pz#
Position Object 3, PX#, 0, PZ#
Point Camera object position X(1), Object Position Y(1), Object position Z(1)
If mouseclick()=2
Newang#=MousemoveX()
If oldang# <> NEWANG#
If Oldang# < Newang# then Mousexx#=5
If oldang# > Newang# then Mousexx#=-5
Oldang#=MousemoveX()
CangA#=Mousexx#+CangA#
CAngc#=MouseXX#+CAngc#
else
MouseXX#=0
endif
endif
If mouseclick()=1
Newangy#=Mousemovey()
If oldangy# <> NEWANGy#
If Oldangy# < Newangy# then Mouseyy#=5
If oldangy# > Newangy# then Mouseyy#=-5
Oldangy#=Mousemovey()
CAngb#=MouseYY#+CAngB#
Cangc#=mouseYY#+CANGc#
ELSE
MOUSEYY#=0
Endif
endif
Newmousez = MousemoveZ()
If oldmousez <> newmousez
If oldmousez < newmousez then mousezz=-25
If oldmousez > newmousez then mousezz=25
Oldmousez =Mousemovez()
Dist#=Dist#+MouseZz
else
Mousezz=0
endif
CAngA#=Wrapvalue(CAngA#+0.0)
CAngb#=Wrapvalue(CAngb#+0.0)
CAngC#=Wrapvalue(CAngC#+0.0)
Pang#=Wrapvalue( Pang# +0.108897)
Sync
Loop
Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.