Hello. Could you please share the type of error (error message).
Looks like issue with bounds. Do you check 7.7 and 7.9 with the same Signal flags? With disabled exceptions in release, that error probably was ignored.
Best regards, Commenter-1.
Archived discussion
This was working with 7.7.0 and now I get an error with 7.9.0:
Graphic3d_PBRMaterial pbrMaterial;
pbrMaterial.SetEmission(Graphic3d_Vec3(0,0,0));
Graphic3d_BSDF bsdfGlass = Graphic3d_BSDF::CreateGlass(Graphic3d_Vec3(0,0,0), Graphic3d_Vec3(0,0,0), 0.5,0.5);
/*hangs now here -> */ pbrMaterial.SetBSDF(bsdfGlass);
Graphic3d_MaterialAspect materialAspect = Graphic3d_NOM_GLASS;
materialAspect.SetPBRMaterial(pbrMaterial);
aisGlass->SetMaterial(materialAspect);
the error:
terminate called after throwing an instance of 'Graphic3d_MaterialDefinitionError'if I keep the line out the material will be the standard glass but I would like to control it.
Thanks for tips!
Discussion
Posts are displayed in their archived order.
Hello. Could you please share the type of error (error message).
Looks like issue with bounds. Do you check 7.7 and 7.9 with the same Signal flags? With disabled exceptions in release, that error probably was ignored.
Best regards, Commenter-1.
You are trying to define material with IOR=0.5 (refraction index):
Graphic3d_BSDF::CreateGlass(Graphic3d_Vec3(0,0,0), Graphic3d_Vec3(0,0,0), 0.5,0.5);...
static Graphic3d_BSDF CreateGlass (const Graphic3d_Vec3& theWeight,
const Graphic3d_Vec3& theAbsorptionColor,
const Standard_ShortReal theAbsorptionCoeff,
const Standard_ShortReal theRefractionIndex);
The valid range of refraction index is [1.0, 3.0], hence you get constructor exception in Graphic3d_PBRMaterial::SetIOR() on trying to set 0.5:
//! Modifies index of refraction in [1, 3] range.
//! In practice affects only on non-metal materials reflection possibilities.
void Graphic3d_PBRMaterial::SetIOR (Standard_ShortReal theIOR);
Thanks for the answer but I am really lost now. The error comes at the line
pbrMaterial.SetBSDF(bsdfGlass);and not by the one before. Also I tried
Graphic3d_BSDF bsdfGlass = Graphic3d_BSDF::CreateGlass(Graphic3d_Vec3(0,0,0), Graphic3d_Vec3(0,0,0), 1.0, 3.0);and it still doesn't work. But it was working with 7.7.0
Never mind - it is working now.
The Absorption coefficient was way to high
Graphic3d_BSDF::CreateGlass(Graphic3d_Vec3(0,0,0), Graphic3d_Vec3(0,0,0), 0.05, 1);this is working perfect now.
Thank you both