Proc Noise into material colour shader
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/12/2010 at 05:17, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12
Platform:
Language(s) : PYTHON ;---------
Appreciate a nudge (first steps with python)I can create and set a materials colour and check to see if a duplicate exists
mat_op = c4d.BaseMaterial(c4d.Mmaterial) #create a standard material
mat_op[c4d.ID_BASELIST_NAME] = "mynewmatname"
doc.InsertMaterial(mat_op,pred=None,checknames=True)
mat_op[c4d.MATERIAL_COLOR_COLOR] = c4d.Vector(.4,.3,.8)and texture from a bitmap using a file path
but cant see how to insert a procedural shader
p = C4DNoise(1234)
p.InitFbm(21, 2.1, 0.5)
mat_op[c4d.MATERIAL_COLOR_SHADER] = por change the mixing method - multiply, add, subtract etc
any help appreciated
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/01/2011 at 03:00, xxxxxxxx wrote:
anyone?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/01/2011 at 07:31, xxxxxxxx wrote:
Hi C4DNoise cannot be combined with materials. It's used internally in a noise shader but also part of the API so you can determine a noise value manually. Below is a small code snippet how to add a noise shader to the first material in the current active document.
Unfortunately the noise types are currently not part of the c4d module so you need to define them manually. Just copy them from the following code snippet.
Cheers, Sebastian
import c4d SLA_NOISE_USE_AS_ENV = 1017 # bool SLA_NOISE_PROJECT_ENV = 1018 # bool SLA_NOISE_SEED = 1024 # int SLA_NOISE_NOISE = 1001 # int SLA_NOISE_NOISE_BOX_NOISE = 2001 SLA_NOISE_NOISE_BLIST_TURB = 2002 SLA_NOISE_NOISE_BUYA = 2003 SLA_NOISE_NOISE_CELL_NOISE = 2004 SLA_NOISE_NOISE_CRANAL = 2005 SLA_NOISE_NOISE_DENTS = 2006 SLA_NOISE_NOISE_DISPL_TURB = 2007 SLA_NOISE_NOISE_FBM = 2008 SLA_NOISE_NOISE_HAMA = 2009 SLA_NOISE_NOISE_LUKA = 2010 SLA_NOISE_NOISE_MOD_NOISE = 2011 SLA_NOISE_NOISE_NAKI = 2012 SLA_NOISE_NOISE_NOISE = 2013 SLA_NOISE_NOISE_NUTOUS = 2014 SLA_NOISE_NOISE_OBER = 2015 SLA_NOISE_NOISE_PEZO = 2016 SLA_NOISE_NOISE_POXO = 2017 SLA_NOISE_NOISE_RANDOM = 2018 SLA_NOISE_NOISE_SEMA = 2019 SLA_NOISE_NOISE_STUPL = 2020 SLA_NOISE_NOISE_TURBULENCE = 2021 SLA_NOISE_NOISE_VL_NOISE = 2022 SLA_NOISE_NOISE_WAVY_TURB = 2023 SLA_NOISE_NOISE_SEPARATOR = 3000 SLA_NOISE_NOISE_CELL_VORONOI = 2024 SLA_NOISE_NOISE_DISPL_VORONOI = 2025 SLA_NOISE_NOISE_SPARSE_CONV= 2026 SLA_NOISE_NOISE_VORONOI_1 = 2027 SLA_NOISE_NOISE_VORONOI_2 = 2028 SLA_NOISE_NOISE_VORONOI_3 = 2029 SLA_NOISE_NOISE_ZADA = 2030 SLA_NOISE_SPACE = 1022 SLA_NOISE_SPACE_UV = 2099 SLA_NOISE_SPACE_TEXTURE = 2100 SLA_NOISE_SPACE_OBJECT = 2101 SLA_NOISE_SPACE_WORLD = 2102 SLA_NOISE_SPACE_CAMERA = 2103 SLA_NOISE_SPACE_SCREEN = 2104 SLA_NOISE_SPACE_RASTER = 2105 SLA_NOISE_GLOBAL_SCALE = 1002 # float SLA_NOISE_SCALE = 1003 # c4d.Vector SLA_NOISE_ANI_SPEED = 1005 # float SLA_NOISE_DETAIL_ATT = 1006 # float SLA_NOISE_OCTAVES = 1007 # float SLA_NOISE_DELTA = 1008 # float XSLANoise = 1011116 #for ID def main() : mat = doc.GetFirstMaterial() if not mat: return True shd = c4d.BaseList2D(XSLANoise) shd[SLA_NOISE_NOISE] =SLA_NOISE_NOISE_BOX_NOISE mat[c4d.MATERIAL_COLOR_SHADER] = shd mat.InsertShader(shd) mat.Message(c4d.MSG_UPDATE) mat.Update(True, True) c4d.EventAdd() main()
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/01/2011 at 08:11, xxxxxxxx wrote:
Many, many thanks Sebastian.
These first steps are always tough even though the fog is gradually clearing.
Much appreciate the help.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/01/2011 at 09:46, xxxxxxxx wrote:
last one for now
I can set the material channels on and off using (bump example)
mat_op[c4d.MATERIAL_USE_BUMP]=Truebut can't figure how to get or set using GetChannelState() SetChannelState()
I appreciate I'm addressing this wrongly - help plsprint mat_op.GetChannelState(CHANNEL_BUMP)
error c4d.BaseMaterial object has no attribute ' GetChannelState'I see this a c4d.material rather than c4d.Basematerial, but stuck as how to address this function.
Again I'm only getting my head around the coding, objects etc
The correct syntax would be very helpful in making the leap in understanding how these objects fit together. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/01/2011 at 10:21, xxxxxxxx wrote:
GetChannelState/SetChannelState is obsolete for Python. To get the information if a channel is enabled, just call:
print mat[c4d.MATERIAL_USE_BUMP] #Is '1' if enabled, otherwise 0 for disabled
Cheers, Sebastian
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/01/2011 at 11:14, xxxxxxxx wrote:
I was looking to enable a channel after setting a shader
hence used SetChannelState (I guess this should be marked obsolete in the SDK)
mat[c4d.MATERIAL_USE_BUMP]=True
does the job - cheers -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/01/2011 at 11:18, xxxxxxxx wrote:
Is there a way to create an instance of a shader
or is it a case of feeding one source value to all the intended targets and refreshing when necessary? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/01/2011 at 12:16, xxxxxxxx wrote:
shd = c4d.BaseList2D(XSLANoise)
Here you already create a new instance of the noise shader.