hi
i had this idea about how to render lots of 3D grass using only 2 polies per cluster, and i think this is close to the way FarCry 2 does it. (if you run the code you'll see how the billboard clusters spin; i noticed that happening in FarCry 2 once and thought about why it would do that. this is what i came up with)
i'm rendering some cones with a secondary camera. i set the camera to an image and texture some planes with it so i get images of the cones. i set the secondary camera's backdrop to black, the image colorkey to black, and set the plane objects' transparencies on. but the planes are not transparent.
the second problem is with
sync mask. if i set the sync mask to 1, that should enable camera 0 and disable anything else, right? it's not working in this code, which is why i commented out the RenderGrass subroutine.
sync on : sync rate 60 : autocam off : hide mouse
//set window on
set display mode 1024,768,32,1
#CONSTANT RENDERCAM 0
#CONSTANT PLANECAM 1
type Grass
id as integer
targetcam as integer
//active as boolean
endtype
type Plr
x as float
y as float
z as float
ax as float
ay as float
endtype
make camera PLANECAM
color backdrop PLANECAM, 0
set image colorkey 0,0,0
global Planetex = 1
set camera to image PLANECAM, Planetex, 256,256
global dim GrassBillboards(-1) as Grass
for x=0 to 6
id = find free object()
array insert at bottom GrassBillboards()
i = array count(GrassBillboards())
GrassBillboards(i).id = id
GrassBillboards(i).targetcam = PLANECAM
//GrassBillboards(i).active = false
angle#=i*60.0
make object cone id, 5
if x>0 then position object id, 10*cos(angle#), 0, 10*sin(angle#)
next x
for x=0 to 99
id = find free object()
array insert at bottom GrassBillboards()
i = array count(GrassBillboards())
GrassBillboards(i).id = id
GrassBillboards(i).targetcam = RENDERCAM
//GrassBillboards(i).active = false
make object plane id, 40,30
position object id, random(500),0,random(500)
texture object id, Planetex
set object ambient id, 0
set object transparency id, 4
next x
global Player as Plr
while not escapekey()
gosub Controls
gosub PointGrass
//gosub RenderGrass
sync
endwhile
end
Controls:
inc Player.ax, mousemovey()*0.2
inc Player.ay, mousemovex()*0.2
if mouseclick() = 1
inc Player.x, 2*sin(Player.ay)
inc Player.y, -2*sin(Player.ax)
inc Player.z, 2*cos(Player.ay)
endif
//render camera placement
position camera RENDERCAM, Player.x,Player.y,Player.z
rotate camera RENDERCAM, Player.ax,Player.ay,0
//grass camera placement
position camera PLANECAM, 0,0,0
rotate camera PLANECAM, Player.ax,-(Player.ay/2),0
move camera PLANECAM, -30
return
PointGrass:
for i=0 to array count(GrassBillboards())
if GrassBillboards(i).targetcam = RENDERCAM
point object GrassBillboards(i).id, Player.x,Player.y,Player.z
zrotate object GrassBillboards(i).id, 0
endif
next i
return
RenderGrass:
i=1
while object exist(i)
exclude object on i
endwhile
for i=0 to array count(GrassBillboards())
if GrassBillboards(i).targetcam = PLANECAM
exclude object off GrassBillboards(i).id
endif
next i
sync mask 2
fastsync
sync mask 1
i=1
while object exist(i)
exclude object off i
endwhile
for i=0 to array count(GrassBillboards())
if GrassBillboards(i).targetcam = PLANECAM
exclude object on GrassBillboards(i).id
endif
next i
return
and how do you get syntax highlighting in a code box??

Remember those old guys? They made epic renders, I think one of them was called DaVinci, and all they used was MS Paint. Sometimes it's just skill....