Just mucking around with some rendering in blitz3d

Started by Matty, July 14, 2024, 17:22:09

Previous topic - Next topic

Matty

Hello again,

I've been toying with some rendering. There's nothing fancy going on in this scene, I just wanted to play around a bit.....

The models are sourced from:
3drt
dexsoft (2000s era)
arteria (2000s era)

So yeah - some of them might not exist anymore.....

For best effect put the video on loop.....


Matty

And one more.....

This is not for a game, just for mucking around with rendering out some animations in blitz3d....

Put the video on loop and just sit back and watch them do their thing.


Matty


Matty

I'll keep adding to this and refining it as time goes on...

A few enhancements and some additions...


Matty


Derron

Dunno what you "muck around with" but maybe try to improve the visual experience:

- units have some kind of blurry/low-res texture which reminds on old cutscenes of warcraft III - which is way old now
- trees and grass patches still have so unnatural movement that it breaks any immersion - SUBTLE (yes, CAPsed for the ironic moment) movement only if you cannot do better (technically) than rotating a billboard around a pivot
- manipulate animations: it looks too hilarious to see "fast running" animations and then they crawl over the ground like a group of oldies during a walk
- add lighting/shadows (if possible) as this also will get rid of that too "early 2000s" game-cutscene-look

I suggested multiple times to try out other engines with more technical advanced engines and more inbuilt features. I bet (if it works) it would pay out - of course initial costs exist (moving on from your b3d-skin-animation-model-mesh-texture-mishmash to some more current stuff). Experiment with mixamo and other stuff and you will get a lot of animations "for free" which can add a lot variation and all this stuff.



I am sorry that this is for now the only reply to your thread but yeah ... as all videos for now looked the same (almost) I thought I better chime in here than to wait for the next 10 "of the same" videos :-)
You are a developer ... so develop, not just stay on your level with your old toolset.


bye
Ron

Matty

Some more mucking around with some renders, just for fun....amusing myself:


Matty

Put on loop. 2 minute loop.

For some reason it reminds me of some video footage from my Dad's time in the military 50-60 years ago....although no one would have looked like or been armed and equipped like that:


Matty

If you want to run the film creation program to generate the above movie (with some fixes now, not in the movie rendered above) then you can do it like this:

