what i tried to do was open "renderman" and add this
bottom front
shadow:write("\t]\n")
shadow:write("\n")
end
file:write("TransformEnd\n")
file:write("\n")
shadow:write("TransformEnd\n")
shadow:write("\n")
end
--]]
end
----------
-- Blood
local active_blood_particles = get_active_bloods()
local num_segments = 16
local blood = {}
for i=0, num_segments do
blood[i] = math.floor(i*#active_blood_particles/num_segments*(#blood_age*^-2))
end
file:write("# BLOOD\n")
file:write("Color 1 0 0\n")
file:write("\n")
file:write("TransformBegin\n")
file:write("\n")
-- Blood (Using "Blobby")
--[[
for j=1, num_segments do
local num_particles = blood[j] - blood[j-1]
file:write("Identity\n")
file:write("Blobby " .. num_particles .. "\n")
file:write("[")
for i=0, num_particles-1 do
file:write("1001 " .. i*16 .. "\n")
end
file:write("0 " .. num_particles .. "\n")
for i=0, num_particles-1 do
file:write(i .. " ")
end
file:write("]\n")
file:write("[")
for i=blood[j-1], blood[j]-1 do
local bloodx,bloody,bloodz = get_blood_pos(i)
local blood_radius = get_blood_radius(i)*2.5
-- Weird bug with blood coordinates, fix by making the blood particles tiny (for now)
if (bloodx == 0 and bloody == i+20) then
bloody, bloodz = 0.1, 0.1
blood_radius = 0.000001
end
file:write (blood_radius .. " 0 0 0 0 " .. blood_radius .. " 0 0 0 0 " .. blood_radius .. " 0 " .. bloodx .. " " .. bloody .. " " .. bloodz .. " 1\n")
end
file:write("]\n")
file:write("[\"\"]\n")
file:write("\n")
end
--]]
-- Blood (Using Spheres)
---[[
for i=0,#active_blood_particles-1 do
local bloodx,bloody,bloodz = get_blood_pos(i)
local blood_radius = get_blood_radius(i)*2.5
local linear_vel_x, linear_vel_y, linear_vel_z = get_blood_vel(i)
local prevX, prevY, prevZ = bloodx-(linear_vel_x*frame_len), bloody-(linear_vel_y*frame_len), bloodz-(linear_vel_z*frame_len)
file:write("TransformBegin\n")
file:write("MotionBegin [0 1]\n")
file:write("Translate " .. prevX .. " " .. prevY .. " " .. prevZ .. "\n")
file:write("Translate " .. bloodx .. " " .. bloody .. " " .. bloodz .. "\n")
file:write("MotionEnd\n")
file:write("Sphere " .. get_blood_radius(i) .. " " .. -1*get_blood_radius(i) .. " " .. get_blood_radius(i) .. " 360\n")
file:write("TransformEnd\n")
file:write("\n")
end
--]]
file:write("TransformEnd\n")
file:write("\n")
----------
-- Floor
file:write("TransformBegin\n")
file:write("Scale 50 50 1\n")
file:write("Color [1 1 1]\n")
file:write("\n")
file:write("Patch \"bilinear\" \"P\"\n")
file:write("[" .. -1 .. " " .. -1 .. " 0\n")
file:write(1 .. " " .. -1 .. " 0\n")
file:write(-1 .. " " .. 1 .. " 0\n")
file:write(1 .. " " .. 1 .. " 0]\n")
file:write("TransformEnd\n\n")
file:write("\n")
file:write("WorldEnd\n")
file:write("\n")
file:write("FrameEnd\n")
file:write("\n")
file:write("# EOF")
file:close()
shadow:write("WorldEnd\n")
shadow:write("\n")
shadow:write("# EOF")
shadow:close()
local blood_age = get_blood_age
end
to
bottom front
shadow:write("\t]\n")
shadow:write("\n")
end
file:write("TransformEnd\n")
file:write("\n")
shadow:write("TransformEnd\n")
shadow:write("\n")
end
--]]
end
----------
-- Blood
local active_blood_particles = get_active_bloods()
local num_segments = 16
local blood = {}
for i=0, num_segments do
blood[i] = math.floor(i*#active_blood_particles/num_segments)
end
file:write("# BLOOD\n")
file:write("Color 1 0 0\n")
file:write("\n")
file:write("TransformBegin\n")
file:write("\n")
-- Blood (Using "Blobby")
--[[
for j=1, num_segments do
local num_particles = blood[j] - blood[j-1]
file:write("Identity\n")
file:write("Blobby " .. num_particles .. "\n")
file:write("[")
for i=0, num_particles-1 do
file:write("1001 " .. i*16 .. "\n")
end
file:write("0 " .. num_particles .. "\n")
for i=0, num_particles-1 do
file:write(i .. " ")
end
file:write("]\n")
file:write("[")
for i=blood[j-1], blood[j]-1 do
local bloodx,bloody,bloodz = get_blood_pos(i)
local blood_radius = get_blood_radius(i)*2.5
-- Weird bug with blood coordinates, fix by making the blood particles tiny (for now)
if (bloodx == 0 and bloody == i+20) then
bloody, bloodz = 0.1, 0.1
blood_radius = 0.000001
end
file:write (blood_radius .. " 0 0 0 0 " .. blood_radius .. " 0 0 0 0 " .. blood_radius .. " 0 " .. bloodx .. " " .. bloody .. " " .. bloodz .. " 1\n")
end
file:write("]\n")
file:write("[\"\"]\n")
file:write("\n")
end
--]]
-- Blood (Using Spheres)
---[[
for i=0,#active_blood_particles-1 do
local bloodx,bloody,bloodz = get_blood_pos(i)
local blood_radius = get_blood_radius(i)*2.5
local linear_vel_x, linear_vel_y, linear_vel_z = get_blood_vel(i)
local prevX, prevY, prevZ = bloodx-(linear_vel_x*frame_len), bloody-(linear_vel_y*frame_len), bloodz-(linear_vel_z*frame_len)
file:write("TransformBegin\n")
file:write("MotionBegin [0 1]\n")
file:write("Translate " .. prevX .. " " .. prevY .. " " .. prevZ .. "\n")
file:write("Translate " .. bloodx .. " " .. bloody .. " " .. bloodz .. "\n")
file:write("MotionEnd\n")
file:write("Sphere " .. get_blood_radius(i) .. " " .. -1*get_blood_radius(i) .. " " .. get_blood_radius(i) .. " 360\n")
file:write("TransformEnd\n")
file:write("\n")
end
--]]
file:write("TransformEnd\n")
file:write("\n")
----------
-- Floor
file:write("TransformBegin\n")
file:write("Scale 50 50 1\n")
file:write("Color [1 1 1]\n")
file:write("\n")
file:write("Patch \"bilinear\" \"P\"\n")
file:write("[" .. -1 .. " " .. -1 .. " 0\n")
file:write(1 .. " " .. -1 .. " 0\n")
file:write(-1 .. " " .. 1 .. " 0\n")
file:write(1 .. " " .. 1 .. " 0]\n")
file:write("TransformEnd\n\n")
file:write("\n")
file:write("WorldEnd\n")
file:write("\n")
file:write("FrameEnd\n")
file:write("\n")
file:write("# EOF")
file:close()
shadow:write("WorldEnd\n")
shadow:write("\n")
shadow:write("# EOF")
shadow:close()
what i was trying to do was spawn a burst of blood when a joint was dismembered, then slowly go back to the normal "leakage" rate. this is my first attempt at lua so it obviously wouldn't work.