Reply
Reply
 
Thread Tools Display Modes
cupsster's Avatar
Old (#1)
Hi all,
please can anyone advice me how to transfer color of diffuse map to vertex colors?
Tryed this: http://www.polycount.com/forum/showt...e+vertex+color not working for me.

Is there any script for this? I must use old tech...

Thank you.
Offline , triangle, 358 Posts, Join Date Jan 2010, Location Slovakia Send a message via Skype™ to cupsster  
   Reply With Quote

cupsster's Avatar
Old (#2)
Code:
if rol_ColorBakerProgress!=undefined do destroyDialog rol_ColorBakerProgress
rollout rol_ColorBakerProgress "Baking Progress" width:190 height:48
(
label lbl_Text "Baking Texture into Vertices:" pos:[20,7] width:150 height:13
progressBar pb1_Progress "ProgressBar" pos:[6,21] width:180 height:20

)
----
----
fn IOI_ColorBakerBakeTexture targetObj=
(
--	targetObj=$
converttoPoly targetObj --NOTE
baseObject=targetObj.baseObject
theBitmap=targetObj.material.diffusemap.bitmap
theBitmapW=theBitmap.width-1
theBitmapH=theBitmap.height-1


vertNum=polyOp.getNumVerts baseObject
fnGetMapvert=polyOp.getMapVert
fnsetVertColor=polyOp.setVertColor
fnsetVertData=polyOp.setVDataValue

createDialog rol_ColorBakerProgress
pbl_Progress=rol_ColorBakerProgress.pb1_Progress
for iVert=1 to vertNum do
(
mapPos=fnGetMapvert baseObject 1 iVert

mapPos[1]=mod (mapPos[1]) 1
mapPos[2]=mod (mapPos[2]) 1
bitmapPos=[(mapPos[1]*theBitmapW) as integer, (mapPos[2]*theBitmapH) as integer]	
if bitmapPos[1]<0 do bitmapPos[1]+=theBitmapW
if bitmapPos[2]<0 do bitmapPos[2]+=theBitmapH
multiW= ceil (bitmapPos[1]/theBitmapW) 
if multiW > 1 do bitmapPos[1]=bitmapPos[1]-theBitmapW*(multiW-1)

multiH= ceil (bitmapPos[2]/theBitmapH) 
if multiH > 1 do bitmapPos[2]=bitmapPos[2]-theBitmapH*(multiH-1)	
bitMapPos[2]=theBitmapH-bitMapPos[2] --theBitmapW-bitMapPos[1], 

mapColor= (getPixels theBitmap bitmapPos 1)[1]
fnsetVertColor baseObject 0 #{iVert} mapColor --PERFORMANCE This is VERY slow. 10sec on 4000 object.

Progress=(iVert/(vertNum as float))*100
if pbl_Progress.value!=Progress do pbl_Progress.value=Progress
)
addModifier targetObj (VertexPaint())
max modify mode
destroyDialog rol_ColorBakerProgress

targetObj.showVertexColors =true
)
IOI_ColorBakerBakeTexture $
CREDIT
Offline , triangle, 358 Posts, Join Date Jan 2010, Location Slovakia Send a message via Skype™ to cupsster  
   Reply With Quote

nezach's Avatar
Old (#3)
There's an 'Assign Vertex Color' tool in the utilities tab that can do that without the need for scripts.
Offline , line, 65 Posts, Join Date Apr 2008, Location No Fixed Abode / Texas Wastes  
   Reply With Quote

Eric Chadwick's Avatar
Old (#4)
Max will not display vertex colors in the viewport by default. You have to force it, in Object Properties, via Vertex Channel Display. Or you can use a DirectX shader that supports vertex color.
Offline , Polycount.com Editor, 6,762 Posts, Join Date Oct 2004, Location Boston USA  
   Reply With Quote

cupsster's Avatar
Old (#5)
@EricChadwick: yep, I know that standard material > diffuse slot > vertex color map
or
object properties > display vertex colors

@nezach: anyway this script works... max assign vertex colors don't.. so who wins? :P
Offline , triangle, 358 Posts, Join Date Jan 2010, Location Slovakia Send a message via Skype™ to cupsster  
   Reply With Quote

Noors's Avatar
Old (#6)
yeah most of the time i'm not able to assign the vertex color from the diffuse either. Sometimes it weirdly works after checking/unchecking some options but as i'm not considering myself as a max noob, my bet is : it's pretty buggy.
Offline , polycounter, 1,000 Posts, Join Date Dec 2008, Location Paris, France  
   Reply With Quote

cupsster's Avatar
Old (#7)
so good news for you Noors this works 100% sure, just second before I decided to script it myself google revealed this to me.. I'm pretty happy cause for time it will be crucial part of my workflow..
Offline , triangle, 358 Posts, Join Date Jan 2010, Location Slovakia Send a message via Skype™ to cupsster  
   Reply With Quote

fonfa's Avatar
Old (#8)
TexTools has a button that does it!
http://www.renderhjs.net/textools/
Offline , triangle, 409 Posts, Join Date Nov 2007, Location Montreal, Canada  
   Reply With Quote

nezach's Avatar
Old (#9)
Quote:
Originally Posted by cupsster View Post
@nezach: anyway this script works... max assign vertex colors don't.. so who wins? :P

You get no diffuse colors to the vertices from using it at all? It works for me so I guess I 'win' at that. /shrug
Offline , line, 65 Posts, Join Date Apr 2008, Location No Fixed Abode / Texas Wastes  
   Reply With Quote

cupsster's Avatar
Old (#10)
thanx for pointing that out.. i'm using it but was unaware of this feature..
Offline , triangle, 358 Posts, Join Date Jan 2010, Location Slovakia Send a message via Skype™ to cupsster  
   Reply With Quote

cupsster's Avatar
Old (#11)
No, never worked for me except maybe 4 years back when I was experimenting with it..
Offline , triangle, 358 Posts, Join Date Jan 2010, Location Slovakia Send a message via Skype™ to cupsster  
   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 1998-2012 A. Risch