Torque like clouds

Blitz3D Forums/Blitz3D Programming/Torque like clouds

Nmuta(Posted 2006) [#1]
I've been using Torque for over a year now. One thing I really like about the engine is the sky.

It's more than just a skybox with a few alpha cloud planes moving overhead. At least it appears to be.

I've seen so many awesome things done in Blitz that I'm sure this effect is possible in Blitz. Can anyone point me in the right direction?

Thanks in advance


Bouncer(Posted 2006) [#2]
Coul you post a screenshot, so we know what you're trying to accomplish?


Red Ocktober(Posted 2006) [#3]
hey Nmuta... visit this thread,

http://www.blitzbasic.com/Community/posts.php?topic=57575

then go to the download site and get the demo...

i think you'll verry much like the clouds in there... if you ask nicely, Rif might let you see his clouds code...

--Mike


RifRaf(Posted 2006) [#4]
Ah, actually those clouds couldnt be simpler.

To use this, you add the include, call initclouds. then
updateclouds(camera) , the cloud cover will follow the
entity you use when you call updateclouds.. if you do not
pass an entity to the function, then the clouds will not
follow , and you can pass through them.

Here are the cloud texures I use. However it could use some better ones.





save them as PNG.




;add clouds
Global cloudpivot=CreatePivot()
Global cloudpivot2=CreatePivot()
Dim cloudtexture(4)
cloudtexture(1)=LoadTexture("skins\cloud.png",2)
cloudtexture(2)=LoadTexture("skins\cloud2.png",2)
cloudtexture(3)=LoadTexture("skins\cloud3.png",2)
cloudtexture(4)=LoadTexture("skins\cloud4.png",2)
Global cloudcount=100
Global cloudHeight=100
Global CloudRadius=700
Global cloudfaderange#=850
Global CloudSmallest#=50,CloudLargest#=120

PositionEntity cloudpivot,0,Cloudheight,0
PositionEntity cloudpivot2,0,cloudheight,0

Type cloud
 Field ent
 End Type

Function initclouds()
For I=1 To cloudcount
 cloud.cloud=New cloud
 tp=Rand(1,2)
 If tp=1 Then 
 cloud\ent=CreateSprite(cloudpivot)
 cn=Rand(1,5)
 Else
 cloud\ent=CreateSprite(cloudpivot2)
 EndIf
 SpriteViewMode cloud\ent,1
 EntityTexture cloud\ent,cloudtexture(Rand(1,4))
 EntityBlend cloud\ent,0
 sc#=Rnd(cloudsmallest,cloudlargest)

 ScaleSprite cloud\ent,sc,sc 
 cr=Rand(190,250)
 EntityColor cloud\ent,cr,cr,cr
 PositionEntity cloud\ent,Rand(-cloudradius*.5,cloudradius*.5),Rand(cloudheight-10,cloudheight+40),Rand(-cloudradius*.5,cloudradius*.5)
 EntityAutoFade cloud\ENT,0,cloudfaderange#
 Next
End Function

Function updateclouds(ent=0)
 If ent<>0 Then 
   PositionEntity cloudpivot,EntityX(ent,1),cloudheight,EntityZ(ent,1)
   PositionEntity cloudpivot2,EntityX(ent,1),cloudheight,EntityZ(ent,1)
  EndIf

 TurnEntity cloudPIVOT,0,.012,0
 TurnEntity cloudPIVOT2,0,-.01,0
End Function

Function setstormy()
AmbientLight 150,150,225
For cloud.cloud=Each cloud
 sc#=Rnd(10,70)
 cr=Rand(100,200)
 cg=Rand(100,200)
 cb=Rand(200,255)
 EntityColor cloud\ent,cr,cg,cb
 Next
End Function

Function SetClear()
AmbientLight 255,255,255
For cloud.cloud=Each cloud
 sc#=Rnd(50,130)
 cr=Rand(200,250)
 EntityColor cloud\ent,cr,cr,cr
 Next
End Function

Function freeclouds()
 For cl.cloud=Each cloud
   FreeEntity cl\ent
   Delete cl
   Next
End Function




Nmuta(Posted 2006) [#5]
Wow...thanks guys....I'm looking into this now.

As far as the screenshot, I posted a short movie clip:

http://www.thenilepa.com/torqueSky.wmv


Nmuta(Posted 2006) [#6]
WOW... just saw the screenshots for MAPCRAFTER. Unbelievable. That's exactly what I was looking for. There's supposed to be a downloadable demo on the site but I can't find it.

I had actually stumbled across the empowergames website earlier in my search for cloud effects, but I didn't see any screenshots or anything that came close to what I saw RifRaf post on the
www.blitzbasic.com/Community/posts.php?topic=57575
thread.

I think the empowergames website should do a better job showing off the power of the tool....it's the best thing I think I've ever seen for Blitz as far as environments go. Can I get a link to the demo fly through? The
http://www.empowergames.com/mc_demo_map.zip
link is broken.


boomboom(Posted 2006) [#7]
Yes, I would like to see the clouds in action as well if anyone has the demo posted there? or Rif could rehost it for a couple of days?


RifRaf(Posted 2006) [#8]
ill rehost. had some issues and removed alot of things from the site. Ill put it back up in a few days. As far as the site goes, it needs major improvements, unfortunatly in not big into html and all that jazz. I guess ill have to get into it sooner or later.


Nmuta(Posted 2006) [#9]
Ok, so is the site functional then? If I were to purchase mapcrafter, how long does it take for the product to be delivered?


RifRaf(Posted 2006) [#10]
Oh yeah, site functions well. I have the purchase links
there, as well as a support forum where you can get updates
at your convinience. same as here.

few hours if you buy it while im at keys wich i usually
am.. longest time ive had to deliver was two days, because
i was out for the weekend


Nmuta(Posted 2006) [#11]
OK, well I just bought it. I'm stepping out on faith here based on the screenshots, which are absolutely gorgeous.


Nmuta(Posted 2006) [#12]
One more question:

Do I have to pass a parameter to the updateclouds() function? I called initclouds() and then I call updateclouds() in my main loop , but when I look up , one nice puffy cloud is just sitting up there, not moving.

Do I have to do it within a for/each construct for the types? I tried

For cl.cloud= Each cloud

updateclouds(cl\ent)

Next

But then nothing is visible at all. So clearly I'm doing something wrong.


RifRaf(Posted 2006) [#13]
you have msn or aim ? i dont want to spam this thread with the cloud system ?
Both aim and msn for me = GameMaker04


Nmuta(Posted 2006) [#14]
I tried adding GameMaker04@... and GameMaker04@... but it said neither is associated with a the passport system.