Chaos Corona Forum
Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: Alan on 2017-08-23, 16:11:02
-
Hi guys,
I'm trying to make a script to get the framebuffer rendering and put as diffuse texture on coronamtl. I'm using the getVfbContent but is not working, what am I doing wrong?
newmat = CoronaMtl()
newmat.name = ("MAT_" + i as string)
selection.material = newmat
bmpBuffer = CoronaRenderer.CoronaFp.getVfbContent
newmat.texmapDiffuse = bmpBuffer
I'm getting this error:
Unable to convert: getVfbContent() to type: TextureMap
-
You can try this:
(
function SaveVfbContent p = (
b = CoronaRenderer.CoronaFp.getVfbContent 0 false false --more info here: https://corona-renderer.com/wiki/maxscript
b.filename = p
save b quiet:true
close b; free b -- release it from the ram without waiting the garbage collector
)
local bitmap_path = @"C:\Users\Alan\Desktop\texture.jpg" as string
local i = 1
local mat = CoronaMtl name:("MAT_" + i as string)
SaveVfbContent bitmap_path
mat.texmapDiffuse = bitmaptexture filename:bitmap_path -- it's in fact what you do when you add manually a bitmap texture
obj = box mapCoords:true realWorldMapSize:false -- create a box with UV
obj.material = mat -- apply material to object
showTextureMap mat mat.texmapDiffuse on -- show diffuse map in viewport
)
Rodolphe.