The master object is hidden in my version.
Here's the code I was using (it uses the "tiny.x" boned model that comes with the DX SDK but I guess you can use your own):
`====================================================
` Tree demo - no trees in this edited version :)
`====================================================
` By EVOLVED
` www.evolved-software.com
`====================================================
`Setup Display
set display mode desktop width(), desktop height(),32,1
sync on : sync rate 60
` set up camera
autocam off
position camera 0, 0, -200
point camera 50, 0, 50
global cx#
global cy#
cx# = camera angle x()
cy# = camera angle y()
`Include
#include "Include/Common.dba"
#include "Include/Adv Lighting.dba"
#include "Include/Post Filter.dba"
#include "Include/Sky.dba"
`Setup Text
ink rgb(200,200,0),0
set text font "Verdana"
set text size 15
set text to bold
autocam off
`Setup Advanced Lighting
BiasRes=1280
Sw#=screen width()
res#=((Sw#/(BiasRes*2))*2)
if res#<1 then res#=1
AdvLightingX=((screen width()/res#)/2)*2
AdvLightingY=((screen height()/res#)/2)*2
AdvancedLighting_SetUp(AdvLightingX,AdvLightingY,6,AdvLightingY)
`Setup Post Effects
ViewPortRatio#=1.0
ViewPortX=((screen width()*ViewPortRatio#)/2)*2
ViewPortY=((screen height()*ViewPortRatio#)/2)*2
PostEffects_Setup(ViewPortX,ViewPortY,1,0,1,0,0,1)
`Set camera, Fog and Ambient
Set_Camera(1,5000,80,1.6)
Set_Fog(100,110,120,5000,2)
Set_Ambient(64,64,64,1.0)
Ambient_SetUp("Media/Ambient.dds",0,0)
CamDis#=-100
`Make Sky box
SkyBox_SetUp("Media/Cube1.dds")
`Load Textures
load image "Media/oldwall4.dds",4
load image "Media/oldwall4_n.dds",5
load image "Tiny_skin.dds", 6
load image "wave nMap v2.tga", 7
`Load animated source object
load effect "Shaders/Mesh/Normalmap.fx",2,0
Effect_Add(2)
load object "tiny.x", 1
texture object 1, 1, 7 ` arbitrary normal map just to show things working
set object effect 1, 2
scale object 1,30,30,30
HIDE OBJECT 1
loop object 1
set object speed 1, 5000
`============================================== HERE'S WHERE IT GOES WRONG ==========================================
`CLONE OBJECT 3, 1
INSTANCE OBJECT 3, 1
instance object 4, 1
`============================================== HERE'S WHERE IT GOES WRONG ==========================================
scale object 3,30,30,30
position object 3,-50,0,0
SHOW OBJECT 3
Object_Add(3)
scale object 4,30,30,30
position object 4,50,0,0
SHOW OBJECT 4
Object_Add(4)
texture object 1,7,AdvancedLightingImage(4) ` suggested by Green Gandalf for instanced objects
`Create floor
load effect "Shaders/Mesh/Normalmap.fx",3,0
Effect_Add(3)
make object box 2,1000,1,1000
position object 2,0,-100,0
scale object texture 2,0,20,20
Object_Add(2)
set object effect 2,3
texture object 2,0,4
texture object 2,1,5
`Set Directional Light
DirectionalLight_Create("Shaders/Lighting/Directional.fx")
DirectionalLight_Set_Rotation(35,210,0)
DirectionalLight_Set_Shadows(2)
DirectionalLight_Set_Specular(1)
`Start loop
do
positionCamera()
`Text
center text screen width()/2,15,"FPS "+str$(screen fps())
`Sky Update
SkyBox_Update()
`Advanced Lighting Update
FrustumCull_GetViewProject(0)
AdvancedLighting_Update()
`Post Filter Update
PostFilter_Update()
`Advanced Lighting Debug
AdvancedLighting_Debug()
`Sync Loop
sync mask 2^0
sync
loop
end
function positionCamera()
control camera using arrowkeys 0, 1, 0
cx# = cx# + mousemovey(): cy# = cy# + mousemovex()
if cx# < -45.0
cx# = -45.0
else
if cx# > 45.0 then cx# = 45.0
endif
rotate camera cx#, cy#, 0
endfunction
I haven't worked out what's happened to the shadows yet - but the objects which you can see animating are the instances of the hidden object 1.