tweak dump image settings for better viz of grid cells
This commit is contained in:
@ -921,6 +921,14 @@ void DumpImage::create_image()
|
||||
// for 3d, outward normals on all 6 faces
|
||||
|
||||
if (gridflag) {
|
||||
|
||||
// reset lighting for flat surfaces to make them brighter
|
||||
|
||||
image->ambientColor[0] = image->ambientColor[1] = image->ambientColor[2] = 0.9;
|
||||
image->keyLightColor[0] = image->keyLightColor[1] = image->keyLightColor[2] = 0.3;
|
||||
image->fillLightColor[0] = image->fillLightColor[1] = image->fillLightColor[2] = 0.3;
|
||||
image->backLightColor[0] = image->backLightColor[1] = image->backLightColor[2] = 0.3;
|
||||
|
||||
int n = 0;
|
||||
if (domain->dimension == 2) {
|
||||
for (int iy = nylo_in; iy <= nyhi_in; iy++)
|
||||
@ -956,6 +964,13 @@ void DumpImage::create_image()
|
||||
image->draw_triangle(gcorners[4],gcorners[7],gcorners[6],color);
|
||||
}
|
||||
}
|
||||
|
||||
// restore lighting for curved objects
|
||||
|
||||
image->ambientColor[0] = image->ambientColor[1] = image->ambientColor[2] = 0.0;
|
||||
image->keyLightColor[0] = image->keyLightColor[1] = image->keyLightColor[2] = 0.9;
|
||||
image->fillLightColor[0] = image->fillLightColor[1] = image->fillLightColor[2] = 0.45;
|
||||
image->backLightColor[0] = image->backLightColor[1] = image->backLightColor[2] = 0.9;
|
||||
}
|
||||
|
||||
// render atoms that are lines
|
||||
|
||||
@ -815,26 +815,34 @@ void Image::draw_triangle(double *x, double *y, double *z, double *surfaceColor)
|
||||
double s1[3], s2[3], s3[3];
|
||||
double c1[3], c2[3];
|
||||
|
||||
// for grid cell viz:
|
||||
// using <= if test can leave single-pixel gaps between 2 tris
|
||||
// using < if test fixes it
|
||||
// suggested by Nathan Fabian, Nov 2022
|
||||
|
||||
MathExtra::sub3 (zlocal, xlocal, s1);
|
||||
MathExtra::sub3 (ylocal, xlocal, s2);
|
||||
MathExtra::sub3 (p, xlocal, s3);
|
||||
MathExtra::cross3 (s1, s2, c1);
|
||||
MathExtra::cross3 (s1, s3, c2);
|
||||
if (MathExtra::dot3 (c1, c2) <= 0) continue;
|
||||
if (MathExtra::dot3 (c1, c2) < 0) continue;
|
||||
//if (MathExtra::dot3 (c1, c2) <= 0) continue;
|
||||
|
||||
MathExtra::sub3 (xlocal, ylocal, s1);
|
||||
MathExtra::sub3 (zlocal, ylocal, s2);
|
||||
MathExtra::sub3 (p, ylocal, s3);
|
||||
MathExtra::cross3 (s1, s2, c1);
|
||||
MathExtra::cross3 (s1, s3, c2);
|
||||
if (MathExtra::dot3 (c1, c2) <= 0) continue;
|
||||
if (MathExtra::dot3 (c1, c2) < 0) continue;
|
||||
//if (MathExtra::dot3 (c1, c2) <= 0) continue;
|
||||
|
||||
MathExtra::sub3 (ylocal, zlocal, s1);
|
||||
MathExtra::sub3 (xlocal, zlocal, s2);
|
||||
MathExtra::sub3 (p, zlocal, s3);
|
||||
MathExtra::cross3 (s1, s2, c1);
|
||||
MathExtra::cross3 (s1, s3, c2);
|
||||
if (MathExtra::dot3 (c1, c2) <= 0) continue;
|
||||
if (MathExtra::dot3 (c1, c2) < 0) continue;
|
||||
//if (MathExtra::dot3 (c1, c2) <= 0) continue;
|
||||
|
||||
double cNormal[3];
|
||||
cNormal[0] = MathExtra::dot3(camRight, normal);
|
||||
|
||||
13
src/image.h
13
src/image.h
@ -34,6 +34,11 @@ class Image : protected Pointers {
|
||||
double *boxcolor; // color to draw box outline with
|
||||
int background[3]; // RGB values of background
|
||||
|
||||
double ambientColor[3]; // light color settings (adjustable by caller)
|
||||
double keyLightColor[3];
|
||||
double fillLightColor[3];
|
||||
double backLightColor[3];
|
||||
|
||||
Image(class LAMMPS *, int);
|
||||
~Image() override;
|
||||
void buffers();
|
||||
@ -80,19 +85,19 @@ class Image : protected Pointers {
|
||||
// constant view params
|
||||
|
||||
double FOV;
|
||||
double ambientColor[3];
|
||||
//double ambientColor[3];
|
||||
|
||||
double keyLightTheta;
|
||||
double keyLightPhi;
|
||||
double keyLightColor[3];
|
||||
//double keyLightColor[3];
|
||||
|
||||
double fillLightTheta;
|
||||
double fillLightPhi;
|
||||
double fillLightColor[3];
|
||||
//double fillLightColor[3];
|
||||
|
||||
double backLightTheta;
|
||||
double backLightPhi;
|
||||
double backLightColor[3];
|
||||
//double backLightColor[3];
|
||||
|
||||
double specularHardness;
|
||||
double specularIntensity;
|
||||
|
||||
Reference in New Issue
Block a user