Author Topic: Get framebuffer image (maxscript)  (Read 1967 times)

2017-08-23, 16:11:02

Alan

  • Active Users
  • **
  • Posts: 25
    • View Profile
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?

Code: [Select]
newmat = CoronaMtl()
newmat.name = ("MAT_" + i as string)
selection.material = newmat

bmpBuffer = CoronaRenderer.CoronaFp.getVfbContent
newmat.texmapDiffuse = bmpBuffer

I'm getting this error:
Code: [Select]
Unable to convert: getVfbContent() to type: TextureMap

2017-11-26, 12:42:57
Reply #1

RANCH Renderfarm

  • Active Users
  • **
  • Posts: 15
  • Fast and Affordable Cloud Rendering service
    • View Profile
    • www.ranchcomputing.com
You can try this:
Code: [Select]
(
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.
RANCH Renderfarm (www.ranchcomputing.com) - Fully Automated 24/7
Brand New AMD powerful servers Milan and Bergamo - 256 Gb to 1 Tb RAM each - dedicated to all your Corona projects!
Up to +70% bonus refill!
30 € free trial - no watermarks