@fraguada @nathanletwory Guys last question here. Im trying to cast material from Doc to RenderMaterial and im using CreateBasicMaterial(mat); to use evaluator but this way it looks like this isnt working cause im getting always black dots. Is there any way to cast RhinoDoc texture directly to RenderTexture ?
Material mat = instance.GetMaterial(true);
Rhino.Render.RenderMaterial renMat = Rhino.Render.RenderMaterial.CreateBasicMaterial(mat);
string nname = renMat.TextureChildSlotName(Rhino.Render.RenderMaterial.StandardChildSlots.Diffuse);
Rhino.Render.RenderTexture renTex = renMat.FindChild(nname) as Rhino.Render.RenderTexture;
var texEval = renTex.CreateEvaluator();
I don’t have a clue why material don’t have texture cause it inherits for eg. name. Due to use of different rendering plugins material defs are different but every of them exposes diffuse for preview purposes so diffuse should be “catchable”. So i tried with standard rhinorender mat and i get also 0,0,0 eval on all points.
Edit: It is bit weird cause if i force to open renTex in modal editor everything is ok even when reading bitmap from external render plugin. @fraguada any clue whats going on?
Edit2: I tried to comitchanges/push material to doc etc. It is weird cause even if material is created and then i assign new material manually (rhino internal mat of course) i still get 0,0,0 from evaluator … created material looks ok it has diffuse in slot as it should, so i dont know what could be wrong here… renTex.OpenInModalEditor(); shows proper texture so i dont know where to look further @dale @pascal Maybe You Guys have some idea on this?
Edit3: So far i found that this is probably bug cause when i call rendertexture using renMat i get always black points.
int material_index = instance.Attributes.MaterialIndex;
material_index = Rhino.RhinoDoc.ActiveDoc.Materials.Add();
Rhino.DocObjects.Material xmat = Rhino.RhinoDoc.ActiveDoc.Materials[material_index];
Rhino.Render.RenderTexture renTex = instance.RenderMaterial.FindChild(nname) as Rhino.Render.RenderTexture;
renTex retuns null in this case - i really ran out of ideas.
Edit4: Even when i created completely new mat and assigned texture and updated object and then returned to original state as @fraguada showed in example - i’ve ended up again with new material in material tab which looks ok and has diffuse slot loaded with proper texture but from this material evaluator i get 0,0,0 again. So far i understand texture evaluator only works with materials created by hand?