color mapping based on normal vector... to paint snow, perha


(jms) #1

#--------------------------------------------
# Mapping of couleur based on the normal,
# jmsoler 03 / 2002
#--------------------------------------------
import Blender
from Blender import NMesh, Object

#function of z, 0=x,  1=y 
direction=2 

Me=Object.GetSelected() 
me=NMesh.GetRaw(Me[0].data.name) 

for f in me.faces: 
    for v in f.v: 
        f.col[f.v.index(v)].r=v.no[direction]*255 
        f.col[f.v.index(v)].g=v.no[direction]*255 
        f.col[f.v.index(v)].b=v.no[direction]*255 

NMesh.PutRaw(me,'test') 
Blender.Redraw()

(theeth) #2

when writting code on this Forum, try putting [ c o d e ] and [ / c o d e ] tags around it.


#-------------------------------------------- 
# Mapping of couleur based on the normal, 
# jmsoler 03 / 2002 
#-------------------------------------------- 
import Blender 
from Blender import NMesh, Object 

#function of z, 0=x, 1=y 
direction=2 

Me=Object.GetSelected() 
me=NMesh.GetRaw(Me[0].data.name) 

for f in me.faces: 
    for v in f.v: 
        f.col[f.v.index(v)].r=v.no[direction]*255 
        f.col[f.v.index(v)].g=v.no[direction]*255 
        f.col[f.v.index(v)].b=v.no[direction]*255 

NMesh.PutRaw(me,'test') 
Blender.Redraw()

Martin

<font size=-1>[ This Message was edited by: theeth on 2002-03-25 06:13 ]</font>


(jms) #3

#-------------------------------------------- 
#  Mapping de couleur basé sur la normale, variation RGB. 
#   jmsoler 03 / 2002 
#-------------------------------------------- 
import Blender 
from Blender import NMesh, Object 

Me=Object.GetSelected() 
me=NMesh.GetRaw(Me[0].data.name) 

for f in me.faces: 
     for v in f.v: 
            f.col[f.v.index(v)].r=v.no[0]*255 
            f.col[f.v.index(v)].g=v.no[1]*255 
            f.col[f.v.index(v)].b=v.no[2]*255 

NMesh.PutRaw(me,'test') 
Blender.Redraw()

just a test…

jm