1. Download my game "3d fantasy battle thingy" (https://matty77.itch.io)
2. Download this source code file (shown in codebox) and the pngs/jpgs and put them into a subfolder inside the game folder (any will do)
3. Make copies of the \felgard folder as \tmp_felgard and save the b3d meshes and number them 1 to 6 eg 1.b3d, 2.b3d etc... (6.b3d isn't used - it is the troll mesh, it won't exist in \felgard so you'll have to copy one into there)
4. Run the source code and it will create the film.

Source Code:
;;;;;;;;;;;;
;Film Maker Program - Forest Walk
;Matt Lloyd 2024
;
;This file contains documentation
;
Global frame
orcson = 1
treeon = 1
grasson = 1
bushon = 1
minigrasson = 1
cloudon = 1
debugging = 0
camerashot = 1
fogon = 1
houseon = 1
record = 1
Global skyr# = 1.0
Global skyb# = 1.0
;;;;;;
;;Read Inputs From User (0/1)
;;To Switch Certain Elements Off/On
startframe = Input("Start From Frame:")
orcs$ = Input("Orcs On:")
trees$ = Input("Trees:")
grasses$ = Input("Grasses:")
minigrasses$ = Input("Mini Grasses:")
clouds$ = Input("Clouds:")
fog$ = Input("Fog:")
house$ = Input("Houses:")
bush$ = Input("Bushes:")
houseon = Abs(Sgn(Int(house)))
;skyrstr$ = Input("SkyR:")
;skyr = Abs(Float(skyrstr))
;If skyr>1 Then skyr = 1
;If skyr<0 Then skyr = 0
skyr# = 0.75
recording$ = Input("Record:")
debugmode$ = Input("Debug:")
orcson = Abs(Sgn(Int(orcs)))
treeon = Abs(Sgn(Int(trees)))
grasson = Abs(Sgn(Int(grasses)))
bushon = Abs(Sgn(Int(bush)))
minigrasson = Abs(Sgn(Int(minigrasses)))
cloudon = Abs(Sgn(Int(clouds)))
fogon = Abs(Sgn(Int(fog)))
record = Abs(Sgn(Int(recording)))
debugging = Abs(Sgn(Int(debugmode)))
;;;;;
;Initialisation and Loading
;
Graphics3D 1920,1080
camera=CreateCamera()
CameraRange camera,0.5,1500
CameraClsColor camera,110.0*skyr,150.0*skyr,170.0*skyb
CameraFogMode camera,1
CameraFogColor camera,110.0*skyr,160.0*skyr,170.0*skyb
CameraFogRange camera,25,90
CameraZoom camera,1.5
;;;;;
;Lighting
;
AmbientLight 0,0,0
lp = CreatePivot()
light1 = CreateLight(1)
LightColor light1,240,200,150
EntityParent light1,lp
AlignToVector light1,1,-1,1,3,1
light2 = CreateLight(1)
LightColor light2,240,200,150
AlignToVector light2,-1,-1,1,3,1
EntityParent light2,lp
light3 = CreateLight(1)
LightColor light3,240,200,150
AlignToVector light3,1,-1,-1,3,1
EntityParent light3,lp
light4 = CreateLight(1)
LightColor light4,240,200,150
AlignToVector light4,-1,-1,-1,3,1
EntityParent light4,lp
;;;;;
;Beastman mesh loading
;
Dim wmesh(6)
Dim wmeshc(6)
Dim wmeshs(6)
For m = 1 To 6
wmesh(m) = LoadAnimMesh("..\tmp_felgard\"+m+".b3d")
ScaleEntity wmesh(m),1,1,1
If m = 6 Then ScaleEntity wmesh(m),6.5,6.5,6.5
wmeshc(m) = CreateSphere()
ScaleMesh wmeshc(m),6,4,6
EntityColor wmeshc(m),10,10,10
EntityAlpha wmeshc(m),0.25
EntityParent wmeshc(m),wmesh(m)
TurnEntity wmesh(m),0,180,0
Next
For m = 1 To 6
wmeshs(m) = CopyEntity(wmesh(m))
ScaleEntity wmeshs(m),1,0.001,1
EntityColor wmeshs(m),4,4,4
EntityAlpha wmeshs(m),0.2
Next
;;;;;
;Ground and vegetation loading
;
planetex = LoadTexture("maptex.jpg",1)
ClearTextureFilters
Dim tmesh(5)
dir = ReadDir("..\environment\extras\")
Repeat
dirfile$ = NextFile(dir)
If dirfile="" Then Exit
If Right(dirfile,3) = "tga" Or Right(dirfile,3) = "png" Then
TextureFilter dirfile,1+2+4
EndIf
Forever
CloseDir dir
For i = 1 To 4
tmesh(i) = LoadMesh("..\environment\extras\tree0"+i+".b3d")
Next
Dim bmesh(12)
For i = 1 To 12
bmesh(i) = LoadMesh("..\environment\extras\bush0"+i+".b3d")
Next
Global map
Global maph# = 140.0*4
map = LoadTerrain("map.png") ;512x512
ScaleEntity map,10,maph,10 ;5120x10x5120
TranslateEntity map,-2560,0,-2560
TerrainDetail map,25000
TerrainShading map,True
EntityTexture map,planetex
ScaleTexture planetex,16,16
HideEntity map
grass = LoadMesh("..\environment\rivergrass.b3d")
grass_s = CopyEntity(grass)
ScaleEntity grass_s,1,0.001,1
;grass_s = CreateCube(grass)
;ScaleEntity grass_s,2,0.001,2
EntityColor grass_s,4,4,4
EntityAlpha grass_s,0.4
EntityParent grass_s,grass
HideEntity grass
grass2 = LoadMesh("..\environment\grasstall.b3d")
grass_s2 = CopyEntity(grass2)
ScaleEntity grass_s2,1,0.001,1
;grass_s2 = CreateCube(grass2)
;ScaleEntity grass_s2,2,0.001,2
EntityColor grass_s2,4,4,4
EntityAlpha grass_s2,0.4
EntityParent grass_s2,grass2
HideEntity grass2
bgrasstex = LoadTexture("..\environment\boxgrass.png",1+2)
bgrass = CreateCube()
EntityTexture bgrass,bgrasstex
ScaleMesh bgrass,3,3,3
PositionMesh bgrass,0,1.8,0
HideEntity bgrass
TextureFilter "elmleaves_DF.tga",1+2
grass3 = LoadMesh("..\environment\elm.b3d")
grass_s3 = CopyEntity(grass3)
ScaleEntity grass_s3,1,0.001,1
EntityColor grass_s3,4,4,4
EntityAlpha grass_s3,0.4
EntityParent grass_s3,grass3
HideEntity grass3
;;;;;
;Set the entities to hidden initially
;
tmesh(5) = grass3
For i = 1 To 5
HideEntity tmesh(i)
Next
For i = 1 To 12
HideEntity bmesh(i)
Next
For m = 1 To 6
HideEntity wmesh(m)
HideEntity wmeshs(m)
HideEntity wmeshc(m)
Next
hmesh = LoadMesh("..\environment\barracks.b3d")
HideEntity hmesh
frame = 0
SetBuffer BackBuffer()

cloudtex = LoadTexture("cloud.png",1+2)
skyr = 0.76
;;;;;
;Main Loop
;
Repeat
;;;;;
;Camera Sky Settings
;
skyr = 0.75 + 0.2 * Sin(Float(frame)*0.05)
skyb = skyr * 1.22
If skyb > 1.0 Then skyb = 1.0
CameraClsColor camera,110.0*skyr,150.0*skyr,170.0*skyb
CameraFogColor camera,Int(110.0*skyr),Int(160.0*skyr),Int(170.0*skyb)
;;;;;
;Camera Positioning
;
frame = frame + 1
If debugging <>0 Then frame = frame + 9
If frame >= 1440*4 Then
frame = 0
If record <> 0 Then End
PositionEntity camera,0,0,0
; ; camerashot = camerashot + 1
; frame = -10
frame1# = 0
; If camerashot = 2 Then End
EndIf
CameraZoom camera,1.5
Select camerashot
Case 1
xt# = 0
zt# = 0
PositionEntity map,-2560,0,-2560
ddb# = 1.0
If debugging<>0 Then ddb = 10.0
MoveEntity camera,0,0,0.125*ddb
TurnEntity camera,0,0.5*0.125*ddb,0
xt = EntityX(camera)
zt = EntityZ(camera)
yt# = ym(xt,zt) + 5.55
PositionEntity camera,xt,yt,zt
End Select
;;;;;
;Render All Entities
;
If frame Mod 2 = 0 And frame >= startframe Then
CameraClsMode camera,True,True
mapi = 0
For mapx# = 0 To 0; -5120*1 To 5120*1 Step 5120
For mapz# = 0 To 0; -5120*1 To 5120*1 Step 5120
mapi = mapi + 1
PositionEntity map,mapx-2560,0,mapz-2560
ShowEntity map
renderworld2
HideEntity map
CameraClsMode camera,False,False
CameraFogRange camera,25,80.0+20.0*Sin(Float(frame)*2.0*0.125)
;grasses
;;;;;
;Break Game Into Small Zones To Render More Efficiently
;
For zonex = mapx - 128 * 10 To mapx + 128 * 10 Step 128
For zonez = mapz - 128 * 10 To mapz + 128 * 10 Step 128

zonedist# = ((EntityX(camera)-zonex)*(EntityX(camera)-zonex)+(EntityZ(camera)-zonez)*(EntityZ(camera)-zonez))
If zonedist > 128.0*128.0*1.65*1.65 Then Goto skipzone
camzonex = zonex
camzonez = zonez
;;;;;
;Do Clouds In Sky
;
If cloudon = 1 Then
CameraFogMode camera,False

SeedRnd mapi + 13 + zonex + zonez
If cloud = 0 Then
cloud = CreateCube()
ScaleEntity cloud,8,5,8
EntityTexture cloud,cloudtex
EntityFX cloud,1
EndIf
ShowEntity cloud
For ti = 1 To 10
x = Rand(-1024,1024)+zonex
z = Rand(-1024,1024)+zonez
xxi = 0
zzi = 0
For ii = 1 To 35
xx = x + Rand(-80,80)
zz = z + Rand(-80,80)
xt# = Float(xx)
zt# = Float(zz)
yt# = 350.0+Rnd(20,90)+100.0

RotateEntity cloud,Rnd(360),Rnd(360),Rnd(360)
sc# = Rnd(1,5)*0.85
ScaleEntity cloud,Rnd(7,22)*sc,Rnd(4,9)*sc,Rnd(7,22)*sc
PositionEntity cloud,xt,yt,zt
EntityAlpha cloud,Rnd(0.4,0.9)*Rnd(0.1,0.6)*Rnd(0.1,0.6)*0.25
CameraProject camera,xt,yt,zt
If ProjectedZ()>-100 And ProjectedY()>-100 And ProjectedY()<1180 And ProjectedX()>-100 And ProjectedX()<2020 Then
renderworld2
EndIf
Next

Next
HideEntity cloud
EndIf
CameraFogMode camera,True
;;;;;
;Do Houses On Landscape
;
If houseon = 1 Then
ShowEntity hmesh
If hshadow = 0 Then
hshadow = CopyEntity(hmesh)
ScaleEntity hshadow,0.055,0.001,0.055
EntityColor hshadow,0,0,0
EntityAlpha hshadow,0.4
EndIf
ShowEntity hshadow
SeedRnd mapi + 44 + zonex + zonez
h1x = Rand(-50,-20)
h1z = Rand(-50,-20)
h2x = Rand(20,50)
h2z = Rand(20,50)
h3x = Rand(-110,0)
h3z = Rand(0,110)
h4x = Rand(0,110)
h4z = Rand(-110,0)
sc# = 1.0
xt# = h1x + zonex
zt# = h1z + zonez
yt# = ym(xt,zt)
PositionEntity hmesh,xt,yt,zt
RotateEntity hmesh,0,Rand(0,3)*90,0
sc# = 0.05
ScaleEntity hmesh,sc,sc,sc
PositionEntity hshadow,xt,yt,zt
RotateEntity hshadow,0,EntityYaw(hmesh),0
CameraProject camera,xt,yt,zt
If ProjectedZ()>-100 And ProjectedY()>-100 And ProjectedY()<1180 And ProjectedX()>-100 And ProjectedX()<2020 Then
renderworld2
EndIf
xt# = h2x + zonex
zt# = h2z + zonez
yt# = ym(xt,zt)
PositionEntity hmesh,xt,yt,zt
RotateEntity hmesh,0,Rand(0,3)*90,0
ScaleEntity hmesh,sc,sc,sc
PositionEntity hshadow,xt,yt,zt
RotateEntity hshadow,0,EntityYaw(hmesh),0
CameraProject camera,xt,yt,zt
If ProjectedZ()>-100 And ProjectedY()>-100 And ProjectedY()<1180 And ProjectedX()>-100 And ProjectedX()<2020 Then
renderworld2
EndIf
xt# = h3x + zonex
zt# = h3z + zonez
yt# = ym(xt,zt)
PositionEntity hmesh,xt,yt,zt
RotateEntity hmesh,0,Rand(0,3)*90,0
ScaleEntity hmesh,sc,sc,sc
PositionEntity hshadow,xt,yt,zt
RotateEntity hshadow,0,EntityYaw(hmesh),0
CameraProject camera,xt,yt,zt
If ProjectedZ()>-100 And ProjectedY()>-100 And ProjectedY()<1180 And ProjectedX()>-100 And ProjectedX()<2020 Then
; renderworld2
EndIf
xt# = h4x + zonex
zt# = h4z + zonez
yt# = ym(xt,zt)
PositionEntity hmesh,xt,yt,zt
RotateEntity hmesh,0,Rand(0,3)*90,0
ScaleEntity hmesh,sc,sc,sc
PositionEntity hshadow,xt,yt,zt
RotateEntity hshadow,0,EntityYaw(hmesh),0
CameraProject camera,xt,yt,zt
If ProjectedZ()>-100 And ProjectedY()>-100 And ProjectedY()<1180 And ProjectedX()>-100 And ProjectedX()<2020 Then
; renderworld2
EndIf
HideEntity hmesh
HideEntity hshadow
EndIf
;;;;;
;Render Small Bushes
;
If bushon = 1 Then
If bshadow = 0 Then
bshadow = CreateSphere()
EntityColor bshadow,0,0,0
EntityAlpha bshadow,0.4
ScaleEntity bshadow,3,1.0,3
EndIf
ShowEntity bshadow
LightColor light1,lred(),lgrn(),lblu()
LightColor light2,lred(),lgrn(),lblu()
LightColor light3,lred(),lgrn(),lblu()
LightColor light4,lred(),lgrn(),lblu()
SeedRnd  mapi + 2 + zonex + zonez + 12345
For ti = 1 To 2
x = Rand(-80,80)
z = Rand(-80,80)
xxi = 0
zzi = 0
For xx = x - 100 To x + 100 Step 25
xxi = xxi + 1
If Abs(xxi) Mod 10 = 0 Then
lr = lred() - Rand(20)
lg = lgrn() - Rand(20)
lb = lblu() - Rand(50)
LightColor light1,lr,lg,lb
LightColor light2,lr,lg,lb
LightColor light3,lr,lg,lb
LightColor light4,lr,lg,lb
EndIf
zzi = 0
For zz = z - 100 To z + 100 Step 25
zzi = zzi + 1
If Abs(zzi) Mod 10 = 0 Then
lr = lred() - Rand(20)
lg = lgrn() - Rand(20)
lb = lblu() - Rand(50)
LightColor light1,lr,lg,lb
LightColor light2,lr,lg,lb
LightColor light3,lr,lg,lb
LightColor light4,lr,lg,lb
EndIf
nohouse = 1
If houseon<>0 Then
If zonex+xx>h1x+zonex - 25 And zonex+xx<h1x+zonex + 25 And zonex+zz>h1z+zonez - 25 And zonez+zz<h1z+zonez + 25 Then nohouse = 0
If zonex+xx>h2x+zonex - 25 And zonex+xx<h2x+zonex + 25 And zonex+zz>h2z+zonez - 25 And zonez+zz<h2z+zonez + 25 Then nohouse = 0
If zonex+xx>h3x+zonex - 25 And zonex+xx<h3x+zonex + 25 And zonex+zz>h3z+zonez - 25 And zonez+zz<h3z+zonez + 25 Then nohouse = 0
If zonex+xx>h4x+zonex - 25 And zonex+xx<h4x+zonex + 25 And zonex+zz>h4z+zonez - 25 And zonez+zz<h4z+zonez + 25 Then nohouse = 0
EndIf
If debugging = 0 Or Rand(0,100)<37 Then
If Rand(0,100)<18 And (xx-x)*(xx-x)+(zz-z)*(zz-z)<200*200 And nohouse = 1 Then
bk2 = Rand(1,3)+Rand(0,3)
For bk = 1 To bk2
t = Rand(1,9)
If t = 3 Or t = 4 Or t = 8 Or t = 7 Then t = t + 1
If t = 3 Or t = 4 Or t = 8 Or t = 7 Then t = t + 1
ShowEntity bmesh(t)
xt# = Float(zonex+xx)+Rnd(-12,12)
zt# = Float(zonez+zz)+Rnd(-12,12)
yt# = ym(xt,zt)
yaw# = Rnd(360)
pitch# = 0
;If Rand(0,100)<15 Then pitch# = 3.5*Sin(Float(frame)*2.5*0.125)
PositionEntity bmesh(t),xt,yt,zt
PositionEntity bshadow,xt,yt,zt
RotateEntity bmesh(t),pitch,yaw,0
sc# = Rnd(1.35,2.25)
;If t = 1 Then sc = Rnd(2.5,4.5)
;If ti = 3 Then sc = sc * 0.6
;If ti = 2 Then sc = sc * 0.4
ScaleEntity bmesh(t),Rnd(0.85,1.5)*sc,Rnd(0.75,1.0)*sc,Rnd(0.85,1.5)*sc
CameraProject camera,xt,yt,zt

If ProjectedZ()>-100 And ProjectedY()>-100 And ProjectedY()<1180 And ProjectedX()>-100 And ProjectedX()<2020 Then
renderworld2
EndIf
HideEntity bmesh(t)
Next
;If KeyHit(1) Then End
EndIf
EndIf
Next
Next
Next
LightColor light1,lred(),lgrn(),lblu()
LightColor light2,lred(),lgrn(),lblu()
LightColor light3,lred(),lgrn(),lblu()
LightColor light4,lred(),lgrn(),lblu()
HideEntity bshadow
EndIf
;;;;;
;Render Large Trees
;
If treeon = 1 Then
If tshadow = 0 Then
tshadow = CreateSphere()
EntityColor tshadow,0,0,0
EntityAlpha tshadow,0.4
ScaleEntity tshadow,8,1.05,8
EndIf
ShowEntity tshadow
LightColor light1,lred(),lgrn(),lblu()
LightColor light2,lred(),lgrn(),lblu()
LightColor light3,lred(),lgrn(),lblu()
LightColor light4,lred(),lgrn(),lblu()
SeedRnd  mapi + 2 + zonex + zonez
j = 0
jj = 0
For ti = 1 To 3
x = Rand(-120,120)
z = Rand(-120,120)
xxi = 0
zzi = 0
For xx = x - 100 To x + 100 Step 20
xxi = xxi + 1
If Abs(xxi) Mod 20 = 0 Then
lr = lred() - Rand(20)
lg = lgrn() - Rand(20)
lb = lblu() - Rand(50)
LightColor light1,lr,lg,lb
LightColor light2,lr,lg,lb
LightColor light3,lr,lg,lb
LightColor light4,lr,lg,lb
EndIf
zzi = 0
For zz = z - 100 To z + 100 Step 20
zzi = zzi + 1
If Abs(zzi) Mod 20 = 0 Then
lr = lred() - Rand(20)
lg = lgrn() - Rand(20)
lb = lblu() - Rand(50)
LightColor light1,lr,lg,lb
LightColor light2,lr,lg,lb
LightColor light3,lr,lg,lb
LightColor light4,lr,lg,lb
EndIf
nohouse = 1
If houseon<>0 Then
If zonex+xx>h1x+zonex - 25 And zonex+xx<h1x+zonex + 25 And zonex+zz>h1z+zonez - 25 And zonez+zz<h1z+zonez + 25 Then nohouse = 0
If zonex+xx>h2x+zonex - 25 And zonex+xx<h2x+zonex + 25 And zonex+zz>h2z+zonez - 25 And zonez+zz<h2z+zonez + 25 Then nohouse = 0
If zonex+xx>h3x+zonex - 25 And zonex+xx<h3x+zonex + 25 And zonex+zz>h3z+zonez - 25 And zonez+zz<h3z+zonez + 25 Then nohouse = 0
If zonex+xx>h4x+zonex - 25 And zonex+xx<h4x+zonex + 25 And zonex+zz>h4z+zonez - 25 And zonez+zz<h4z+zonez + 25 Then nohouse = 0
EndIf
jj = jj + 1
If jj Mod 5 = 0 And (xx-x)*(xx-x)+(zz-z)*(zz-z)<200*200 And nohouse = 1 Then
t = Rand(1,5)
While t = 3 Or t = 4 Or t = 2
t = t + 1
t = t Mod 5
t = t + 1
Wend

xt# = Float(zonex+xx)+Rnd(-12,12)
zt# = Float(zonez+zz)+Rnd(-12,12)
dx# = EntityX(camera)-xt
dz# = EntityZ(camera)-zt
j = j + 1
ShowEntity tmesh(t)
yt# = ym(xt,zt)
yaw# = Rnd(360)
pitch# = 0
If Rand(0,100)<15 Then pitch# = 3.5*Sin(Float(frame)*2.5*0.125)
PositionEntity tmesh(t),xt,yt,zt
PositionEntity tshadow,xt,yt,zt
RotateEntity tmesh(t),pitch,yaw,0
sc# = 1.0
If t = 1 Then sc = Rnd(2.5,4.5)
If ti = 3 Then sc = sc * 0.6
If ti = 2 Then sc = sc * 0.4
ScaleEntity tmesh(t),Rnd(0.85,1.5)*sc,Rnd(0.75,1.0)*sc,Rnd(0.85,1.5)*sc
CameraProject camera,xt,yt,zt

If ProjectedZ()>-100 And ProjectedY()>-100 And ProjectedY()<1180 And ProjectedX()>-100 And ProjectedX()<2020 Then
renderworld2
EndIf
HideEntity tmesh(t)
EndIf
Next
Next
Next
LightColor light1,lred(),lgrn(),lblu()
LightColor light2,lred(),lgrn(),lblu()
LightColor light3,lred(),lgrn(),lblu()
LightColor light4,lred(),lgrn(),lblu()
HideEntity tshadow
EndIf
SeedRnd mapi - 4 + zonex + zonez
;;;;;
;Render Main Grasses
;
If grasson = 1 Then
LightColor light1,lred(),lgrn(),lblu()
LightColor light2,lred(),lgrn(),lblu()
LightColor light3,lred(),lgrn(),lblu()
LightColor light4,lred(),lgrn(),lblu()
ShowEntity grass
ShowEntity grass2
ShowEntity bgrass
If debugging = 1 Then HideEntity grass2:HideEntity bgrass
j = 0
dda = 3
If debugging = 1 Then dda = 1
For i = 1 To dda
For x = -80  To 80 Step 2
If Abs(x) Mod 10 = 0 Then
lr = lred() - Rand(20)
lg = lgrn() - Rand(20)
lb = lblu() - Rand(50)
LightColor light1,lr,lg,lb
LightColor light2,lr,lg,lb
LightColor light3,lr,lg,lb
LightColor light4,lr,lg,lb
EndIf
yaw# = Rnd(360)
For z = -80 To 80 Step 2
If Abs(z) Mod 10 = 0 Then
lr = lred() - Rand(20)
lg = lgrn() - Rand(20)
lb = lblu() - Rand(50)
LightColor light1,lr,lg,lb
LightColor light2,lr,lg,lb
LightColor light3,lr,lg,lb
LightColor light4,lr,lg,lb


EndIf
j = j + 1
;If debugging = 0 Or Rand(0,1000)<125

xt# = Float(zonex+x)+Rnd(-5,5)
zt# = Float(zonez+z)+Rnd(-5,5)
dx# = EntityX(camera)-xt
dz# = EntityZ(camera)-zt
distance# = dx*dx+dz*dz
If (distance > 100*100 And j Mod 12<>0) Or (distance>60*60 And j Mod 5<>0) Or (distance>50*50 And j Mod 2<>0 )Then
Rand(0,100)
Rnd(0,1)
Rnd(0,1)
Rnd(0,1)
Rnd(-5,5)
Rnd(-5,5)
Rnd(360)
Rnd(360)
Else
CameraProject camera,xt,0,zt
yt# = ym(xt,zt)

pitch# = 0
If Rand(0,100)<85 Then pitch# = 12.5*Sin(Float(frame)*2.5*0.125)
PositionEntity grass,xt,yt,zt
RotateEntity grass,pitch,yaw,0
scx# = Rnd(0.5,1.5)*0.3
scy# = Rnd(0.75,2.25)*0.25
scz# = Rnd(0.5,1.5)*0.3
ScaleEntity grass,scx,scy,scz
ScaleEntity grass2,scx,scy,scz
xt# = Float(zonex+x)+Rnd(-5,5)
zt# = Float(zonez+z)+Rnd(-5,5)
yt# = ym(xt,zt)
;yaw# = Rnd(360)
PositionEntity grass2,xt,yt,zt
RotateEntity grass2,0,yaw,0
PositionEntity bgrass,xt,yt,zt
RotateEntity bgrass,Rnd(360),Rnd(360),0.0
ScaleEntity bgrass,scx,scy*0.85,scz
CameraProject camera,xt,yt,zt
If ProjectedZ()>-100 And ProjectedY()>-100 And ProjectedY()<1180 And ProjectedX()>-100 And ProjectedX()<2020 Then
If EntityDistance(bgrass,camera)>150 Then EntityAlpha bgrass,0 Else EntityAlpha bgrass,1
If EntityDistance(grass2,camera)>150 Then EntityAlpha grass2,0 Else EntityAlpha grass2,1
If EntityDistance(grass,camera)>40 Then EntityAlpha grass_s,0 Else EntityAlpha grass_s,0.4
If EntityDistance(grass2,camera)>20 Then EntityAlpha grass_s2,0 Else EntityAlpha grass_s2,0.4
renderworld2
EndIf
EndIf
Next
; If KeyHit(1) Then End
Next
Next
HideEntity grass
HideEntity grass2
HideEntity bgrass
LightColor light1,lred(),lgrn(),lblu()
LightColor light2,lred(),lgrn(),lblu()
LightColor light3,lred(),lgrn(),lblu()
LightColor light4,lred(),lgrn(),lblu()

EndIf

;;;;;
;Render Extra Grasses
;
SeedRnd mapi +1234 + zonex + zonez
If minigrasson = 1 Then
LightColor light1,lred(),lgrn(),lblu()
LightColor light2,lred(),lgrn(),lblu()
LightColor light3,lred(),lgrn(),lblu()
LightColor light4,lred(),lgrn(),lblu()
ShowEntity grass
HideEntity grass_s
j = 0
dda = 6
If debugging <> 0 Then dda = 1
For k = 1 To dda
For x = -80  To 80 Step 2
If Abs(x) Mod 10 = 0 Then
lr = lred() - Rand(20)
lg = lgrn() - Rand(20)
lb = lblu() - Rand(50)
LightColor light1,lr,lg,lb
LightColor light2,lr,lg,lb
LightColor light3,lr,lg,lb
LightColor light4,lr,lg,lb
EndIf
yaw# = Rnd(360)
For z = -80 To 80 Step 2
If Abs(z) Mod 10 = 0 Then
lr = lred() - Rand(20)
lg = lgrn() - Rand(20)
lb = lblu() - Rand(50)
LightColor light1,lr,lg,lb
LightColor light2,lr,lg,lb
LightColor light3,lr,lg,lb
LightColor light4,lr,lg,lb
EndIf
j = j + 1
xt# = Float(zonex+x)+Rnd(-4,4)
zt# = Float(zonez+z)+Rnd(-4,4)
dx# = EntityX(camera)-xt
dz# = EntityZ(camera)-zt
If dx*dx+dz*dz > 100*100 And j Mod 6<>0 Then
Rnd(0,1)
Rnd(0,1)
Else

CameraProject camera,xt,0,zt
yt# = ym(xt,zt)
pitch# = 0
PositionEntity grass,xt,yt,zt
If EntityDistance(camera,grass)<150 Then
RotateEntity grass,pitch,yaw,0
scx# = Rnd(0.5,1.5)*0.27
ScaleEntity grass,scx#,Rnd(0.75,1.25)*0.27,scx#
CameraProject camera,xt,yt,zt
If ProjectedZ()>-100 And ProjectedY()>-100 And ProjectedY()<1180 And ProjectedX()>-100 And ProjectedX()<2020 Then
renderworld2
EndIf
Else
Rnd(0,1)
Rnd(0,1)
EndIf
EndIf
Next
Next
Next
HideEntity grass
LightColor light1,lred(),lgrn(),lblu()
LightColor light2,lred(),lgrn(),lblu()
LightColor light3,lred(),lgrn(),lblu()
LightColor light4,lred(),lgrn(),lblu()
EndIf
;;;;;
;Render Beastmen Walking and Idling About
;
If orcson = 1 Then
SeedRnd mapi + 123 + zonex + zonez
dda = 50
If debugging<>0 Then dda = 10
For i = 1 To dda
m = Rand(1,5)
wtype = Rand(0,10)
ShowEntity wmesh(m)
ShowEntity wmeshs(m)
HideEntity wmeshc(m)
xt# = zonex+Rnd(-150,150)
zt# = zonez+Rnd(-150,150)
yaw# = Rnd(360)
yawoff# = 0
If wtype < 4 Then

xt = xt + 0.125 * Cos(yaw) * Float(frame)
zt = zt + 0.125 * Sin(yaw) * Float(frame)

If Abs(xt-zonex)>256 Then
xt = xt - (Abs(xt-zonex))*1.8
yawoff = 180
EndIf
If Abs(zt-zonez)>256 Then
zt = zt - (Abs(zt-zonez))*1.8
yawoff = 180
EndIf
EndIf
yt# = ym(xt,zt)
RotateEntity wmesh(m),0,yawoff+yaw-90,0
RotateEntity wmeshs(m),0,yawoff+yaw-90,0

PositionEntity wmesh(m),xt,yt,zt
PositionEntity wmeshs(m),xt,yt+0.05,zt
q# = (Float(frame) / 1440.0) * 1400.0
qq = (Int(q+i+m) Mod 100)
off151 = 0
If Rand(0,100)<25  Then off151 = 151
If wtype < 4 Then
off151 = 381
qq = (Int(q+i+m) Mod 40)
EndIf
SetAnimTime wmesh(m),qq+off151
SetAnimTime wmeshs(m),qq+off151
CameraProject camera,xt,yt,zt
ScaleEntity wmesh(m),0.3,0.3,0.3
ScaleEntity wmeshs(m),0.3,0.001,0.3
If ProjectedZ()>-100 And ProjectedY()>0 And ProjectedY()<1200 And ProjectedX()>-100 And ProjectedX()<2020 Then
RenderWorld2
EndIf
HideEntity wmesh(m)
HideEntity wmeshs(m)
Next

For m = 1 To 6
HideEntity wmesh(m)
HideEntity wmeshs(m)
HideEntity wmeshc(m)
Next

EndIf
.skipzone
Next ;zonez
Next ;zonex
;;;;;
;Render Layered Fog
;
If fogon = 1 Then
ShowEntity map
EntityTexture map,cloudtex
ScaleTexture cloudtex,8,8
EntityAlpha map,0.4
PositionTexture cloudtex,0,0
dda = 10
If debugging<>0 Then dda = 3
For i = 1 To dda
EntityAlpha map,(1.0 - skyr*skyr*skyr*skyr)*0.25
TranslateEntity map,0,0.05*Float(i),0
PositionTexture cloudtex,0.1*Float(i)+20.0*(0.125*Float(frame)/1440.0),0.1*Float(i)+20.0*0.125*(Float(frame)/1440.0)
renderworld2
Next
PositionTexture cloudtex,0,0
PositionEntity map,-2560,0,-2560
EntityAlpha map,1.0
EntityTexture map,planetex
HideEntity map
ScaleTexture cloudtex,1,1
EndIf
Next ;mapz
Next ;mapx
EndIf
;;;;;
;Record Screen - on my PC this single command 'savebuffer' takes 1300ms
;
If record<>0 And frame <= (1440 * 8) - 1 And frame Mod 2 = 0 And frame >=0 And frame >= startframe
framei$ = Str(frame/2)
While Len(framei)<6
framei = "0" + framei
Wend
SaveBuffer BackBuffer(),"..\screenshots\forest_render_"+framei+".bmp"
EndIf
;;;;;
;Refresh the screen and put some text metrics on display
;
If frame Mod 2 = 0 Then
If font = 0 Then font = LoadFont("Arial",30)
SetFont font
fpscount = fpscount + 1
frtime = Abs(MilliSecs() - ftime)
ftime = MilliSecs()
If Abs(MilliSecs()-fpstime)>1000 Then
fps = fpscount
fpscount = 0
fpstime = MilliSecs()
EndIf
Text 0,0,"F:"+frame+" FPS:"+fps+" FTIME:"+frtime+"ms"
Text 0,40,CurrentTime()
Text 0,80,"Zonex:"+camzonex+" Zonez:"+camzonez
Flip False
EndIf
If frame >= startframe Then Delay 2

Until KeyHit(1)
End

Function ym#(x#,z#)
;;;;;
;Because I'm lazy make a function that is really easy to type instead of the normal TerrainY function
;
Return TerrainY(map,x,0,z)
End Function

Function renderworld2()
;;;;;
;Just in case I want to do anything weird or unusual in the renderworld function
;
RenderWorld
end Function

;;;;;
;A bunch of functions related to the lighting of the environment
;
Function lred()
;240
oframe = frame
frame = 700
;lr = 240
;If frame < 100 Then
lr = 30 + 210.0 * Float(skyr*100.0)/100.0
;EndIf
;If frame >820 And frame < 920 Then
; lr = 240 - 210.0 * Float(frame - 820)/100.0
;EndIf
;If frame >=100 And frame <=820 Then lr = 240
;If frame >=920 Then lr = 30
frame = oframe
Return lr
End Function

Function lgrn()
;200
lr = 200
oframe = frame
frame = 700
;';If frame < 100 Then
lr = 30 + 170.0 * Float(skyr*100.0)/100.0
;EndIf
;If frame >820 And frame < 920 Then
; lr = 200 - 170.0 * Float(frame - 820)/100.0
;EndIf
;If frame >=100 And frame <=820 Then lr = 200
;If frame >=920 Then lr = 30
frame = oframe
Return lr

End Function

Function lblu()
;150
lr = 150
oframe = frame
frame = 700

;If frame < 100 Then
lr = 85 + 65.0 * Float(skyr*100.0)/100.0
;EndIf
;If frame >820 And frame < 920 Then
; lr = 150 - 65.0 * Float(frame - 820)/100.0
;EndIf
;If frame >=100 And frame <=820 Then lr = 150
;If frame >=920 Then lr = 85
frame = oframe
Return lr
End Function


Here's the attachments:

Matty

Updated video (same as earlier one with some improvements....shadows adjusted, glitches with walking backwards for some beasts fixed, a few other minor enhancements)


Midimaster

#10
You should try to create a type for your beasts, where you can handle the animspeed individual. At the moment it looks like they all do the same at the same time. With minimal differences in animation speed, timing and z-moving the whole scene would look more realistic

something like that:
Type TBeast
   Field AnimSpeed
   Field wMesh, wMeshs...
   Field moveZ
   ....
End Type
....

For i=0 to 9
   tmpBeast.TBeast    = New TBeast
   tmpBeast/MoveZ     = Rand(0.3)
   tmpBeast/AnimSpeed = Rand(281,381)
   ....
Next
....

;Main-Loop:
For Beast = Each TBeast
   SetAnimTime Beast/wMesh , qq + Beast/AnimSpeed
   MoveEntity  Beast/wMeshs, 0, 0.05 , Beast/MoveZ
...back from North Pole.

Matty


Matty

In the desert.....undead....more rendering....there's a few glitches in this one...and I didn't get any moving wizards/wraiths until the end of the video...sorry


Matty

Second updated desert film...just an update...


Matty

Actual commercial software (not mine) - looks 10,000x better than my work...but I am just a hobbyist....