Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Is it possible to create a material only with color, without texture?
I use the follow code to create a marerial from texture, how modify it to use a simple color?
Thank you
// Create the texture map image
ImageFileTexture tex = new ImageFileTexture();
tex.SourceFileName = sTextureMapPath;
// We need a cylindrical mapping with no tiling
Mapper mapper = new Mapper(PlatformDb.GraphicsInterface.Projection.Box,
Tiling.Clamp,
Tiling.Clamp,
AutoTransform.TransformObject,
Matrix3d.Identity);
MaterialMap map = new MaterialMap(Source.File,
tex,
1.0,
mapper);
// Set the opacity and refraction maps
MaterialDiffuseComponent mdc = new MaterialDiffuseComponent(new
MaterialColor(), map);
MaterialRefractionComponent mrc = new MaterialRefractionComponent(2.0, map);
// Create a new material
Material mat = new Material();
mat.Name = sMaterialName;
mat.Diffuse = mdc;
mat.Refraction = mrc;
mat.Mode = Mode.Realistic;
mat.Reflectivity = 1.0;
mat.IlluminationModel = IlluminationModel.BlinnShader;
mat.Opacity = new MaterialOpacityComponent(opacityPercentage, new
MaterialMap());
// Add it to the library
matLib.UpgradeOpen();
materialId = matLib.SetAt(sMaterialName, mat);
Solved! Go to Solution.