본문 바로가기
3DsMax/plug-in&scripts

Vertex Render 스크립트

by biped 2012. 6. 26.


maxscript help에 있는 소스입니다.

실시간으로 버텍스를 렌더링 합니다. 실제 용도로는 많이 부족해 보이지만 신기하네요. 

파티클 사용시 방향성 확인용으로 좋을것 같습니다.

http://docs.autodesk.com/3DSMAX/14/ENU/MAXScript%20Help%202012/files/GUID-853014AC-9DC8-4F5C-B14B-3643E5925AD-320.htm






---------------------------------------


macroScript VertexRender category:"HowTo"
(
local VertexRendererEnabled = false
local screen_width, screen_height, back_vfb, front_vfb
fn VertexRendererFunction =
(
st = timestamp()
copy back_vfb front_vfb
for o in geometry where classof o != TargetObject do 
(
theMesh = snapshotAsMesh o
dot_color = #(o.wirecolor)
theVertCount = theMesh.numverts
for v = 1 to theVertCount do
( 
thePos = (getVert theMesh v)* viewport.getTM()
screen_origin = mapScreenToView [0,0] (thePos.z) [screen_width,screen_height]
end_screen = mapScreenToView [screen_width,screen_height] (thePos.z) [screen_width,screen_height]
world_size = screen_origin-end_screen
x_aspect = screen_width/(abs world_size.x)
y_aspect = screen_height/(abs world_size.y)
screen_coords = point2 (x_aspect*(thePos.x-screen_origin.x)) (-(y_aspect*(thePos.y-screen_origin.y)))
setPixels front_vfb screen_coords dot_color
)--end v loop
)--end o loop
display front_vfb 
et = timestamp()
pushPrompt ("VertRender "+(1000.0/(et-st)) as string +" fps")
)--end fn
 
on isChecked return VertexRendererEnabled
 
on execute do
(
VertexRendererEnabled =not VertexRendererEnabled
 
if VertexRendererEnabled then
(
screen_width=RenderWidth
screen_height=RenderHeight
back_vfb = bitmap screen_width screen_height
front_vfb = bitmap screen_width screen_height
registerRedrawViewsCallback VertexRendererFunction
RedrawViews() 
) 
else
(
unRegisterRedrawViewsCallback VertexRendererFunction 
close front_vfb 
)
)--end on execute
)--end script


'3DsMax > plug-in&scripts' 카테고리의 다른 글

Ivy Generator   (0) 2012.10.02
Aviz Studio Tools  (0) 2012.06.27
3ds max 렌더패스툴 (Render Elements)  (0) 2012.06.25
VRayEmbree helper for V-Ray 2.3  (0) 2012.06.25
BookScatter script   (0) 2012.05.29

댓글