Hi there,
It has been awhile that I have found this great community over here, i was wondering about and learning so mush, thanks for that at first place, you guys ROCK.
As in Scripting world and tech art I’m a total noob!:
obj = $
numofverts = meshop.getNumVerts $
for i = 1 to numofverts Do
(
tempMap = renderMap obj.material.diffuseMap size:[512,512]
uvcords = getTVert obj i
ucord = uvcords.x
vcord = uvcords.y
a = 512ucord
b = 512(1-vcord)
cordp2 = point2 a b
vertcass = getPixels tempMap cordp2 1
vcolort = vertcass[1]
meshop.setVertColor obj 0 i vcolort
)
ok, So I’m on a real-time visualization Project as environment artist, and for that we have a mesh used as a terrain, the Programmers have developed a shader which uses RGB and base color (Black) of Vertex color channel for mixing between textures.
make the story short, As painting the VC inside max for a big mesh like this (87066 vertexs) is a real pain, i decided to pint in Zbrush (polypaint then get a texure from it) then with the help of my script copy the data to vertex color channel.
this script works fine with small mesh (done for test) and it’s ok, but running it on the actual terrain, is a mess:
only one core is there to help you pass the for loop! (i got a core i7 PC):sigh:
and the RAM goes up to ~11.8 and then Max crashes (i got 12GB RAM).:no:
Any Idea on how to wright it in an efficient manner and performance friendly?
sorry for posting such dull issue and make it this long.
thanks to all you guys, \m/
talking to a friend of mine, he got the idea of putting the “render to bitmap” function out of “for loop”, and it seems to be the Memory consuming part, I’ll to a test tonight and send the results over here.
again sorry for the mess, I feel so ashamed of posting noob ideas.
Please do not be afraid to post what you think of as ‘noob ideas’.
And yes taking it out of the loop will work. You were creating a ton of maps, which as you guess consume (tons * 512 * 512 * 32) of memory. If you did need to create a bunch of temporary maps, you may be able to keep your memory down by making sure your ‘temp’ variable is local and calling ‘gc()’ at the end of every loop.
Rob Galanakis: thanks man, that gc() function really helped.
copypastepixel: yes you are right, and it helped with performance i think.
zortech: you are the man body. Here i should admit that i’m a fool, yes you are defenatlle right as this was what i meant to do, i don’ know ether to feel pity for myself not knowing about that option in the Vertexpaint modifier, or just say this task made me jump into scripting stuff, any way the max does it far better than me, maybe i should go and see how max do this from there.
thank you all for your support,
chax \m/.