pagarcia
(Pablo Garcia-Amorena)
February 26, 2019, 4:55pm
1
Hello,
When drawing Breps in display conduits, how can I draw both the shaded material and the main isocurves with corresponding occlusion?
In other words, I want to draw something like this:
In my code, using CRhinoDisplayPipeline::DrawShadedBrep
and CRhinoDisplayPipeline::DrawBrep
I have this:
How do I get the first one?
Many thanks,
Pablo
dale
(Dale Fugier)
February 26, 2019, 5:58pm
2
I’ve moved this to a new topic…
menno
(Menno Deij - van Rijswijk)
February 26, 2019, 6:00pm
3
Please post a file with the model, that always helps when answering a question. Also, how did you obtain the first picture?
pagarcia
(Pablo Garcia-Amorena)
February 26, 2019, 6:46pm
4
Actually the first picture is a Rhino sphere, this is my target.
I found the second one with the following piece of code:
class CDrawBrepConduit : public CRhinoDisplayConduit
{
public:
CDrawBrepConduit();
bool ExecConduit(CRhinoDisplayPipeline& dp, UINT channel, bool& bTerminate);
ON_Brep m_brep;
int m_wireDensity;
COLORREF m_color;
};
CDrawBrepConduit::CDrawBrepConduit()
: CRhinoDisplayConduit(CSupportChannels::SC_CALCBOUNDINGBOX | CSupportChannels::SC_DRAWOVERLAY)
{
m_wireDensity = 1;
m_color = RGB(0, 0, 0);
}
bool CDrawBrepConduit::ExecConduit(CRhinoDisplayPipeline& dp, UINT channel, bool& bTerminate)
{
UNREFERENCED_PARAMETER(bTerminate);
if (channel == CSupportChannels::SC_CALCBOUNDINGBOX) {
if (m_brep.IsValid()) {
m_pChannelAttrs->m_BoundingBox.Union(m_brep.BoundingBox());
}
}
else if (channel == CSupportChannels::SC_DRAWOVERLAY) {
if (m_brep.IsValid()) {
CDisplayPipelineMaterial mat = dp.DisplayAttrs()->m_pMaterial->m_FrontMaterial;
dp.DrawBrep(m_brep, m_color, m_wireDensity);
CRhinoCacheHandle cache;
dp.DrawShadedBrep(&m_brep, &mat, &cache);
}
}
return true;
}
DrawBrep
draws the isocurves and DrawShadedBrep
draws the material. As you see, the isocurves are not occluded by the material right now. May this be achieved when drawing in different channels or pipeline steps?
Pablo
dale
(Dale Fugier)
February 27, 2019, 1:08am
5
Hi @pagarcia ,
Is the second image a surface of revolution or a NURBS surface? The Sphere
command makes the former.
– Dale
XNurbs
February 27, 2019, 10:24am
6
Hi Pablo,
@dale is the man to ask. We use the code from Dale.
pagarcia
(Pablo Garcia-Amorena)
February 27, 2019, 10:45am
7
Hi @dale ,
Here I attach a solution obtaining the second picture:
SampleDrawBrep.zip (36.4 KB)
I get the brep of a Rhino sphere just like this:
ON_Sphere sphere(ON_3dPoint(0, 0, 0), 10.0);
ON_Brep* brep = ON_BrepSphere(sphere);
The question is: how to get isocurve occlusion (the brep material hiding the isocurves in the back with respect to camera point of view)?
I think it’s related to the order of drawing in DrawBrep
/ DrawShadedBrep
and the display conduit channels.
Many thanks,
Pablo
dale
(Dale Fugier)
February 27, 2019, 4:10pm
8
Hi @pagarcia ,
This sample seems to draw a sphere (surface of revoluation) like Rhino’s default Shaded display mode would draw the output of the Sphere
command.
cmdSampleDrawBrep.cpp
– Dale
1 Like
pagarcia
(Pablo Garcia-Amorena)
February 28, 2019, 10:14am
9
Awesome!! Thank you very much.
Pablo