algorithmic modeling for Rhino
Dim num As Integer = y
Dim bm As New Bitmap(num, num)
For i As Integer = 0 To num - 1
For j As Integer = 0 To num - 1
bm.SetPixel(i, j, x(i * num + (num - 1 - j)))
Next
Next
' Save the result as a JPEG file.
bm.Save("C:\Users\v\Documents\amid\cubierta\transp.jpg")
End Sub
Dim num As Integer = y
Dim bm As New Bitmap(num, num)
For i As Integer = 0 To num - 1
For j As Integer = 0 To num - 1
bm.SetPixel(i, j, x(i * num + (num - 1 - j)))
Next
Next
' Save the result as a JPEG file.
bm.Save("C:\Users\v\Documents\amid\cubierta\mapas\transp" & z & ".jpg")
Dim obj As IRhinoSurfaceObject
Dim mat As New OnMaterial
Dim texture As New OnTexture
texture.m_filename = "C:\Users\v\Documents\amid\cubierta\mapas\transp" & z & ".jpg"
texture.m_bApply_uvw = True
' texture.m_transparent_color = New OnColor(0, 0, 0)
texture.m_type = RMA.OpenNURBS.IOnTexture.TYPE.transparency_texture
texture.m_mode = RMA.OpenNURBS.IOnTexture.MODE.modulate_texture
'mat.m_textures.Append(texture)
mat.AddTexture(texture)
mat.m_diffuse = New OnColor(204, 204, 204)
'doc.DeleteObject(New MRhinoObjRef(obj), True, True)
obj = doc.AddSurfaceObject(b)
Dim att As New MRhinoObjectAttributes(obj.Attributes())
att.setmaterialsource(1)
att.m_material_index = doc.m_material_table.AddMaterial(mat)
att.m_rendering_attributes.Default
Dim objref As New MRhinoObjRef(obj.Attributes.m_uuid)
doc.ModifyObjectAttributes(objref, att)
' app.RunScript("_save")
'x' should be a flat list of data. Change it from datatree to list and flatten the 'divide surface' output. Also, remember when you divide a surface in n amount of segments you end up with n+1 points on each axis, so you have to add 1 to y.
This is only useful for creating a texture that is uv mapped to a nurbs surface. For actual vertex colour rendering of any type of mesh, if you use the Brazil renderer, there's a new shader released some months ago that does this. For other renderers, i posted an alternative that modifies mesh texture coordinates (although it didnt work very well) here: http://www.grasshopper3d.com/forum/topics/rendering-falsecolor-data...
Also, i made this thread for a solution to colour different meshes with diferent colours using a single bitmap texture here (this one works well):
http://www.grasshopper3d.com/forum/topics/solution-to-baking-multiple
Thanks, I caught the n+1, but went the other way and reduced the UV to the surface divide. I'll try the list for flattened x tomorrow.
Many thanks
Danny
Hello!
It was a great workshop - thank you! By the way - that's me , who gave you that printscreened error massage with some russian text -sorry for that :)
I have one question - maybe you can help me. How to convert color of the mesh into texture (so each vertex will have a color value) - to use it later in maya or 3ds-max? cause when i'm exporting colored mesh (after Geco) as obj or 3ds - it can't convert the color.
thank you in advance
Andrey
Hi Andrey,
please post such questions in the geco forum, it is easier for me the find ;)
The trick is to export it as an fbx file and you have all the information in 3dsmax or maya ;)
btw. could you maybe translate the text so that we can know what was the error?
cheers,
[uto]
thank's a lot!
sure it says:
Message log start (chronological):
Plugin version: 0.8.0004
Component Mesh AddAttributes {180c5fc8-4884-4142-8c0e-78e13c511b77} failed to deserialize itself: Can not load the type "Grasshopper.Kernel.GH_ParamEventArgs" from assembly "Grasshopper, Version=1.0.0.20, Culture=neutral, PublicKeyToken=null".
Object list read
best
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by