Grasshopper

algorithmic modeling for Rhino

I'm creating and baking basic rhino materials in a scripting component for rendering purposes. Everything is working fine, but now i'd like to add a procedural texture created with the rdk texture palette. Is there a way to create or access rdk materials and textures from .net in grasshopper? Is there a way to add a procedural texture to rhino's basic material?
A referenced rdk material is converted to a EH_OGLShader when passed to a scripting component.

Views: 1520

Replies to This Discussion

There are two issues here I think, both of which unfortunately kinda stop this thing in its tracks. First off is AFAIK RDK is only available to C++ plugins. Since there's no dotNET wrapper for it yet, I don't think there's a way to call and of its functions. Also, dealing with RDK (from what I remember) requires jumping through a number of hoops, so I'm not sure, even if it was wrapped, to what extent that it would be available from something like a GH script.

The second thing is that I don't believe that the default material setups have the capability to contain links to RDK procedural textures (v4 at least, haven't checked this in v5). Although the default renderer will render the RDK procedurals, the material itself is actually a plugin material, not the default material. Therefore you would have to somehow create that plugin material and I'm not sure if that could be done and if it could, how.

There are RDK scripting methods that might be able to help here, provided you're willing to split the approach to include RhinoScript. I haven't used them myself yet, but there's a whole lot that seam wrapped up.

http://en.wiki.mcneel.com/default.aspx/McNeel/RDKRhinoScripting.html
Thanks Damien. I thought it might be possible since grasshopper is able to access RDK materials and, as far as i know, it's developed in VB.NET.
Grasshopper is able to access RDK materials? Where are you seeing that, or am I just slow? The shaders that David's put together are based on openGL standards not RDK, again that's as far as I'm aware.
If you right click on a shader parameter you can select "RDK Material" and a popup window appears with the document's RDK materials. I understand it's then converted to the EH_OGLShader for visualization purposes, but it has to be able to read the rdk's texture information, color, etc. If you reference an rdk material with a procedural texture, it's corresponding bitmap representation is displayed. The problem is when you input it to a scripting component .m_textures (where textures are supposed to be stored) is empty.
Thanks for pointing that out to me. Its hard to keep up with all the different features that get added to GH. I guess Andy's wrapped up a little functionality for dotNET or added a command or something. Anyway, here's my last stab at what could be going on here. First of all, I still don't think that GH actually retrieves any RDK material information. From a little snooping on my part, its seams as though GH just gets the GUID of the material, so that it can pass that to the pipeline or something like that. The RDK materials themselves have to be able to have an openGL representation, so that Rhino's display pipeline can understand them, so if there is some sort of communication between RDK and GH its probably happening at that level rather than higher up in the "RDK food chain". At this point you'll need some word from either David or possibly Andy on what's truly going on.
I guess i'm sticking with bitmaps for the time being. Now i have to figure out how to assign mapping channels to different textures (transparency texture is uv mapped, diffuse texture uses box mapping). There's no GUI for doing this when using the rhino basic material but 'ontexture' does seem to allow this..... at least this has to be possible. So far my first attempts have failed miserably, all textures change to the mapping channel 1. I'll keep trying but if someone points me in the right direction it would be a time saver.
Vicente. I noticed you have been working with baking basic rhino materials, and I having difficulty with this. In my component it allows me to bake my gradient as its object color and its print color, but have so far been unsuccessful with baking the color as its material.

att.ColorSource = Rhino.DocObjects.ObjectColorSource.ColorFromObject;
att.ObjectColor = color;
att.PlotColorSource = Rhino.DocObjects.ObjectPlotColorSource.PlotColorFromObject;
att.PlotColor = color;

stuck at===> att.MaterialSource = Rhino.DocObjects.ObjectMaterialSource.MaterialFromObject;

Any thoughts? Thanks.
Yep. See my last post on this thread:
http://www.grasshopper3d.com/forum/topics/colour-shading-a-mesh

The posted code creates a bitmap texture, a material with the bitmap texture as a transparency map and assigns this material to some objects.

The code is for the old SDK, i haven't tried this on Rhinocommon yet.

Mr

I'm looking to create a scripting to automatically Render class rings. Assigning official names to solids, surfacesand gems so that the script will apply materials of gold, black and gems.

I ask you please help me with this issue.




Thank you very much for your help and cooperation

Jorge Sanchez
tecnojoyas@gmail.com

 

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service