mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0024855: Revision of parameters of standard materials
Improve consistency and visual appearance of predefined OCCT materials in various rendering modes, including ray-tracing: - Increase the specular exponents (shininesses) for metallic surfaces: Brass, Bronze, Copper, Gold, Pewter, Silver, Steel, Chrome, Aluminum. - Revise specular colors for metals: Copper, Gold, Aluminum, Silver (according to "Real-Time Rendering, 3rd Edition", AK Peters 2008). - Increase diffuse reflection of metals: Silver, Aluminum, Chrome (to make them brighter in OpenGL mode). - Extend Material definition by Refraction Index. Advanced rendering methods based on shaders or ray-tracing can utilize it to produce refraction effects. In addition: - Introduce three translucent materials: Water, Glass, and Diamond. - Add Charcoal for modeling dark diffuse surfaces. Add new TCL-based sample (materials.tcl) and test case (tests/v3d/materials/bug24855).
This commit is contained in:
@@ -115,32 +115,39 @@ is
|
||||
|
||||
enumeration NameOfMaterial is
|
||||
NOM_BRASS, -- laiton (PHYSIC)
|
||||
NOM_BRONZE, -- bronze (PHYSIC)
|
||||
NOM_COPPER, -- cuivre (PHYSIC)
|
||||
NOM_GOLD, -- or (PHYSIC)
|
||||
NOM_BRONZE, -- bronze (PHYSIC)
|
||||
NOM_COPPER, -- cuivre (PHYSIC)
|
||||
NOM_GOLD, -- or (PHYSIC)
|
||||
|
||||
NOM_PEWTER, -- etain (PHYSIC)
|
||||
NOM_PEWTER, -- etain (PHYSIC)
|
||||
|
||||
NOM_PLASTER, -- platre (GENERIC)
|
||||
NOM_PLASTIC, -- plastic (GENERIC)
|
||||
NOM_PLASTER, -- platre (GENERIC)
|
||||
NOM_PLASTIC, -- plastic (GENERIC)
|
||||
|
||||
NOM_SILVER, -- argent (PHYSIC)
|
||||
NOM_SILVER, -- argent (PHYSIC)
|
||||
|
||||
NOM_STEEL, -- acier (PHYSIC)
|
||||
NOM_STEEL, -- acier (PHYSIC)
|
||||
|
||||
NOM_STONE, -- pierre (PHYSIC)
|
||||
NOM_STONE, -- pierre (PHYSIC)
|
||||
|
||||
NOM_SHINY_PLASTIC, -- plastique brillant (GENERIC)
|
||||
NOM_SATIN, -- satin (GENERIC)
|
||||
NOM_METALIZED, -- metallise New (GENERIC)
|
||||
NOM_NEON_GNC, -- neon New (GENERIC)
|
||||
NOM_CHROME, -- chrome New (PHYSIC)
|
||||
NOM_ALUMINIUM, -- aluminium New (PHYSIC)
|
||||
NOM_OBSIDIAN, -- obsidian New (PHYSIC)
|
||||
NOM_NEON_PHC, -- neon New (PHYSIC)
|
||||
NOM_JADE, -- jade New (PHYSIC)
|
||||
NOM_DEFAULT,
|
||||
NOM_UserDefined -- owner material
|
||||
NOM_SHINY_PLASTIC, -- plastique brillant (GENERIC)
|
||||
NOM_SATIN, -- satin (GENERIC)
|
||||
NOM_METALIZED, -- metallise New (GENERIC)
|
||||
NOM_NEON_GNC, -- neon New (GENERIC)
|
||||
NOM_CHROME, -- chrome New (PHYSIC)
|
||||
NOM_ALUMINIUM, -- aluminium New (PHYSIC)
|
||||
NOM_OBSIDIAN, -- obsidian New (PHYSIC)
|
||||
NOM_NEON_PHC, -- neon New (PHYSIC)
|
||||
NOM_JADE, -- jade New (PHYSIC)
|
||||
|
||||
NOM_CHARCOAL,
|
||||
|
||||
NOM_WATER,
|
||||
NOM_GLASS,
|
||||
NOM_DIAMOND,
|
||||
|
||||
NOM_DEFAULT,
|
||||
NOM_UserDefined -- owner material
|
||||
end NameOfMaterial;
|
||||
---Purpose: Types of aspect materials.
|
||||
---Category: Enumerations
|
||||
|
@@ -143,6 +143,15 @@ is
|
||||
-- negative value or greater than 1.0.
|
||||
raises MaterialDefinitionError from Graphic3d is static;
|
||||
|
||||
SetRefractionIndex ( me : in out;
|
||||
theValue : Real from Standard )
|
||||
---Level: Public
|
||||
---Purpose: Modifies the refraction index of the material.
|
||||
-- Category: Methods to modify the class definition
|
||||
-- Warning: Raises MaterialDefinitionError if <theValue> is a
|
||||
-- lesser than 1.0.
|
||||
raises MaterialDefinitionError from Graphic3d is static;
|
||||
|
||||
SetColor ( me : in out;
|
||||
AColor : Color from Quantity )
|
||||
is static;
|
||||
@@ -313,7 +322,14 @@ is
|
||||
---Purpose: Returns the transparency coefficient of the surface.
|
||||
---Category: Inquire methods
|
||||
|
||||
Emissive ( me )
|
||||
RefractionIndex ( me )
|
||||
returns Real from Standard
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the refraction index of the material
|
||||
---Category: Inquire methods
|
||||
|
||||
Emissive ( me )
|
||||
returns Real from Standard
|
||||
is static;
|
||||
---Level: Public
|
||||
@@ -409,7 +425,7 @@ is
|
||||
|
||||
Init ( me : out; AName : NameOfMaterial from Graphic3d) is private;
|
||||
|
||||
--
|
||||
--
|
||||
|
||||
fields
|
||||
|
||||
@@ -449,47 +465,44 @@ fields
|
||||
-- Iris Advanced Graphics, unit D
|
||||
--
|
||||
--
|
||||
-- the coefficient of diffuse reflection, the colour, and the activity
|
||||
MyDiffuseCoef : ShortReal from Standard;
|
||||
MyDiffuseColor : Color from Quantity;
|
||||
MyDiffuseActivity : Boolean from Standard;
|
||||
-- the coefficient of diffuse reflection, the colour, and the activity
|
||||
myDiffuseCoef : ShortReal from Standard;
|
||||
myDiffuseColor : Color from Quantity;
|
||||
myDiffuseActivity : Boolean from Standard;
|
||||
|
||||
-- the coefficient of ambient reflection, the colour
|
||||
-- and the activity
|
||||
MyAmbientCoef : ShortReal from Standard;
|
||||
MyAmbientColor : Color from Quantity;
|
||||
MyAmbientActivity : Boolean from Standard;
|
||||
-- the coefficient of ambient reflection, the colour and the activity
|
||||
myAmbientCoef : ShortReal from Standard;
|
||||
myAmbientColor : Color from Quantity;
|
||||
myAmbientActivity : Boolean from Standard;
|
||||
|
||||
-- the coefficient of specular reflection, the colour
|
||||
-- and the activity
|
||||
MySpecularCoef : ShortReal from Standard;
|
||||
MySpecularColor : Color from Quantity;
|
||||
MySpecularActivity : Boolean from Standard;
|
||||
|
||||
-- the coefficient of emissive reflection
|
||||
MyEmissiveCoef : ShortReal from Standard;
|
||||
MyEmissiveColor : Color from Quantity;
|
||||
MyEmissiveActivity : Boolean from Standard;
|
||||
-- the coefficient of specular reflection, the colour and the activity
|
||||
mySpecularCoef : ShortReal from Standard;
|
||||
mySpecularColor : Color from Quantity;
|
||||
mySpecularActivity : Boolean from Standard;
|
||||
|
||||
-- the coefficient of transparency
|
||||
MyTransparencyCoef : ShortReal from Standard;
|
||||
-- the coefficient of emissive reflection
|
||||
myEmissiveCoef : ShortReal from Standard;
|
||||
myEmissiveColor : Color from Quantity;
|
||||
myEmissiveActivity : Boolean from Standard;
|
||||
|
||||
-- the coefficient of luminosity
|
||||
MyShininess : ShortReal from Standard;
|
||||
-- the coefficient of transparency and refraction index
|
||||
myTransparencyCoef : ShortReal from Standard;
|
||||
myRefractionIndex : ShortReal from Standard;
|
||||
|
||||
-- the specular exponent
|
||||
myShininess : ShortReal from Standard;
|
||||
|
||||
-- the coeficient of reflexion for the environment texture
|
||||
MyEnvReflexion : ShortReal from Standard;
|
||||
|
||||
-- the type of material
|
||||
--MyMaterialType : Boolean from Standard;
|
||||
MyMaterialType : TypeOfMaterial from Graphic3d;
|
||||
-- the coeficient of reflexion for the environment texture
|
||||
myEnvReflexion : ShortReal from Standard;
|
||||
|
||||
-- the Name of material
|
||||
MyMaterialName : NameOfMaterial from Graphic3d;
|
||||
MyRequestedMaterialName : NameOfMaterial from Graphic3d;
|
||||
-- the type of material
|
||||
myMaterialType : TypeOfMaterial from Graphic3d;
|
||||
|
||||
-- the string name of the material
|
||||
MyStringName : AsciiString from TCollection;
|
||||
-- the Name of material
|
||||
myMaterialName : NameOfMaterial from Graphic3d;
|
||||
myRequestedMaterialName : NameOfMaterial from Graphic3d;
|
||||
|
||||
-- the string name of the material
|
||||
myStringName : AsciiString from TCollection;
|
||||
|
||||
end MaterialAspect;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1034,12 +1034,13 @@ void Graphic3d_Structure::SetPrimitivesAspect (const Handle(Graphic3d_AspectFill
|
||||
// Back Material
|
||||
const Graphic3d_MaterialAspect& aBack = theAspFill->BackMaterial();
|
||||
// Light specificity
|
||||
myCStructure->ContextFillArea.Back.Shininess = float (aBack.Shininess());
|
||||
myCStructure->ContextFillArea.Back.Ambient = float (aBack.Ambient());
|
||||
myCStructure->ContextFillArea.Back.Diffuse = float (aBack.Diffuse());
|
||||
myCStructure->ContextFillArea.Back.Specular = float (aBack.Specular());
|
||||
myCStructure->ContextFillArea.Back.Transparency = float (aBack.Transparency());
|
||||
myCStructure->ContextFillArea.Back.Emission = float (aBack.Emissive());
|
||||
myCStructure->ContextFillArea.Back.Shininess = float (aBack.Shininess());
|
||||
myCStructure->ContextFillArea.Back.Ambient = float (aBack.Ambient());
|
||||
myCStructure->ContextFillArea.Back.Diffuse = float (aBack.Diffuse());
|
||||
myCStructure->ContextFillArea.Back.Specular = float (aBack.Specular());
|
||||
myCStructure->ContextFillArea.Back.Transparency = float (aBack.Transparency());
|
||||
myCStructure->ContextFillArea.Back.RefractionIndex = float (aBack.RefractionIndex());
|
||||
myCStructure->ContextFillArea.Back.Emission = float (aBack.Emissive());
|
||||
|
||||
// Reflection mode
|
||||
myCStructure->ContextFillArea.Back.IsAmbient = (aBack.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0);
|
||||
@@ -1077,12 +1078,13 @@ void Graphic3d_Structure::SetPrimitivesAspect (const Handle(Graphic3d_AspectFill
|
||||
// Front Material
|
||||
const Graphic3d_MaterialAspect& aFront = theAspFill->FrontMaterial();
|
||||
// Light specificity
|
||||
myCStructure->ContextFillArea.Front.Shininess = float (aFront.Shininess());
|
||||
myCStructure->ContextFillArea.Front.Ambient = float (aFront.Ambient());
|
||||
myCStructure->ContextFillArea.Front.Diffuse = float (aFront.Diffuse());
|
||||
myCStructure->ContextFillArea.Front.Specular = float (aFront.Specular());
|
||||
myCStructure->ContextFillArea.Front.Transparency = float (aFront.Transparency());
|
||||
myCStructure->ContextFillArea.Front.Emission = float (aFront.Emissive());
|
||||
myCStructure->ContextFillArea.Front.Shininess = float (aFront.Shininess());
|
||||
myCStructure->ContextFillArea.Front.Ambient = float (aFront.Ambient());
|
||||
myCStructure->ContextFillArea.Front.Diffuse = float (aFront.Diffuse());
|
||||
myCStructure->ContextFillArea.Front.Specular = float (aFront.Specular());
|
||||
myCStructure->ContextFillArea.Front.Transparency = float (aFront.Transparency());
|
||||
myCStructure->ContextFillArea.Front.RefractionIndex = float (aFront.RefractionIndex());
|
||||
myCStructure->ContextFillArea.Front.Emission = float (aFront.Emissive());
|
||||
|
||||
// Reflection mode
|
||||
myCStructure->ContextFillArea.Front.IsAmbient = (aFront.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0);
|
||||
|
@@ -62,8 +62,9 @@ typedef struct {
|
||||
float Emission;
|
||||
int IsEmission;
|
||||
|
||||
float Transparency;
|
||||
float Shininess;
|
||||
float Transparency;
|
||||
float RefractionIndex;
|
||||
|
||||
float EnvReflexion;
|
||||
|
||||
|
@@ -33,7 +33,7 @@ namespace
|
||||
static OPENGL_SURF_PROP THE_DEFAULT_MATERIAL =
|
||||
{
|
||||
0.2F, 0.8F, 0.1F, 0.0F, // amb, diff, spec, emsv
|
||||
1.0F, 10.0F, 0.0F, // trans, shine, env_reflexion
|
||||
1.0F, 10.0F, 1.0F, 0.0F, // trans, shine, index, env_reflexion
|
||||
0, // isphysic
|
||||
(OPENGL_AMBIENT_MASK | OPENGL_DIFFUSE_MASK | OPENGL_SPECULAR_MASK), // color_mask
|
||||
{{ 1.0F, 1.0F, 1.0F, 1.0F }}, // ambient color
|
||||
@@ -110,6 +110,7 @@ void OpenGl_AspectFace::convertMaterial (const CALL_DEF_MATERIAL& theMat,
|
||||
// trans = 1. => transparent
|
||||
// in OpenGl it is opposite.
|
||||
theSurf.trans = 1.0f - theMat.Transparency;
|
||||
theSurf.index = theMat.RefractionIndex;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -42,7 +42,7 @@ static const TEL_POFFSET_PARAM THE_DEFAULT_POFFSET = { Aspect_POM_Fill, 1.0F, 0.
|
||||
struct OPENGL_SURF_PROP
|
||||
{
|
||||
float amb, diff, spec, emsv;
|
||||
float trans, shine;
|
||||
float trans, shine, index;
|
||||
float env_reflexion;
|
||||
int isphysic;
|
||||
unsigned int color_mask;
|
||||
|
Reference in New Issue
Block a user